Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

divinenaman
Copy link

@divinenaman divinenaman commented Jul 21, 2024

Feat: add swift client for cac and experimentation

  • implement cac client
  • implement exp client
  • add nix setup + document
  • add examples
  • add xcode project

@divinenaman divinenaman marked this pull request as ready for review July 23, 2024 00:03
@divinenaman divinenaman requested a review from a team as a code owner July 23, 2024 00:03
clients/swift/cac/main.swift Outdated Show resolved Hide resolved
clients/swift/cac/main.swift Outdated Show resolved Hide resolved
clients/swift/cac/main.swift Outdated Show resolved Hide resolved
func main() {
let t = "test"
let f : UInt = 300
let h = "http://localhost:8080"
Copy link
Collaborator

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

Copy link
Author

@divinenaman divinenaman Jul 27, 2024

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 Show resolved Hide resolved
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) }
Copy link
Collaborator

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Datron Datron force-pushed the main branch 11 times, most recently from 02832c3 to a9afdb9 Compare September 9, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants