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

Niko/IOS docs to new template #551

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

nikomancy
Copy link
Contributor

@nikomancy nikomancy commented Dec 16, 2024

Split iOS SDK Documentation into Multiple Pages

Changes Made

Restructured single iOS.md file into multiple focused pages:

  • intro.mdx: High-level overview and quick links
  • quickstart.mdx: Getting started guide
  • initialization.mdx: Detailed initialization options
  • assignments.mdx: Comprehensive assignment types and patterns

Why?

  • The goal is to make the learning journey for engineers working with specific SDKs easier.
  • Content is easier to find in the TOC improving navigability.
  • Code samples for typed examples have been added for ease of use.
  • Boilerplate prose docs have been added to allow engineers to learn about relevant conceptual information along side the code without having to context switch to other parts of the docs.

Review instructions

  • Additional typed assignment instructions have been inferred from the existing code samples and the parameters in the javascript docs. Please make sure those are correct.

Before merge

  • Update redirects
  • Remove ios.md

Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for eppo-data-docs ready!

Name Link
🔨 Latest commit bacad21
🔍 Latest deploy log https://app.netlify.com/sites/eppo-data-docs/deploys/675f83780de087000831ef1d
😎 Deploy Preview https://deploy-preview-551--eppo-data-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nikomancy nikomancy changed the title Adding iOS docs. IOS docs to new template Dec 16, 2024
@nikomancy nikomancy changed the title IOS docs to new template Niko/IOS docs to new template Dec 16, 2024
Copy link
Member

@leoromanovsky leoromanovsky left a comment

Choose a reason for hiding this comment

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

Overall lgtm; code samples compile. Please give me a ping when addressed the few ❌ and I'll take another read. Thank you!


1. Choose `Package Dependencies`
2. Click `+` and enter package URL: `[email protected]:Eppo-exp/eppo-ios-sdk.git`
3. Set dependency rule to `Up to Next Minor Version` and select `Add Package`
Copy link
Member

Choose a reason for hiding this comment

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

great call out - this is important for customers to be able to get the latest patches

}
```

[Continue with the rest of the quickstart content...]
Copy link
Member

Choose a reason for hiding this comment

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

?

@@ -0,0 +1,60 @@
---
title: Quickstart
Copy link
Member

Choose a reason for hiding this comment

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

lgtm ✔️

Comment on lines +82 to +90
Task {
try await EppoClient.initialize(
sdkKey: "SDK-KEY-FROM-DASHBOARD",
initialConfiguration: try Configuration(
flagsConfigurationJson: Data(#"{ "pre-loaded-JSON": "passed in here" }"#.utf8),
obfuscated: false
)
);
}
Copy link
Member

Choose a reason for hiding this comment

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

verified in xcode

If you'd like to initialize Eppo's client without performing a network request, you can use the `initializeOffline` method:

```swift
try EppoClient.initializeOffline(
Copy link
Member

Choose a reason for hiding this comment

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

verified in xcode

<ApiOptionRef
name="timestamp"
type="string"
defaultValue="undefined"
Copy link
Member

Choose a reason for hiding this comment

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


## How Assignments Work

The SDK periodically retrieves configuration rules from the Eppo server that define how subjects should be allocated to variants. When you call an assignment function, the SDK evaluates these rules locally without making additional network requests.
Copy link
Member

@leoromanovsky leoromanovsky Dec 20, 2024

Choose a reason for hiding this comment

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

❌ No polling in Swift - configuration loaded once on session start and whenever user calls load()

Comment on lines +46 to +52
if assignment == "version-a" {
showVersionA()
} else if assignment == "version-b" {
showVersionB()
} else {
showControl()
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if assignment == "version-a" {
showVersionA()
} else if assignment == "version-b" {
showVersionB()
} else {
showControl()
}
switch assignment {
case "version-a":
showVersionA()
case "version-b":
showVersionB()
default:
showControl()
}

totally correct as-is just a suggestion

Comment on lines +101 to +123
let defaultConfig = """
{
"color": "#FF0000",
"fontSize": 14,
"fontFamily": "Roboto"
}
"""

let config = try eppoClient.getJSONStringAssignment(
flagKey: "ui-config",
subjectKey: user.id,
subjectAttributes: user.attributes,
defaultValue: defaultConfig
)

// Parse and use the configuration
if let jsonData = config.data(using: .utf8),
let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any] {
let color = json["color"] as? String
let fontSize = json["fontSize"] as? Int
let fontFamily = json["fontFamily"] as? String
}
```
Copy link
Member

Choose a reason for hiding this comment

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

verified in xcode

Comment on lines +204 to +217
## Debugging Assignments

You may encounter situations where a flag assignment produces unexpected values. The SDK provides debugging functions to help understand how assignments are being made:

```swift
let debugInfo = try eppoClient.getAssignmentDebugInfo(
flagKey: flagKey,
subjectKey: subjectKey,
subjectAttributes: subjectAttributes
)

// Log debug information
print("Assignment debug info: \(debugInfo)")
```
Copy link
Member

Choose a reason for hiding this comment

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

❌ this API does not current exist in swift

1. Choose `Package Dependencies`
2. Click `+` and enter package URL: `[email protected]:Eppo-exp/eppo-ios-sdk.git`
3. Set dependency rule to `Up to Next Minor Version` and select `Add Package`
4. Add to your project's target.
Copy link
Member

Choose a reason for hiding this comment

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

Somewhere in the code examples please show how to import the package:

import EppoFlagging

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