Skip to content

Commit febe500

Browse files
authored
Merge pull request #32 from brightdigit/v1.0.0-beta.3
V1.0.0 beta.3
2 parents 86cde0f + 2e2c150 commit febe500

File tree

10 files changed

+53
-40
lines changed

10 files changed

+53
-40
lines changed

.github/workflows/RadiantKit.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
if: "!contains(github.event.head_commit.message, 'ci skip')"
1515
strategy:
1616
matrix:
17-
image-name: ["swift:6.0-noble", "swiftlang/swift:nightly-6.1-jammy"]
17+
image-name: ["swift:6.0", "swift:6.1", "swiftlang/swift:nightly-6.2-noble"]
18+
1819
container:
1920
image: ${{ matrix.image-name }}
2021
steps:
2122
- uses: actions/checkout@v4
22-
- uses: brightdigit/swift-build@v1.1.0
23+
- uses: brightdigit/swift-build@v1.1.1
2324
- uses: sersoft-gmbh/swift-coverage-action@v4
2425
id: coverage-files
2526
with:
@@ -44,7 +45,11 @@ jobs:
4445
- runs-on: macos-15
4546
xcode: "/Applications/Xcode_16.1.app"
4647
- runs-on: macos-15
47-
xcode: "/Applications/Xcode_16.2.app"
48+
xcode: "/Applications/Xcode_16.4.app"
49+
50+
- type: macos
51+
runs-on: macos-15
52+
xcode: "/Applications/Xcode_16.4.app"
4853

4954
# iOS Build Matrix
5055
- type: ios
@@ -54,7 +59,7 @@ jobs:
5459
osVersion: "18.1"
5560
- type: ios
5661
runs-on: macos-15
57-
xcode: "/Applications/Xcode_16.2.app"
62+
xcode: "/Applications/Xcode_16.4.app"
5863
deviceName: "iPhone 16 Pro"
5964
osVersion: "18.2"
6065

@@ -66,28 +71,28 @@ jobs:
6671
osVersion: "11.1"
6772
- type: watchos
6873
runs-on: macos-15
69-
xcode: "/Applications/Xcode_16.2.app"
74+
xcode: "/Applications/Xcode_16.4.app"
7075
deviceName: "Apple Watch Ultra 2 (49mm)"
7176
osVersion: "11.2"
7277

7378
# visionOS Build Matrix
7479
- type: visionos
7580
runs-on: macos-15
76-
xcode: "/Applications/Xcode_16.2.app"
81+
xcode: "/Applications/Xcode_16.4.app"
7782
deviceName: "Apple Vision Pro"
7883
osVersion: "2.1"
7984

8085
# tvOS Build Matrix
8186
- type: tvos
8287
runs-on: macos-15
83-
xcode: "/Applications/Xcode_16.2.app"
88+
xcode: "/Applications/Xcode_16.4.app"
8489
deviceName: "Apple TV 4K (3rd generation)"
8590
osVersion: "18.2"
8691
steps:
8792
- uses: actions/checkout@v4
8893

8994
- name: Build and Test
90-
uses: brightdigit/swift-build@v1
95+
uses: brightdigit/swift-build@v1.1.1
9196
with:
9297
scheme: ${{ env.PACKAGE_NAME }}-Package
9398
type: ${{ matrix.type }}
@@ -139,4 +144,4 @@ jobs:
139144
cd Mint
140145
swift run mint install yonaskolb/mint
141146
- name: Lint
142-
run: ./Scripts/lint.sh
147+
run: ./Scripts/lint.sh

Sources/RadiantDocs/AppKit/NewFilePanel.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,19 @@
5656
openPanel.allowedContentTypes = [UTType(fileType: FileType.fileType)]
5757
openPanel.isExtensionHidden = true
5858
openPanel.begin { response in
59-
guard let fileURL = openPanel.url, response == .OK else {
60-
return
59+
Task { @MainActor in
60+
guard let fileURL = openPanel.url, response == .OK else {
61+
return
62+
}
63+
let value: FileType.WindowValueType
64+
do {
65+
value = try FileType.createAt(fileURL)
66+
} catch {
67+
openPanel.presentError(error)
68+
return
69+
}
70+
openWindow(value: value)
6171
}
62-
let value: FileType.WindowValueType
63-
do {
64-
value = try FileType.createAt(fileURL)
65-
} catch {
66-
openPanel.presentError(error)
67-
return
68-
}
69-
openWindow(value: value)
7072
}
7173
}
7274
}

Sources/RadiantDocs/AppKit/OpenAnyFilePanel.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@
6868
openPanel.allowedContentTypes = fileTypes.map(UTType.init(fileType:))
6969
openPanel.isExtensionHidden = true
7070
openPanel.begin { response in
71-
guard let fileURL = openPanel.url, response == .OK else {
72-
return
71+
Task { @MainActor in
72+
guard let fileURL = openPanel.url, response == .OK else {
73+
return
74+
}
75+
openFileURL(fileURL, with: openWindow)
7376
}
74-
openFileURL(fileURL, with: openWindow)
7577
}
7678
}
7779
}

