Giter VIP home page Giter VIP logo

contentful.swift's Introduction

Contentful

contentful.swift

Version Carthage compatible Swift Package Manager 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.0 and is therefore subject to API changes. However, it provides a more usable API than the Objective-C SDK and has support for more API features. It is recommended to use contentful.swift over contentful.objc as future development at Contentful will focus on Swift rather than Objective-C. However, if your project must utilize Contentful's Content Managamement API, Objective-C is the only  language supported at the moment. See ContentfulManagementAPI at Cocoapods.org for more information.

Full feature comparison of contentful.swift & contentful.objc

CDA Features contentful.swift contentful.objc
API coverage*
Images API
Search Parameters 🚫
Fallback locales for sync api 🚫
Rate limit handling 🚫

*API Coverage definition: all endpoints can be interfaced with and complex queries can be constructed by passing in dictionaries of http parameter/argument pairs. Note that the Swift SDK provides much more comprehensive coverage and takes advantage of type system, outdoing the "stringly typed" interface that the Objective-C SDK offers.

Usage

let client = Client(spaceId: "cfexampleapi", accessToken: "b4c0n73n7fu1")
client.fetchEntry("nyancat") { (result: Result<Entry>) in
    switch result {
        case .success(entry):
            print(entry)
        case .error(let error):
            print("Error \(error)!")
    }
}

EntryModellable and MappedContent

The EntryModellable protocols allows you to define types that will be mapped from Entrys of the various content types in your Contentful space. When using methods such as:

func fetchMappedEntries(with query: Query) -> Observable<Result<MappedContent>>

the asynchronously returned result will be an instance of MappedContent which will contain a dictionary which maps content type identifiers to arrays of EntryModellable (types of your own definition) that have been fetched. Note that these features are in beta and the API is subject to change.

Reference Documentation

For further information about the API, check out the Content Delivery API Reference 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 [0.3.0 - 0.9.2]
Swift 2.3 0.2.3
Swift 2.2 0.2.1

While there have been some patches applied to the Swift-2.3 branch, no future maintainence is intended on this branch. It is recommended to upgrade to Swift 3 and use the newest version of contentful.swift.

CocoaPods installation

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 can specify a specific version of Contentful depending on your needs. To learn more about operators for dependency versioning within a Podfile, see the CocoaPods doc on the Podfile.

pod 'Contentful', '~> 0.9.2' 

Note that for Swift 2.3 support (contentful.swift v0.2.3) you will need to add a post-install script to your Podfile if installing with Cocoapods:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '2.3'
    end
  end
end

Carthage installation

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

github "contentful/contentful.swift" ~> 0.9.0

License

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

contentful.swift's People

Contributors

antonthedev avatar loudmouth avatar marcinwyszynski avatar neonichu avatar roblinde avatar sebastianludwig avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.