Skip to content

Commit 0ec3d54

Browse files
committed
Do not listen to lifecycle events on Mac Catalyst
1 parent ceed648 commit 0ec3d54

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Sources/SQLite/SQLiteDatabase.swift

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
4545
public static func makeShared(
4646
path: String,
4747
busyTimeout: TimeInterval = 5,
48-
collationSequences: [String: @Sendable (String, String) -> ComparisonResult] = [:],
49-
observeLifecycleEvents: Bool = true
48+
collationSequences: [String: @Sendable (String, String) -> ComparisonResult] = [:]
5049
) throws -> SQLiteDatabase {
5150
guard path != ":memory:" else {
5251
throw SQLiteError.SQLITE_IOERR
@@ -72,8 +71,7 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
7271
database = try SQLiteDatabase(
7372
path: url.path,
7473
busyTimeout: busyTimeout,
75-
collationSequences: collationSequences,
76-
observeLifecycleEvents: observeLifecycleEvents
74+
collationSequences: collationSequences
7775
)
7876
} catch {
7977
databaseError = error
@@ -97,8 +95,7 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
9795
public init(
9896
path: String = ":memory:",
9997
busyTimeout: TimeInterval = 5,
100-
collationSequences: [String: @Sendable (String, String) -> ComparisonResult] = [:],
101-
observeLifecycleEvents: Bool = true
98+
collationSequences: [String: @Sendable (String, String) -> ComparisonResult] = [:]
10299
) throws {
103100
database = try Self.open(
104101
at: path,
@@ -119,9 +116,7 @@ public final class SQLiteDatabase: DatabaseProtocol, @unchecked Sendable {
119116
try checkIsSQLiteVersionSupported(sqliteVersion)
120117
precondition(enforcesForeignKeyConstraints)
121118

122-
if observeLifecycleEvents {
123-
registerForAppNotifications()
124-
}
119+
registerForAppNotifications()
125120
changeNotifier.start()
126121
}
127122

@@ -547,7 +542,7 @@ public extension SQLiteDatabase {
547542

548543
// MARK: - App Notifications
549544

550-
#if canImport(UIKit)
545+
#if canImport(UIKit) && !targetEnvironment(macCatalyst)
551546

552547
import UIKit
553548

0 commit comments

Comments
 (0)