Latest 0.1
Homepage https://github.com/lvsti/Cutis
License MIT
Platforms ios 8.0, osx 10.9
Authors

[CocoaPods]()
Carthage compatible

Cutis ("Comfortable UTIs") is a thin Swift wrapper on top of the UTI (Uniform Type Identifier) C API.

Apart from providing a typesafe and object-oriented wrapper around type identifiers, Cutis does the heavy lifting for you by taking care of the casting and memory management required when interacting with CoreFoundation-style APIs.

If you deal a lot with type identifiers in your project, Cutis can make your code simpler and easier to follow.

Examples

Getting the default file extension for a type:

let uti = UTType("com.adobe.pdf")

if let tags = uti.declaration?.tagSpecification,
   let allExts = tags[UTTypeTagClass.FileExtension],
   let ext = allExts.first {
    NSLog("preferred file extension for the given type: %@", ext)
}

Checking whether there is an image representation of a given pasteboard item:

func hasImageRep(item: NSPasteboardItem) -> Bool {
   return item.types.contains({ UTType($0).conformsTo(.Image) })
}

Requirements

Xcode 7, Swift 2.1, OSX 10.9, iOS 8.0

Latest podspec

{
    "name": "Cutis",
    "version": "0.1",
    "summary": "Cutis ("Comfortable UTIs") is a thin Swift wrapper on top of the UTI (Universal Type Identifier) C API.",
    "homepage": "https://github.com/lvsti/Cutis",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tamas Lustyik": "[email protected]"
    },
    "social_media_url": "http://twitter.com/cocoagrinder",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    },
    "source": {
        "git": "https://github.com/lvsti/Cutis.git",
        "tag": "v0.1",
        "submodules": true
    },
    "source_files": "Cutis/**/*.{h,swift}"
}

Pin It on Pinterest

Share This