-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
27 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,23 +4,27 @@ import ConfigCat | |
class ViewController: UIViewController { | ||
|
||
var client: ConfigCatClient? | ||
var user: ConfigCatUser? | ||
@IBOutlet weak var label: UILabel! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
let options = ClientOptions.default | ||
|
||
let mode = PollingModes.autoPoll(autoPollIntervalInSeconds: 5) { | ||
options.refreshMode = PollingModes.autoPoll(autoPollIntervalInSeconds: 5) | ||
options.hooks.addOnConfigChanged { _ in | ||
self.configChanged() | ||
} | ||
|
||
// Info level logging helps to inspect the feature flag evaluation process. | ||
// Remove this line to avoid too detailed logging in your application. | ||
options.logLevel = .info | ||
|
||
// Creating a user object to identify your user (optional). | ||
self.user = ConfigCatUser(identifier: "user-id", email: "[email protected]") | ||
options.defaultUser = ConfigCatUser(identifier: "user-id", email: "[email protected]") | ||
|
||
self.client = ConfigCatClient( | ||
self.client = ConfigCatClient.get( | ||
sdkKey: "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A", | ||
refreshMode: mode, | ||
logLevel: .info // Info level logging helps to inspect the feature flag evaluation process. Remove this line to avoid too detailed logging in your application. | ||
options: options | ||
) | ||
} | ||
|
||
|
@@ -30,7 +34,7 @@ class ViewController: UIViewController { | |
} | ||
|
||
func configChanged() { | ||
self.client?.getValue(for: "string25Cat25Dog25Falcon25Horse", defaultValue: "", user: self.user) { value in | ||
self.client?.getValue(for: "string25Cat25Dog25Falcon25Horse", defaultValue: "") { value in | ||
DispatchQueue.main.sync { | ||
self.label.text = value | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,16 @@ | |
|
||
int main(int argc, const char * argv[]) { | ||
@autoreleasepool { | ||
// Initialize the ConfigCatClient with an SDK Key. | ||
ClientOptions* options = [ClientOptions default]; | ||
|
||
// Info level logging helps to inspect the feature flag evaluation process. | ||
// Use the default Warning level to avoid too detailed logging in your application. | ||
ConfigCatClient* client = [[ConfigCatClient alloc]initWithSdkKey:@"PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb30i9wi17GQ" | ||
dataGovernance:DataGovernanceGlobal | ||
configCache:nil | ||
refreshMode:nil | ||
sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] | ||
baseUrl:@"" | ||
flagOverrides:nil | ||
logLevel:LogLevelInfo]; | ||
|
||
options.logLevel = LogLevelInfo; | ||
|
||
// Initialize the ConfigCatClient with an SDK Key. | ||
ConfigCatClient* client = [ConfigCatClient getWithSdkKey:@"PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb30i9wi17GQ" | ||
options:options]; | ||
|
||
// Creating a user object to identify your user (optional). | ||
ConfigCatUser* userObject = [[ConfigCatUser alloc]initWithIdentifier:@"Some UserID" | ||
email:@"[email protected]" | ||
|