Check demo code at Github:
https://github.com/Sylvia-YiyinShen/FeatureToggleDemo
1. New File in Xcode, choose Settings.bundle.
The Settings.bundle will be created and automatically added to Build Phases
2. Modify Root.plist inside Settings.bundle
There will be several preference items automatically generated by default and visible through Settings.
Check Apple's docs to see all the control type:
3. Next we need a manager to grab the preference item value from Settings.
Each preference item value is stored in UserDefault, we can always get the updated value via the key which is Identifier in Root.plist
Now we can just check enableUpdateLabel bool value for different implementation.
Try go to settings and toggle the Enable Update Label option. Then kill the app and re-run.
No comments:
Post a Comment