You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Give the opportunity to alter the default value of a Flag.
Sometimes you may need to alter the default value specified inside the property wrapper signature. This happens if you want to define a single collection file used in several targets of your project where one or more flags have different default values.
In this case you can avoid to replicate the same collection blueprint but just change the default value.
A new call setDefaultValue() is therefore provided to allows this change.
Q
A
New Feature
yes
BC Break
no
The text was updated successfully, but these errors were encountered:
Sometimes you may want to alter the default value of a Flag set via the annotation default parameters.
This is true when, for example, you have different target of your product with different values for some flag and you would avoid creating duplicate files for each Flags Collection blue print.
In this case you can define your own FlagsCollections and use the setDefaultValue() on each different flag to setup your own value.
Consider this example:
structFlags:FlagCollectionProtocol{@FlagCollection(default:100, description:"...")varflagA:Int@Flag(default: false, description:"...")varflagB:Bool}publicfunc setupFlagsByTarget {self.loader =FlagsLoader(Flags.self, provider:[...])#if TARGET_A// Target A only differ for a 200 default value for flagA
loader.$flagA.setDefault(200)#endif#if TARGET_B// Target B only differ in flagB which is false by default
loader.$flagB.setDefault(false)#endif#if TARGET_C// Target C has the same false for flagB but a different value for flagA
loader.$flagA.setDefault(50)#endif}
Feature Request
Give the opportunity to alter the default value of a
Flag
.Sometimes you may need to alter the default value specified inside the property wrapper signature. This happens if you want to define a single collection file used in several targets of your project where one or more flags have different default values.
In this case you can avoid to replicate the same collection blueprint but just change the default value.
A new call
setDefaultValue()
is therefore provided to allows this change.The text was updated successfully, but these errors were encountered: