Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import SwiftUI
import UIKit
import LaunchDarkly
import Plugin
import LaunchDarklyObservability

//let mobileKey = "mob-dbe6f0ac-80ce-4903-bf20-431c2e7aeae1"
let mobileKey = "mob-48fd3788-eab7-4b72-b607-e41712049dbd"
let config = { () -> LDConfig in
var config = LDConfig(
mobileKey: mobileKey,
autoEnvAttributes: .enabled
)
config.plugins = [
Observability()
Observability(options: .init(sessionBackgroundTimeout: 3))
]
return config
}()
Expand Down Expand Up @@ -51,15 +50,3 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
return true
}
}

@main
struct ObservabilityiOSTestAppApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate

var body: some Scene {
WindowGroup {
// ContentView()
HomeView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
27 changes: 27 additions & 0 deletions ExampleApp/ExampleApp/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// ContentView.swift
// ExampleApp
//
// Created by Mario Canto on 04/09/25.
//

import SwiftUI

struct ContentView: View {
var body: some View {
VStack(spacing: 32) {
Button {
fatalError()
} label: {
Text("Crash")
}
NetworkRequestView()
FeatureFlagView()
}
.padding()
}
}

#Preview {
ContentView()
}
12 changes: 12 additions & 0 deletions ExampleApp/ExampleApp/ExampleAppApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import SwiftUI

@main
struct ExampleAppApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate

var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import SwiftUI
import LaunchDarkly
import LaunchDarklyObservability

private let featureFlag = "new-home-experience"
struct HomeView: View {
struct FeatureFlagView: View {
private let featureFlag = "new-home-experience"
@State private var isNewExperience = Optional<Bool>.none

var body: some View {
NavigationStack {
if isNewExperience == true {
HomeNewView()
} else if isNewExperience == false {
HomeOldView()
Group {
if let isNewExperience {
Text("Feature flag is: \(isNewExperience)")
} else {
Text("Default Home View")
Text("Feature flag is nil...")
}
}
.font(.title)
.bold()
.onAppear {
isNewExperience = LDClient.get()?.boolVariation(
forKey: featureFlag,
defaultValue: false
)
}
}

}
24 changes: 24 additions & 0 deletions ExampleApp/ExampleApp/NetworkRequestView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import SwiftUI

struct NetworkRequestView: View {
@State private var loading = false
var body: some View {
Group {
if loading {
ProgressView {
Text("Loading content that will be instrumented")
}
} else {
Text("Check the LaunchDarkly dashboard for instrumentation")
}
}
.task {
guard let url = URL(string: "https://jsonplaceholder.typicode.com/todos/1") else { return }
do {
let (_, _) = try await URLSession.shared.data(from: url)
} catch {

}
}
}
Copy link

Choose a reason for hiding this comment

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

Bug: Loading Indicator Fails to Display

The loading state isn't updated during the network request, preventing the loading indicator from ever displaying. Users will always see the static text instead of the intended loading experience.

Fix in Cursor Fix in Web

}

This file was deleted.

Loading