Skip to content

Commit f8f2311

Browse files
authored
Work around @_exported-public import bug (#477)
We've relied on fine-grained GRDB exports via, e.g.: ```swift @_exported import class GRDB.Database ``` But it turns out this breaks as soon as you have an explicit `public import` in the same module: ```swift public import class GRDB.Database ``` To work around this bug, we can use `#if` blocks to make each mutually exclusive.
1 parent 98fa1de commit f8f2311

20 files changed

Lines changed: 106 additions & 78 deletions

Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/Reminders/RemindersApp.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct RemindersApp: App {
3434
isPresented: $syncEngineDelegate.isDeleteLocalDataAlertPresented
3535
) {
3636
Button("Reset", role: .destructive) {
37-
Task {
37+
_ = Task {
3838
try await syncEngine.deleteLocalData()
3939
}
4040
}
@@ -100,7 +100,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
100100
_ windowScene: UIWindowScene,
101101
userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata
102102
) {
103-
Task {
103+
_ = Task {
104104
try await syncEngine.acceptShare(metadata: cloudKitShareMetadata)
105105
}
106106
}
@@ -114,7 +114,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
114114
else {
115115
return
116116
}
117-
Task {
117+
_ = Task {
118118
try await syncEngine.acceptShare(metadata: cloudKitShareMetadata)
119119
}
120120
}

Examples/Reminders/RemindersDetail.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class RemindersDetailModel: HashableObject {
8888
}
8989
}
9090

91-
private var remindersQuery: some StructuredQueriesCore.Statement<Row> {
91+
private var remindersQuery: some Statement<Row> & Sendable {
9292
Reminder
9393
.where {
9494
if !showCompleted {

Examples/Reminders/Schema.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ nonisolated func handleReminderStatusUpdate() {
390390

391391
@DatabaseFunction
392392
nonisolated func createDefaultRemindersList() {
393-
Task {
393+
_ = Task {
394394
@Dependency(\.defaultDatabase) var database
395395
try await database.write { db in
396396
try RemindersList.insert {

Examples/Reminders/SearchReminders.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import GRDB
21
import IssueReporting
32
import SQLiteData
43
import SwiftUI
@@ -227,7 +226,7 @@ struct SearchRemindersView: View {
227226
}
228227
Spacer()
229228
Button(model.showCompletedInSearchResults ? "Hide" : "Show") {
230-
Task { try await model.showCompletedButtonTapped() }
229+
_ = Task { try await model.showCompletedButtonTapped() }
231230
}
232231
}
233232
}

Examples/Reminders/TagsForm.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import GRDB
21
import SQLiteData
32
import SwiftUI
43
import SwiftUINavigation

Package.resolved

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SQLiteData/CloudKit/CloudKitSharing.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#if canImport(CloudKit)
22
public import CloudKit
3-
public import Dependencies
3+
import ConcurrencyExtras
44
import GRDB
5-
public import SwiftUI
5+
import IssueReporting
66
public import StructuredQueries
77

8-
#if canImport(UIKit)
8+
#if canImport(SwiftUI) && canImport(UIKit) && !os(tvOS) && !os(watchOS)
9+
public import Dependencies
10+
public import SwiftUI
911
public import UIKit
1012
#endif
1113

@@ -255,7 +257,7 @@
255257
}
256258
}
257259

258-
#if canImport(UIKit) && !os(tvOS) && !os(watchOS)
260+
#if canImport(SwiftUI) && canImport(UIKit) && !os(tvOS) && !os(watchOS)
259261
/// A view that presents standard screens for adding and removing people from a CloudKit share \
260262
/// record.
261263
///
@@ -348,7 +350,7 @@
348350
}
349351

350352
Button("Stop Sharing", role: .destructive) {
351-
Task {
353+
_ = Task {
352354
try await syncEngine.unshare(share: sharedRecord.share)
353355
try await syncEngine.fetchChanges()
354356
dismiss()

0 commit comments

Comments
 (0)