- Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-9419]: feat: Swift async-await support added #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! A few suggestions.
Tests/OptimizelyTests-APIs/OptimizelyClientTests_Init_Async_Await.swift Outdated Show resolved Hide resolved
Tests/OptimizelyTests-APIs/OptimizelyClientTests_Init_Async_Await.swift Outdated Show resolved Hide resolved
Tests/OptimizelyTests-APIs/OptimizelyClientTests_Init_Async_Await.swift Outdated Show resolved Hide resolved
…ait.swift Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. We can remove all async versions of internal functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few small changes suggested.
DemoSwiftApp/AppDelegate.swift Outdated
// // For sample codes for APIs, see "Samples/SamplesForAPI.swift" | ||
// //SamplesForAPI.checkOptimizelyConfig(optimizely: self.optimizely) | ||
// //SamplesForAPI.checkOptimizelyUserContext(optimizely: self.optimizely) | ||
// //SamplesForAPI.checkAudienceSegments(optimizely: self.optimizely) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep these lines? We use this for testing sample codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will revert back.
| ||
guard let localDatafileUrl = Bundle.main.url(forResource: "demoTestDatafile", withExtension: "json"), | ||
let localDatafile = try? Data(contentsOf: localDatafileUrl) | ||
let localDatafile = try? Data(contentsOf: localDatafileUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - extra spaces. swift lint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see any lint warning.
| ||
if #available(iOS 13, *) { | ||
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) { | ||
Task { [user] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this explicit capturing [user] here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah, as we declare user as local variable inside the static method, that's why we needed to capture it. Otherwise, the compiler throws errors. Normally we don't need to capture it, as we did in appdelegate.
optimizely = OptimizelyClient(sdkKey: "<Your_SDK_Key>", | ||
periodicDownloadInterval: 60) | ||
if #available(iOS 13, *) { | ||
Task { [optimizely] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this explicit capturing [optimizely] here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed above
Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Swift async-await support added for:
Test plan
Issues