Bare-bones remote configs for iOS. Check out the basic-remote-configs project repo for more context.
🚧 Under active development 🚧
Either add it via File -> Add Package
or in your Package.swift
file:
https://github.com/BradPatras/brc-ios
The usage is pretty straightforward:
.fetchConfigs()
. (This is an async
function so you'll need to call it with await)let configUrl = URL(string: "https://github.com/BradPatras/basic-remote-configs/raw/main/examples/simple.json")!
// #1
let brc = BasicRemoteConfigs(configURL: configUrl)
// ...
try await brc.fetchConfigs() // #2
let someFlag = brc.values["someFlag"] as? Bool // #3
Configs are stored locally in the app's private storage once they've been fetched from the network. Calling .fetchConfigs()
will fetch the locally cached version of configs if either of the following are true:
If you'd like to bypass the cached version and fetch the latest configs from the network, there's an optional param available.
brc.fetchConfigs(ignoreCache: Bool)
The call to .fetchConfigs()
may make a network request and do some deserialization, so it's bound to fail at some point. It won't do any handling or masking of the exceptions so you need to wrap it in a do/catch and handle it yourself.
do {
try await brc.fetchConfigs()
} catch {
// What happens here is up to you
}
link |
Stars: 0 |
Last commit: 19 weeks ago |
Full Changelog: https://github.com/BradPatras/brc-ios/commits/0.1.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics