-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Client] add swift client #178
base: main
Are you sure you want to change the base?
Conversation
func main() { | ||
let t = "test" | ||
let f : UInt = 300 | ||
let h = "http://localhost:8080" |
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.
Change the port to say 9090
or something else, since superposition will by default in dev env runs on 8080
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.
@ShubhranshuSanjeev needed to point to superposition server only, these are basic test
clients/swift/exp/main.swift
Outdated
func getApplicableVariant(client: UnknownClientPointer, context: String, toss: Int16) -> Value? { | ||
return context.withCString { c -> Value? in | ||
let rawData = expt_get_applicable_variant(client, c, toss) | ||
return rawData.map { String(cString: $0) }.flatMap { parseJson(jsonString: $0) } |
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.
What's the use of flatMap
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.
to not box the optional value second time,
https://forums.swift.org/t/optional-map-vs-flatmap-why-not-always-use-flatmap/46892/2
02832c3
to
a9afdb9
Compare
Feat: add
swift
client for cac and experimentation