firebase-ios-sdk
firebase-ios-sdk copied to clipboard
[Feature Proposal]Property Wrapper for RemoteConfig
Why
#9828
What
This PR provides a Property Wrapper with DynamicProperty for RemoteConfig. With this feature, users can bind Remote Config values to variables, and at the same time, reflect them in the View of the SwiftUI in real time.
Known Issues
- The
lastFetchTimeis monitored to detect that the RemoteConfig value has changed. This is not very accurate. For example, if thedefaultValueis changed, the change will not be detected. - Only
Decodableproperties are covered. Therefore, users cannot bind the PropertyWrapper to variables of type Any, such as those provided byjsonValue.
Thanks @fumito-ito! Please resolve the CI issues.
CI back to green 🙌
Thanks! We need to do an internal API review process so it may take us a few weeks to a month to merge, but I expect it to happen.
@fumito-ito Thank you for this initiative! I'm looking into the API review right now. Do you have a sample test app or some sample code that I can see how to use this new API to reflect config changes on SwiftUI?
Hi! @chliangGoogle thank you for your feedback. The simplest sample is like https://github.com/firebase/firebase-ios-sdk/discussions/9828.
@RemoteConfig(forKey: "is_new_feature_available")
var isNewFeatureAvailable: Bool
Toggle(isOn: isNewFeatureAvailable) {
Text("wonderful new feature")
}
If you need more sample app, I can upload it into the repository but I cannot find where to put sample apps for remote config. Could you tell me place for sample app ?
@fumito-ito The sample code is exactly what I need. No need to make a sample app for this. Thanks!
Hey @fumito-ito I'm working on Google Open Source Peer Bonus nominations and would like to recognize your contribution to make Firebase Remote Config more SwiftUI friendly. I couldn't find an email address for you, so if you're interested, please email it to chliang at google.com and I'll make the nomination.
Going to close since this PR was incorporated into #10155.
Thanks @fumito-ito for getting this going!