Skip to content

Commit f098b24

Browse files
authored
Update ci.yml (#4)
* Disable support for TaskFactory for Swift versions lower than 6.0 * Update `ci.yml` * Fix a typo * Update `README.md` * Bump the tvOS version to `v13`
1 parent 7102a40 commit f098b24

File tree

13 files changed

+208
-214
lines changed

13 files changed

+208
-214
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
include:
37-
- xcode: "Xcode_16.0"
37+
- xcode: "Xcode_16.2"
3838
runsOn: macOS-14
39-
name: "macOS 14, Xcode 16.0, Swift 6.0"
39+
name: "macOS 14, Xcode 16.2, Swift 6.0"
4040
- xcode: "Xcode_15.4"
4141
runsOn: macOS-14
4242
name: "macOS 14, Xcode 15.4, Swift 5.10"
@@ -65,10 +65,6 @@ jobs:
6565
name: "iOS 18.1"
6666
xcode: "Xcode_16.1"
6767
runsOn: macOS-14
68-
- destination: "OS=18.0,name=iPhone 16 Pro"
69-
name: "iOS 18.0"
70-
xcode: "Xcode_16.0"
71-
runsOn: macOS-14
7268
- destination: "OS=17.5,name=iPhone 15 Pro"
7369
name: "iOS 17.5"
7470
xcode: "Xcode_15.4"
@@ -100,10 +96,6 @@ jobs:
10096
name: "tvOS 18.1"
10197
xcode: "Xcode_16.1"
10298
runsOn: macOS-14
103-
- destination: "OS=18.0,name=Apple TV"
104-
name: "tvOS 18.0"
105-
xcode: "Xcode_16.0"
106-
runsOn: macOS-14
10799
- destination: "OS=17.5,name=Apple TV"
108100
name: "tvOS 17.5"
109101
xcode: "Xcode_15.4"
@@ -135,10 +127,6 @@ jobs:
135127
name: "watchOS 11.1"
136128
xcode: "Xcode_16.1"
137129
runsOn: macOS-14
138-
- destination: "OS=11.0,name=Apple Watch Series 10 (46mm)"
139-
name: "watchOS 11.0"
140-
xcode: "Xcode_16.0"
141-
runsOn: macOS-14
142130
- destination: "OS=10.5,name=Apple Watch Series 9 (45mm)"
143131
name: "watchOS 10.5"
144132
xcode: "Xcode_15.4"
@@ -169,9 +157,6 @@ jobs:
169157
- name: "macOS 14, SPM 6.0.2 Test"
170158
xcode: "Xcode_16.1"
171159
runsOn: macOS-14
172-
- name: "macOS 14, SPM 6.0.0 Test"
173-
xcode: "Xcode_16.0"
174-
runsOn: macOS-14
175160
- name: "macOS 14, SPM 5.9.0 Test"
176161
xcode: "Xcode_15.0"
177162
runsOn: macos-14
@@ -195,4 +180,4 @@ jobs:
195180
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
196181
python3 -m pip install --upgrade pip
197182
python3 -m pip install codespell
198-
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
183+
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.10.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.5.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.6.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.7.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.8.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

Package@swift-5.9.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v10_15),
1010
.iOS(.v13),
1111
.watchOS(.v6),
12-
.tvOS(.v12),
12+
.tvOS(.v13),
1313
],
1414
products: [
1515
.library(name: "Concurrency", targets: ["Concurrency"]),

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ testQueue.async {}
5555
```
5656

5757
## Requirements
58-
- iOS 13.0+ / macOS 10.15+ / tvOS 12.0+ / watchOS 6.0+
58+
- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+
5959
- Xcode 14.0
6060
- Swift 5.5
6161

@@ -68,7 +68,7 @@ Once you have your Swift package set up, adding `concurrency` as a dependency is
6868

6969
```swift
7070
dependencies: [
71-
.package(url: "https://github.com/space-code/concurrency.git", .upToNextMajor(from: "0.1.0"))
71+
.package(url: "https://github.com/space-code/concurrency.git", .upToNextMajor(from: "0.2.0"))
7272
]
7373
```
7474

Sources/Concurrency/TaskFactory/ITaskFactory.swift

Lines changed: 90 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -5,101 +5,104 @@
55

66
import Foundation
77

8-
// MARK: - ITaskFactory
8+
#if swift(>=6.0)
99

10-
// swiftlint:disable attributes
11-
/// A protocol for creating and managing tasks with different configurations.
12-
/// Provides methods to create tasks tied to the current actor context or detached tasks
13-
/// that run independently of the current actor.
14-
public protocol ITaskFactory {
15-
/// Creates a task tied to the current actor context that can throw errors.
16-
/// - Parameters:
17-
/// - priority: The priority of the task (optional).
18-
/// - operation: An asynchronous operation to execute within the task. The operation
19-
/// inherits the current actor context and is isolated to that actor.
20-
/// - Returns: A `Task` object that wraps the result or error of the operation.
21-
func task<Success: Sendable>(
22-
priority: TaskPriority?,
23-
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
24-
) -> Task<Success, Error>
10+
// MARK: - ITaskFactory
2511

26-
/// Creates a task tied to the current actor context that does not throw errors.
27-
/// - Parameters:
28-
/// - priority: The priority of the task (optional).
29-
/// - operation: An asynchronous operation to execute within the task. The operation
30-
/// inherits the current actor context and is isolated to that actor.
31-
/// - Returns: A `Task` object that wraps the result of the operation.
32-
func task<Success: Sendable>(
33-
priority: TaskPriority?,
34-
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
35-
) -> Task<Success, Never>
12+
// swiftlint:disable attributes
13+
/// A protocol for creating and managing tasks with different configurations.
14+
/// Provides methods to create tasks tied to the current actor context or detached tasks
15+
/// that run independently of the current actor.
16+
public protocol ITaskFactory {
17+
/// Creates a task tied to the current actor context that can throw errors.
18+
/// - Parameters:
19+
/// - priority: The priority of the task (optional).
20+
/// - operation: An asynchronous operation to execute within the task. The operation
21+
/// inherits the current actor context and is isolated to that actor.
22+
/// - Returns: A `Task` object that wraps the result or error of the operation.
23+
func task<Success: Sendable>(
24+
priority: TaskPriority?,
25+
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
26+
) -> Task<Success, Error>
3627

37-
/// Creates a detached task that runs independently of the current actor context
38-
/// and can throw errors.
39-
/// - Parameters:
40-
/// - priority: The priority of the task (optional).
41-
/// - operation: An asynchronous operation to execute within the task. The operation
42-
/// is isolated and does not inherit the current actor context.
43-
/// - Returns: A `Task` object that wraps the result or error of the operation.
44-
func detached<Success: Sendable>(
45-
priority: TaskPriority?,
46-
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
47-
) -> Task<Success, Error>
28+
/// Creates a task tied to the current actor context that does not throw errors.
29+
/// - Parameters:
30+
/// - priority: The priority of the task (optional).
31+
/// - operation: An asynchronous operation to execute within the task. The operation
32+
/// inherits the current actor context and is isolated to that actor.
33+
/// - Returns: A `Task` object that wraps the result of the operation.
34+
func task<Success: Sendable>(
35+
priority: TaskPriority?,
36+
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
37+
) -> Task<Success, Never>
4838

49-
/// Creates a detached task that runs independently of the current actor context
50-
/// and does not throw errors.
51-
/// - Parameters:
52-
/// - priority: The priority of the task (optional).
53-
/// - operation: An asynchronous operation to execute within the task. The operation
54-
/// is isolated and does not inherit the current actor context.
55-
/// - Returns: A `Task` object that wraps the result of the operation.
56-
func detached<Success: Sendable>(
57-
priority: TaskPriority?,
58-
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
59-
) -> Task<Success, Never>
60-
}
39+
/// Creates a detached task that runs independently of the current actor context
40+
/// and can throw errors.
41+
/// - Parameters:
42+
/// - priority: The priority of the task (optional).
43+
/// - operation: An asynchronous operation to execute within the task. The operation
44+
/// is isolated and does not inherit the current actor context.
45+
/// - Returns: A `Task` object that wraps the result or error of the operation.
46+
func detached<Success: Sendable>(
47+
priority: TaskPriority?,
48+
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
49+
) -> Task<Success, Error>
6150

62-
/// Default implementations for the `ITaskFactory` protocol.
63-
public extension ITaskFactory {
64-
/// Creates a task tied to the current actor context with a default priority
65-
/// that can throw errors.
66-
/// - Parameter operation: An asynchronous operation to execute within the task.
67-
/// - Returns: A `Task` object that wraps the result or error of the operation.
68-
func task<Success: Sendable>(
69-
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
70-
) -> Task<Success, Error> {
71-
task(priority: nil, operation: operation)
51+
/// Creates a detached task that runs independently of the current actor context
52+
/// and does not throw errors.
53+
/// - Parameters:
54+
/// - priority: The priority of the task (optional).
55+
/// - operation: An asynchronous operation to execute within the task. The operation
56+
/// is isolated and does not inherit the current actor context.
57+
/// - Returns: A `Task` object that wraps the result of the operation.
58+
func detached<Success: Sendable>(
59+
priority: TaskPriority?,
60+
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
61+
) -> Task<Success, Never>
7262
}
7363

74-
/// Creates a task tied to the current actor context with a default priority
75-
/// that does not throw errors.
76-
/// - Parameter operation: An asynchronous operation to execute within the task.
77-
/// - Returns: A `Task` object that wraps the result of the operation.
78-
func task<Success: Sendable>(
79-
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
80-
) -> Task<Success, Never> {
81-
task(priority: nil, operation: operation)
82-
}
64+
/// Default implementations for the `ITaskFactory` protocol.
65+
public extension ITaskFactory {
66+
/// Creates a task tied to the current actor context with a default priority
67+
/// that can throw errors.
68+
/// - Parameter operation: An asynchronous operation to execute within the task.
69+
/// - Returns: A `Task` object that wraps the result or error of the operation.
70+
func task<Success: Sendable>(
71+
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
72+
) -> Task<Success, Error> {
73+
task(priority: nil, operation: operation)
74+
}
8375

84-
/// Creates a detached task with a default priority that runs independently
85-
/// of the current actor context and can throw errors.
86-
/// - Parameter operation: An asynchronous operation to execute within the task.
87-
/// - Returns: A `Task` object that wraps the result or error of the operation.
88-
func detached<Success: Sendable>(
89-
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
90-
) -> Task<Success, Error> {
91-
detached(priority: nil, operation: operation)
92-
}
76+
/// Creates a task tied to the current actor context with a default priority
77+
/// that does not throw errors.
78+
/// - Parameter operation: An asynchronous operation to execute within the task.
79+
/// - Returns: A `Task` object that wraps the result of the operation.
80+
func task<Success: Sendable>(
81+
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
82+
) -> Task<Success, Never> {
83+
task(priority: nil, operation: operation)
84+
}
85+
86+
/// Creates a detached task with a default priority that runs independently
87+
/// of the current actor context and can throw errors.
88+
/// - Parameter operation: An asynchronous operation to execute within the task.
89+
/// - Returns: A `Task` object that wraps the result or error of the operation.
90+
func detached<Success: Sendable>(
91+
@_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success
92+
) -> Task<Success, Error> {
93+
detached(priority: nil, operation: operation)
94+
}
9395

94-
/// Creates a detached task with a default priority that runs independently
95-
/// of the current actor context and does not throw errors.
96-
/// - Parameter operation: An asynchronous operation to execute within the task.
97-
/// - Returns: A `Task` object that wraps the result of the operation.
98-
func detached<Success: Sendable>(
99-
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
100-
) -> Task<Success, Never> {
101-
detached(priority: nil, operation: operation)
96+
/// Creates a detached task with a default priority that runs independently
97+
/// of the current actor context and does not throw errors.
98+
/// - Parameter operation: An asynchronous operation to execute within the task.
99+
/// - Returns: A `Task` object that wraps the result of the operation.
100+
func detached<Success: Sendable>(
101+
@_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success
102+
) -> Task<Success, Never> {
103+
detached(priority: nil, operation: operation)
104+
}
102105
}
103-
}
104106

105-
// swiftlint:enable attributes
107+
// swiftlint:enable attributes
108+
#endif

0 commit comments

Comments
 (0)