Skip to content

Commit 8dcb0f1

Browse files
code cleanup
1 parent b668f4c commit 8dcb0f1

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

Sources/PowerSync/attachments/AttachmentService.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ actor AttachmentServiceImpl: AttachmentServiceProtocol {
6464
}
6565

6666
public func withContext<R: Sendable>(
67-
callback: @Sendable @escaping (AttachmentContext
68-
) async throws -> R) async throws -> R
69-
{
67+
callback: @Sendable @escaping (AttachmentContext) async throws -> R
68+
) async throws -> R {
7069
try await callback(context)
7170
}
7271
}

Tests/PowerSyncTests/AttachmentTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ final class AttachmentTests: XCTestCase {
5959
return MockRemoteStorage()
6060
}(),
6161
attachmentsDirectory: getAttachmentDirectory(),
62-
watchAttachments: { [database] in
63-
try database!.watch(options: WatchOptions(
62+
watchAttachments: { [database = database!] in
63+
try database.watch(options: WatchOptions(
6464
sql: "SELECT photo_id FROM users WHERE photo_id IS NOT NULL",
6565
mapper: { cursor in try WatchedAttachmentItem(
6666
id: cursor.getString(name: "photo_id"),
@@ -81,7 +81,7 @@ final class AttachmentTests: XCTestCase {
8181
)
8282

8383
let attachmentRecord = try await waitForMatch(
84-
iteratorGenerator: { [database] in try database!.watch(
84+
iteratorGenerator: { [database = database!] in try database.watch(
8585
options: WatchOptions(
8686
sql: "SELECT * FROM attachments",
8787
mapper: { cursor in try Attachment.fromCursor(cursor) }
@@ -132,7 +132,7 @@ final class AttachmentTests: XCTestCase {
132132
db: database,
133133
remoteStorage: mockedRemote,
134134
attachmentsDirectory: getAttachmentDirectory(),
135-
watchAttachments: { [database] in try database!.watch(options: WatchOptions(
135+
watchAttachments: { [database = database!] in try database.watch(options: WatchOptions(
136136
sql: "SELECT photo_id FROM users WHERE photo_id IS NOT NULL",
137137
mapper: { cursor in try WatchedAttachmentItem(
138138
id: cursor.getString(name: "photo_id"),
@@ -155,8 +155,8 @@ final class AttachmentTests: XCTestCase {
155155
}
156156

157157
_ = try await waitForMatch(
158-
iteratorGenerator: { [database] in
159-
try database!.watch(
158+
iteratorGenerator: { [database = database!] in
159+
try database.watch(
160160
options: WatchOptions(
161161
sql: "SELECT * FROM attachments",
162162
mapper: { cursor in try Attachment.fromCursor(cursor) }

0 commit comments

Comments
 (0)