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

fix: iOS swift code snippets have double quotes #7415

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contents/docs/experiments/adding-experiment-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if (PostHog.getFeatureFlag("experiment-feature-flag-key") == "variant-name") {

```ios
// In Swift
if (posthog.getFeatureFlag('experiment-feature-flag-key') == 'variant-name') {
if (posthog.getFeatureFlag("experiment-feature-flag-key") as? String == "variant-name") {
// do something
}
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
### Boolean feature flags

```swift
if (posthog.isFeatureEnabled('flag-key')) {
if (posthog.isFeatureEnabled("flag-key")) {
// Do something differently for this user
}
```

### Multivariate feature flags

```swift
if (posthog.getFeatureFlag('my-flag') == "variant-key") { // replace 'variant-key' with the key of your variant
if (posthog.getFeatureFlag("my-flag") as? String == "variant-key") { // replace "variant-key" with the key of your variant
// do something
}
```
Expand Down
4 changes: 2 additions & 2 deletions contents/docs/libraries/ios/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ You can also manually flush the queue:
```

```swift
posthog.capture('logged_out')
posthog.capture("logged_out")
posthog.flush()
```

Expand Down Expand Up @@ -154,7 +154,7 @@ if ([[PHGPosthog sharedPostHog] getFeatureFlag:@"experiment-feature-flag-key"] =
```

```swift
if (posthog.getFeatureFlag('experiment-feature-flag-key') == 'variant-name') {
if (posthog.getFeatureFlag("experiment-feature-flag-key") as? String == "variant-name") {
// do something
}
```
Expand Down
4 changes: 2 additions & 2 deletions contents/product-engineers/ab-testing-guide-for-engineers.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ It's absolutely **essential** to only log the users in your test who would actua

To do so, ensure that checking your feature flag and logging their exposure is the *absolute* last condition you check in your code:

```
```js
// ❌ Incorrect. Will include unaffected users
function showNewChanges(user) {
if (posthog.getFeatureFlag('experiment-key') === 'control') {
Expand All @@ -133,7 +133,7 @@ function showNewChanges(user) {
}
```

```
```js
// ✅ Correct. Will exclude unaffected users
function showNewChanges(user) {

Expand Down
Loading