TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by Thorsten Stark, Cornelius Horstmann, Pascal Stüdlein.
RemoteSettings is a framework that helps you to fetch remote data and to store them into a specific data structure.
Experimental: We also offer a Playground as documentation, check it out :). And make sure "Show Rendered Markdown" is active.
Let's assume we want to use the GitHub API to fetch information about the RemoteSettings project. More specific we want to store the url of the RemoteSettings repository for later usage.
let apiUrl = URL(string:"https://api.github.com/repos/tbointeractive/remotesettings")!
open func update(_ data: Data) throws
and process the fetched dataSubclassOfRemoteSettings(remote: apiUrl)
public func update(finished: Completion?)
PseudoCode:
final class GitHubRemoteSettings: RemoteSettings {
var repoUrl: URL?
open override func update(_ data: Data) throws {
self.repoUrl = // parse data (in this case this is some json), extract the repoUrl and store in member variable
}
}
let remoteSettings = GitHubRemoteSettings(remote: apiUrl)
remoteSettings.update() { error in
// error handling
}
// after an update your designated data is stored to repoUrl
remoteSettings.repoUrl
JSONRemoteSettings is handy if you need to handle with JSON data, like we had to do in our previous section.
open func update(_ data: [AnyHashable: Any]) throws
and open func update(_ data: [Any]) throws
update(_ data: [AnyHashable: Any])
or update(_ data: [Any])
is called.SubclassOfJSONRemoteSettings(remote: apiUrl)
public func update(finished: Completion?)
TBD
TBD
TBD