Skip to content

Latest commit

 

History

History
88 lines (61 loc) · 3.41 KB

README.md

File metadata and controls

88 lines (61 loc) · 3.41 KB

contentful.swift

Version Carthage compatible Platform License Build Status Coverage Status codebeat badge

Swift SDK for Contentful's Content Delivery API.

Contentful is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.

The Contentful Swift SDK hasn't reached 1.0, yet, but provides a much nicer API than using the Objective-C SDK from Swift. If you need some of the more advanced features, like offline persistence using Core Data, you have to stick to the Objective-C SDK for now. Check out our Swift example in this case.

Usage

let client = Client(spaceIdentifier: "cfexampleapi", accessToken: "b4c0n73n7fu1")
client.fetchEntry("nyancat") { (result) in
    switch result {
        case let .Success(entry):
            print(entry)
        case .Error(_):
            print("Error!")
    }
}

Documentation

For further information, check out the Developer Documentation.

Swift Versioning

The Contentful Swift SDK requires, at minimum, Swift 2.2 and therefore Xcode 7.3.

Swift version Compatible Contentful tag
Swift 3.0 v0.3.0
Swift 2.3 v0.2.2
Swift 2.2 v0.2.1

Installation

Contentful can be installed with either CocoaPods or Carthage depending on your preference.

CocoaPods

CocoaPods is a dependency manager for Swift, which automates and simplifies the process of using 3rd-party libraries like the Contentful Delivery API in your projects.

platform :ios, '8.0'
use_frameworks!
pod 'Contentful'

You an also specify a specific version depending on your needs.

pod 'Contentful', '0.2.1' 

To learn more about operators for dependency versioning within a Podfile, see the CocoaPods doc on the Podfile.

Carthage

You can also use Carthage for integration by adding this to your Cartfile:

github "contentful/contentful.swift" ~> 0.3.0

License

Copyright (c) 2016 Contentful GmbH. See LICENSE for further details.