Protocols
The following protocols are available globally.
-
A simple protocol to bridge
See moreContentful.Asset
and other formats for storing asset information.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
See moreIntegration
protocol describes the libary name and version number for external integrations to be used in conjunction with the contentful.swift SDK.Declaration
Swift
public protocol Integration
-
Implement this protocol in order to provide your own custom logger for the SDK to log messages to. Your
See moreCustomLogger
instance will only be passed message it should log according the set log level.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:
See morefunc fetchArray(of: Cat.self, matching: QueryON<Cat>, then completion: @escaping ResultsHandler<MappedArrayResponse<Cat>>) -> URLSessionDataTask?
Declaration
Swift
public protocol EntryDecodable : AnyObject, EndpointAccessible, FlatResource, Decodable
-
Declaration
Swift
public protocol EndpointAccessible
-
Conform to this protocol and initialize your
See moreClient
instance with thepersistenceIntegration
initialization parameter set to recieve messages about creation and deletion ofEntry
s andAsset
s in your space when doing sync operations using theClient.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 as
CoreData`.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 moreDeclaration
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 moreDeclaration
Swift
public protocol AbstractQuery : AnyObject
-
Protocol which enables concrete query implementations to be ‘chained’ together so that results can be filtered by more than one
See moreQuery.Operation
or other query. Protocol extensions give default implementation so that all concrete types,Query
,AssetQuery
,FilterQuery
, andQueryOn<EntryType>
, can use the same implementation.Declaration
Swift
public protocol ChainableQuery : AbstractQuery
-
A base abtract type which holds methods and constructors for all valid queries against resource: i.e. Contentful entries and assets.
See moreDeclaration
Swift
public protocol AbstractResourceQuery : ChainableQuery
-
The base abstract type for querying Contentful entries. The contained operations in the default implementation of this protocol can only be used when querying against the `/entries/ endpoint of the Content Delivery and Content Preview APIs. See: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
See moreDeclaration
Swift
public protocol EntryQuery : AbstractResourceQuery
-
Protocol for resources inside Contentful.
See moreDeclaration
Swift
public protocol Resource
-
A protocol enabling strongly typed queries to the Contentful Delivery API via the SDK.
See moreDeclaration
Swift
public protocol FieldKeysQueryable
-
Entities conforming to this protocol have a
See moreQueryType
that the SDK can use to make generic fetch requests.Declaration
Swift
public protocol ResourceQueryable
-
The base protocol which all node types that may be present in a tree of Structured text. See: https://www.contentful.com/developers/docs/tutorials/general/structured-text-field-type-alpha/ for more information.
See moreDeclaration
Swift
public protocol Node : Decodable, Encodable