Skip to content

Commit

Permalink
Fix build on Xcode 16 (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Sep 17, 2024
1 parent 686a1d4 commit fcb464f
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 25 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file. Take a look

**Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution.

<!-- ## [Unreleased] -->
## [Unreleased]

* [#483](https://github.com/readium/swift-toolkit/issues/483) Fix build on Xcode 16.


## [2.7.2]

Expand Down
2 changes: 1 addition & 1 deletion Sources/Internal/Extensions/NSRegularExpression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public extension NSRange {
}
}

public final class ReplacingRegularExpression: NSRegularExpression {
public final class ReplacingRegularExpression: NSRegularExpression, @unchecked Sendable {
public typealias Replace = (NSTextCheckingResult, [String]) -> String

private let replace: Replace
Expand Down
12 changes: 6 additions & 6 deletions Sources/LCP/Persistence/Licenses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class Licenses {
/// Table.
let licenses = Table("Licenses")
/// Fields.
let id = Expression<String>("id")
let printsLeft = Expression<Int?>("printsLeft")
let copiesLeft = Expression<Int?>("copiesLeft")
let registered = Expression<Bool>("registered")
let id = SQLite.Expression<String>("id")
let printsLeft = SQLite.Expression<Int?>("printsLeft")
let copiesLeft = SQLite.Expression<Int?>("copiesLeft")
let registered = SQLite.Expression<Bool>("registered")

init(_ connection: Connection) {
_ = try? connection.run(licenses.create(temporary: false, ifNotExists: true) { t in
Expand All @@ -41,7 +41,7 @@ class Licenses {
return ((try? db.count(filterLicense)) ?? 0) != 0
}

private func get(_ column: Expression<Int?>, for licenseId: String) throws -> Int? {
private func get(_ column: SQLite.Expression<Int?>, for licenseId: String) throws -> Int? {
let db = Database.shared.connection
let query = licenses.select(column).filter(id == licenseId)
for row in try db.prepare(query) {
Expand All @@ -50,7 +50,7 @@ class Licenses {
return nil
}

private func set(_ column: Expression<Int?>, to value: Int, for licenseId: String) throws {
private func set(_ column: SQLite.Expression<Int?>, to value: Int, for licenseId: String) throws {
let db = Database.shared.connection
let filterLicense = licenses.filter(id == licenseId)
try db.run(filterLicense.update(column <- value))
Expand Down
8 changes: 4 additions & 4 deletions Sources/LCP/Persistence/Transactions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class Transactions: Loggable {
/// Table.
let transactions = Table("Transactions")
/// Fields.
let licenseId = Expression<String>("licenseId")
let origin = Expression<String>("origin")
let userId = Expression<String?>("userId")
let passphrase = Expression<String>("passphrase") // hashed.
let licenseId = SQLite.Expression<String>("licenseId")
let origin = SQLite.Expression<String>("origin")
let userId = SQLite.Expression<String?>("userId")
let passphrase = SQLite.Expression<String>("passphrase") // hashed.

init(_ connection: Connection) {
do {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Navigator/EPUB/EPUBSpreadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import R2Shared
import SwiftSoup
import WebKit
@preconcurrency import WebKit

protocol EPUBSpreadViewDelegate: AnyObject {
/// Called when the spread view finished loading.
Expand Down
4 changes: 1 addition & 3 deletions Sources/Streamer/Server/WebServerResourceResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Foundation
import R2Shared
import ReadiumGCDWebServer

extension ReadiumGCDWebServerResponse: Loggable {}

/// Errors thrown by the `WebServerResourceResponse`
///
/// - streamOpenFailed: The stream is not open, stream.open() failed.
Expand Down Expand Up @@ -44,7 +42,7 @@ open class WebServerResourceResponse: ReadiumGCDWebServerFileResponse {

// If range is non nil - means it's not the first part (?)
if let range = range {
WebServerResourceResponse.log(.debug, "Request range at \(range.location) remaining: \(range.length).")
// WebServerResourceResponse.log(.debug, "Request range at \(range.location) remaining: \(range.length).")
/// Return a range of what to read next (nothing, next part, whole data).
func getNextRange(after range: NSRange,
forStreamOfLength streamLength: UInt64) -> Range<UInt64>
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/Carthage/project+lcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ options:
packages:
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/Carthage/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ options:
packages:
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/CocoaPods/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ target 'TestApp' do
# Required for R2Streamer and ReadiumAdapterGCDWebServer.
pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/master/GCDWebServer.podspec'

pod 'GRDB.swift', '~> 5.0'
pod 'GRDB.swift', '~> 6.0'
pod 'Kingfisher', '~> 5.0'
pod 'MBProgressHUD', '~> 1.0'
pod 'SwiftSoup', '~> 2.0'
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/CocoaPods/Podfile+lcp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ target 'TestApp' do
# Required for R2Streamer and ReadiumAdapterGCDWebServer.
pod 'ReadiumGCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/master/GCDWebServer.podspec'

pod 'GRDB.swift', '~> 5.0'
pod 'GRDB.swift', '~> 6.0'
pod 'Kingfisher', '~> 5.0'
pod 'MBProgressHUD', '~> 1.0'
pod 'SwiftSoup', '~> 2.0'
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/Local/project+lcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages:
path: R2LCPClient
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/Local/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ packages:
path: ..
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/SPM/project+lcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages:
path: R2LCPClient
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Integrations/SPM/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
VERSION
GRDB:
url: https://github.com/groue/GRDB.swift.git
from: 5.8.0
from: 6.9.23
Kingfisher:
url: https://github.com/onevcat/Kingfisher.git
from: 5.15.8
Expand Down
2 changes: 1 addition & 1 deletion TestApp/Sources/Data/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Database {

private let writer: DatabaseWriter

private init(writer: DatabaseWriter = DatabaseQueue()) throws {
private init(writer: DatabaseWriter) throws {
self.writer = writer

try writer.write { db in
Expand Down

0 comments on commit fcb464f

Please sign in to comment.