REST
@propertyWrapper
public class REST
<Element: RESTElement,
N: NetworkHandler,
F: Filterable,
S: Sortable,
ID: CustomStringConvertible >: LocalFileStorable where Element.ID == ID?
The property wrapper is used for automatic observation of a connected data structure that is automatically synchronized with the specified RESTful service in the Service variable. Filtering, Sorting or Caching the data structure is optional and can be configured with the initialization.
- Paramaters:
- Element: specifies the type of data structure that needs to be observed, it conforms to
RESTElementwhich ensures that the data structure supports the needed functionality - F: specifies the type of data structure where a filter is applied on, it conforms to
Filterablewhich ensures that the data structure supports the needed functionality - S: specifies the type of data strucutre that will be sorted, it conforms to
Sortablewhich ensures that the data structure supports the needed functionality - ID: specifies the type of the ID from the
Element
- Element: specifies the type of data structure that needs to be observed, it conforms to
-
storagePathspecifies the appendix of the storage location in the caching process.Declaration
Swift
public var storagePath: String
-
initis used for the configuration of the data synchronization, to specifiy the RESTful service address with the network service, optional filtering, sorting, and caching.Declaration
Swift
public init(_ service: Service<N>, filterStrategy: FilterStrategy<Element, F>, sortStrategy: SortStrategy<Element, S>, caching: Bool = false)
-
The wrappedValue is the observed data structure and represents the connected data. This data will be synchronized with the RESTful service.
Declaration
Swift
public var wrappedValue: [Element] { get set }
-
In the case that filtering is not needed, the generic
Filterabletype will be inferred asNeverDeclaration
Swift
public convenience init(_ endpoint: Service<N>, sortStrategy: SortStrategy<Element, S>, caching: Bool = false)
-
In the case that sorting is not needed, the generic
Sortabletype will be inferred asNeverDeclaration
Swift
public convenience init(_ endpoint: Service<N>, filterStrategy: FilterStrategy<Element, F>, caching: Bool = false)
-
In the case that filtering and sorting is not needed, the generic
FilterableandSortabletypes will be both inferred asNeverDeclaration
Swift
public convenience init(_ endpoint: Service<N>, caching: Bool = false)
View on GitHub
REST Class Reference