Sources/RadiantDocs/AppKit/OpenFilePanel.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@
5858
openPanel.allowedContentTypes = [UTType(fileType: FileType.fileType)]
5959
openPanel.isExtensionHidden = true
6060
openPanel.begin { response in
61-
guard let fileURL = openPanel.url, response == .OK else {
62-
#warning("logging-note: should we log something here?")
63-
return
61+
Task { @MainActor in
62+
guard let fileURL = openPanel.url, response == .OK else {
63+
return
64+
}
65+
let libraryFile = DocumentFile<FileType>(url: fileURL)
66+
openWindow(value: libraryFile)
6467
}
65-
let libraryFile = DocumentFile<FileType>(url: fileURL)
66-
openWindow(value: libraryFile)
6768
}
6869
}
6970
}

Sources/RadiantDocs/Primitives/DocumentFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public import Foundation
3131

3232
/// Represents a document file with a specific file type.
33-
public struct DocumentFile<FileType: FileTypeSpecification>: Codable, Hashable {
33+
public struct DocumentFile<FileType: FileTypeSpecification>: Codable, Hashable, Sendable {
3434
/// The URL of the document file.
3535
public let url: URL
3636

Sources/RadiantDocs/Primitives/InitializableFileTypeSpecification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public import Foundation
3232
/// A protocol that defines a file type specification that can be initialized.
3333
public protocol InitializableFileTypeSpecification: FileTypeSpecification {
3434
/// The type of the window value associated with the file type specification.
35-
associatedtype WindowValueType: Codable & Hashable
35+
associatedtype WindowValueType: Codable & Hashable & Sendable
3636

3737
/// Creates a new instance of the window value type at the specified URL.
3838
///

Sources/RadiantProgress/FileOperationProgress.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@
4242
public let id: URL
4343

4444
/// The total value of the operation in bytes, if available.
45-
public var totalValueBytes: Int64? { operation.totalValue.map(Int64.init) }
45+
public var totalValueBytes: Int64? {
46+
operation.totalValue.map {
47+
Int64($0)
48+
}
49+
}
4650

4751
/// The current value of the operation in bytes.
4852
public var currentValueBytes: Int64 { Int64(operation.currentValue) }
4953

5054
internal var currentValue: Double { Double(operation.currentValue) }
5155

52-
internal var totalValue: Double? { operation.totalValue.map(Double.init) }
56+
internal var totalValue: Double? {
57+
operation.totalValue.map {
58+
Double($0)
59+
}
60+
}
5361

5462
/// Initializes a new `FileOperationProgress` object with the given progress
5563
/// operation.

Sources/RadiantProgress/ObservableDownloader.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@
144144
configuration: URLSessionConfiguration? = nil,
145145
queue: OperationQueue? = nil
146146
) {
147-
self.totalBytesExpectedToWrite = totalBytesExpectedToWrite.map(Int64.init(_:))
147+
self.totalBytesExpectedToWrite = totalBytesExpectedToWrite.map {
148+
Int64($0)
149+
}
148150

149151
let delegate = DownloadDelegate()
150152
self.session = URLSession(
@@ -178,7 +180,6 @@
178180
to destinationFileURL: URL,
179181
_ completion: @escaping @Sendable (Result<Void, any Error>) -> Void
180182
) {
181-
#warning("Requires Testing")
182183
self.delegate.setObserver(self)
183184
assert(self.completion == nil)
184185
self.completion = completion

Sources/RadiantProgress/ProgressOperation.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,13 @@ public protocol ProgressOperation<ValueType>: Identifiable where ID == URL {
4040
extension ProgressOperation {
4141
public func percentValue(withFractionDigits fractionDigits: Int = 0) -> String? {
4242
guard let totalValue else {
43-
#warning("logging-note: should we log something here?")
4443
return nil
4544
}
4645
let formatter = NumberFormatter()
4746
formatter.maximumFractionDigits = fractionDigits
4847
formatter.minimumFractionDigits = fractionDigits
4948
let ratioValue = Double(currentValue) / Double(totalValue) * 100.0
5049
let string = formatter.string(from: .init(value: ratioValue))
51-
52-
#warning("logging-note: let's log the calculated percent value if not done somewhere")
5350
assert(string != nil)
5451
return string
5552
}

Sources/RadiantProgress/SetupPublishers.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131

3232
import Combine
3333
import Foundation
34-
#warning(
35-
// swiftlint:disable:next line_length
36-
"logging-note: can we have some operators for logging the recieved stuff in these subscriptions"
37-
)
34+
3835
/// Manages the setup and configuration of publishers for an
3936
/// `ObservableDownloader` instance.
4037
internal struct SetupPublishers {

0 commit comments

Comments
 (0)