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

ios: lower example app iOS target to iOS 14 #106

Merged
merged 2 commits into from
Nov 7, 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
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 @@ -285,23 +285,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
Loading