Skip to content

Commit

Permalink
ios: lower example app iOS target to iOS 14 (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustyniak authored Nov 7, 2024
1 parent 478eaa2 commit 223ff52
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
4 changes: 2 additions & 2 deletions examples/swift/hello_world/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ios_application(
"ipad",
],
infoplists = ["Info.plist"],
minimum_os_version = "16.0",
minimum_os_version = "14.0",
provisioning_profile = select({
"//bazel:ios_device_build": "//bazel/ios:ios_provisioning_profile",
"//conditions:default": None,
Expand Down Expand Up @@ -71,7 +71,7 @@ ios_application(
"ipad",
],
infoplists = ["Info.plist"],
minimum_os_version = "16.0",
minimum_os_version = "14.0",
provisioning_profile = select({
"//bazel:ios_device_build": "//bazel/ios:ios_provisioning_profile",
"//conditions:default": None,
Expand Down
17 changes: 10 additions & 7 deletions examples/swift/hello_world/ConfigurationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ struct ConfigurationView: View {
@StateObject var configuration = Configuration()

var body: some View {
Text("API URL").frame(maxWidth: .infinity)
TextField(text: $configuration.apiURL) { Text("Enter API URL") }
.autocapitalization(.none)

Text("API Key").frame(maxWidth: .infinity)
TextField(text: $configuration.apiKey, axis: .vertical) { Text("Enter API Key") }
.autocapitalization(.none)
Form {
Section(header: Text("API URL")) {
TextField("Enter API URL", text: $configuration.apiURL)
.autocapitalization(.none)
}
Section(header: Text("API Key")) {
TextField("Enter API Key", text: $configuration.apiKey)
.autocapitalization(.none)
}
}

Spacer()

Expand Down
6 changes: 3 additions & 3 deletions platform/swift/source/Capture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension Logger {
/// `start(...)` method has not been called or if starting the logger process failed due to an internal
/// error.
public static var shared: Logging? {
self.getShared(assert: false)
self.getShared()
}

/// Initializes the Capture SDK with the specified API key, providers, and configuration.
Expand Down Expand Up @@ -110,7 +110,7 @@ extension Logger {
/// The value of this property is different for apps from the same vendor running on
/// the same device. It is equal to `nil` prior to the start of bitdrift Capture SDK.
public static var deviceID: String? {
return Self.getShared(assert: false)?.deviceID
return Self.getShared()?.deviceID
}

// MARK: - Logging
Expand Down Expand Up @@ -351,7 +351,7 @@ extension Logger {
function: String? = #function,
fields: Fields? = nil
) -> Span? {
Self.getShared(assert: false)?.startSpan(
Self.getShared()?.startSpan(
name: name, level: level, file: file, line: line, function: function, fields: fields
)
}
Expand Down
18 changes: 3 additions & 15 deletions platform/swift/source/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,23 +288,11 @@ public final class Logger {

/// Retrieves a shared instance of logger if one has been started.
///
/// - parameter assert: Whether the method should assert if shared logger has not been started.
///
/// - returns: The shared instance of logger.
static func getShared(assert: Bool = true) -> Logging? {
static func getShared() -> Logging? {
return switch Self.syncedShared.load() {
case .notStarted: {
if assert {
assertionFailure(
"""
Default logger is not set up! Did you attempt to log with the default logger without \
calling `start(withAPIKey:)` first?
"""
)
}

return nil
}()
case .notStarted:
nil
case .started(let integrator):
integrator.logger
case .startFailure:
Expand Down

0 comments on commit 223ff52

Please sign in to comment.