Protocols

The following protocols are available globally.

  • A simple protocol to bridge Contentful.Asset and other formats for storing asset information.

    See more

    Declaration

    Swift

    public protocol AssetProtocol : FlatResource
  • Classes conforming to this protocol can be decoded during JSON deserialization as reprsentations of Contentful assets.

    Declaration

    Swift

    public protocol AssetDecodable : AssetProtocol, Decodable
  • The Integration protocol describes the libary name and version number for external integrations to be used in conjunction with the contentful.swift SDK.

    See more

    Declaration

    Swift

    public protocol Integration
  • Implement this protocol in order to provide your own custom logger for the SDK to log messages to. Your CustomLogger instance will only be passed message it should log according the set log level.

    See more

    Declaration

    Swift

    public protocol CustomLogger
  • Classes conforming to this protocol can be passed into your Client instance so that fetch methods returning may decode the JSON to your own classes before returning them in async callbacks.

    It’s important to note that there is no special handling of locales so if using the locale=* query parameter, you will need to implement the special handing in your init(from decoder: Decoder) throws initializer for your class.

    Example:

    func fetchArray(of: Cat.self, matching: QueryON<Cat>,
    then completion: @escaping ResultsHandler<MappedArrayResponse<Cat>>) -> URLSessionDataTask?
    
    See more

    Declaration

    Swift

    public protocol EntryDecodable : AnyObject, EndpointAccessible, FlatResource, Decodable
  • Classes conforming to this protocol are accessible via an Endpoint.

    See more

    Declaration

    Swift

    public protocol EndpointAccessible
  • Conform to this protocol and initialize your Client instance with the persistenceIntegration initialization parameter set to recieve messages about creation and deletion of Entrys and Assets in your space when doing sync operations using the Client.initialSync() and Client.nextSync()methods. Proper conformance to this protocol should enable persisting the state changes that happen in your Contentful space to a persistent store such asCoreData`.

    See more

    Declaration

    Swift

    public protocol PersistenceIntegration : Integration
  • Use types that conform to QueryableRange to perform queries with the four Range operators See: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/ranges

    See more

    Declaration

    Swift

    public protocol QueryableRange
  • A base abtract type which holds the bare essentials shared by all query types in the SDK which enable querying against content types, entries and assets.

    See more

    Declaration

    Swift

    public protocol AbstractQuery : AnyObject

KeyPath/Value operations.