immobiliare / realflags Goto Github PK
View Code? Open in Web Editor NEW๐ง Feature Flagging for Swift
License: MIT License
๐ง Feature Flagging for Swift
License: MIT License
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 |
Allows reset of values inside a collection both via call and inside the browser of flags.
This feature should be also implemented to reset a single flag.
The scope is to reset any writable provider (ie. for LocalProvider it will remove the dictionary serialized file) and so on.
Q | A |
---|---|
New Feature | yes |
BC Break | no |
Ive added a fork to support firebase 10.0. This was needed to resolve captcha issues with the simulator and firebase auth captcha
https://github.com/tr736-reclip/RealFlags
No response
At this time all the optional data is showed using Optional(Value)
string inside the browser. This is just the debug description form coming from the Swift runtime. We should optimize it by showing the data if available eventually with a small icon to inform about the optional nature.
Q | A |
---|---|
New Feature | yes |
We should be able to search for a feature flag inside the flags browser controller. It could be useful when you have lots of different feature flags inside a collection.
Q | A |
---|---|
New Feature | no |
BC Break | /no |
iOS 16
3.5
Xcode 14.3
Race condition, just try to call getValueForFlag right after instantiating
The entire app should not crash. Probably better not to use ! at all
The app crashes occasionally. I put the getValueForFlag in a Task so it gets delayed, which seems to help.
While it's more complete, especially for debug purpose, the flags browser interface is far from being simple.
Especially if you want to expose it to your non-tech managers the resulting experience is really poor.
We'll work on the following issues:
FlagsCollection
type).LocalProvider
).Q | A |
---|---|
New Feature | yes |
BC Break | no |
The following screenshots describe the expected result:
https://www.offnotes.org/feature-flags/, in the README just 404s
Q | A |
---|---|
New Feature | yes |
RFC | no |
BC Break | no |
First of all, thank you for the great library. It looks modern and easy to use.
I'd suggest to add a simple demo app into this library, so that other can easily start play around with the library immediately without initial setup.
By calling flagValue(from:fallback)
function from any FlagLoader
concrete implementation value obtained ignores the fallback
parameter which means "return the default
value if nothing found on any provider".
Fallback is always returned when loader's reference is not available, while in case everything is setup correctly and no values were found the returned value is nil
instead of defaultValue
.
Q | A |
---|---|
New Feature | no |
BC Break | yes |
Q | A |
---|---|
BC Break | no |
Version | 1.3.1 |
I'm setting providers: [FeatureFlagLocalProvider(), FirebaseRemoteProvider()]
. for this property
default: True
localProvider: True
firebase: False
The flag resolves as false, somehow deciding to choose firebase over the localProvider
unsure, it seems like it should just work if you do [localProvider, firebaseProvider]
the flag should resolve as True, respecting the local provider over the firebase provider
Sometimes you may need to define a feature flag where the value is computed dynamically.
For example suppose you have a feature flag called hasPublishButton
: it should return true only when the app's language is set to it
.
Q | A |
---|---|
New Feature | yes |
RFC | yes/no |
BC Break | yes |
In order to provide support for this feature request we have implemented computedValue
in @Flag
property; it defines a function which is called before asking for value to any provider or return the default fallback value.
If the function return a non nil
value the value is returned and no further check are made.
If you return a nil
value the flow still the same; flag value are asked to the ordered list of providers (following the optional exclusion schema) and eventually by returning the default local value set.
This is an example:
public struct MiscFlags: FlagCollectionProtocol {
// MARK: - Flags
@Flag(default: false, computedValue: MiscFlags.computedPublishButton, description: "")
var hasPublishButton: Bool
// MARK: - Computed Properties Functions
public init() { }
private static func computedPublishButton() -> Bool? {
Language.main.code == "it"
}
}
As you can see we have defined a private static
function computedPublishButton()
in order to avoid making the @Flag
annotation full of bloat code; this because generally this kind of check still short but sometimes it may be more complex.
http://optimizely.com as Firebase Remote Config allows you to configure A/B test and feature flags. It should be a great new data provider to add.
Q | A |
---|---|
New Feature | yes |
RFC | no |
BC Break | no |
FirebaseRemoteProvider
's wrappedTypeFromOptionalType()
function does not work correctly with non optional type and fails returning nil
values even for available flags. This causes wrong behaviour by querying remote provider for set values.
Fix includes fallback value for wrappedTypeFromOptionalType
which allows us to return the unwrapped value correctly:
public func wrappedTypeFromOptionalType(_ type: Any.Type) -> Any.Type? {
(type as? OptionalProtocol.Type)?.wrappedType ?? type
}
LocalProvider
class fails to throw errors when saving internal flags dictionary inside a local file making the error catching really difficult.
Q | A |
---|---|
BC Break | yes |
Version | 1.1.0 |
Just allocate a new LocalProvider
pointing to an URL
of a directory instead of a file.
public func setValue<Value>(_ value: Value?, forFlag key: FlagKeyPath) throws -> Bool where Value: FlagProtocol
support throws but the saveToDisk()
function does not throw, instead it uses optional throw via try?
.
Just remove it to fix the issue.
Bundle is currently loaded by getting Bundle(for: Self.self)
in extension of Bundle
inside the package.
However Bundle's path is set to:
<AppName>.app/Frameworks/RealFlags.framework/RealFlags
but now the bundle is inside RealFlags.bundle
.
Using the package via CocoaPods and instantiate a new controller via the default create()
of the controller.
Allows the bundle function to search inside the package itself if generated:
extension Bundle {
private static let internalBundle = Bundle(for: FlagsBrowserController.self)
internal static var libraryBundle: Bundle {
#if SWIFT_PACKAGE
Bundle.module
#else
[
Bundle(url: internalBundle.bundleURL.appendingPathComponent("RealFlags.bundle")),
internalBundle
].lazy.compactMap({ $0 }).first ?? Bundle.main
#endif
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.