Skip to content

Commit f5d5a4e

Browse files
committed
chore: add typo fixes
1 parent 20b5725 commit f5d5a4e

File tree

10 files changed

+81
-81
lines changed

10 files changed

+81
-81
lines changed

Sources/AsyncObjects/AsyncEvent.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22

33
/// An object that controls execution of tasks depending on the signal state.
44
///
5-
/// An async event suspends tasks if current state is non-signaled and resumes execution when event is signaled.
5+
/// An async event suspends tasks if current state is non-signaled and resumes execution when event is signalled.
66
///
77
/// You can signal event by calling the ``signal()`` method and reset signal by calling ``reset()``.
88
/// Wait for event signal by calling ``wait()`` method or its timeout variation ``wait(forNanoseconds:)``.
@@ -11,8 +11,8 @@ public actor AsyncEvent: AsyncObject {
1111
private typealias Continuation = GlobalContinuation<Void, Error>
1212
/// The continuations stored with an associated key for all the suspended task that are waiting for event signal.
1313
private var continuations: [UUID: Continuation] = [:]
14-
/// Indicates whether current stateof event is signaled.
15-
private var signaled: Bool
14+
/// Indicates whether current state of event is signalled.
15+
private var signalled: Bool
1616

1717
/// Add continuation with the provided key in `continuations` map.
1818
///
@@ -60,13 +60,13 @@ public actor AsyncEvent: AsyncObject {
6060
}
6161

6262
/// Creates a new event with signal state provided.
63-
/// By default, event is initially in signaled state.
63+
/// By default, event is initially in signalled state.
6464
///
65-
/// - Parameter signaled: The signal state for event.
65+
/// - Parameter signalled: The signal state for event.
6666
///
6767
/// - Returns: The newly created event.
68-
public init(signaledInitially signaled: Bool = true) {
69-
self.signaled = signaled
68+
public init(signaledInitially signalled: Bool = true) {
69+
self.signalled = signalled
7070
}
7171

7272
deinit { self.continuations.forEach { $0.value.cancel() } }
@@ -76,7 +76,7 @@ public actor AsyncEvent: AsyncObject {
7676
/// After reset, tasks have to wait for event signal to complete.
7777
@Sendable
7878
public func reset() {
79-
signaled = false
79+
signalled = false
8080
}
8181

8282
/// Signals the event.
@@ -86,16 +86,16 @@ public actor AsyncEvent: AsyncObject {
8686
public func signal() {
8787
continuations.forEach { $0.value.resume() }
8888
continuations = [:]
89-
signaled = true
89+
signalled = true
9090
}
9191

92-
/// Waits for event signal, or proceeds if already signaled.
92+
/// Waits for event signal, or proceeds if already signalled.
9393
///
9494
/// Only waits asynchronously, if event is in non-signaled state,
95-
/// until event is signaled.
95+
/// until event is signalled.
9696
@Sendable
9797
public func wait() async {
98-
guard !signaled else { return }
98+
guard !signalled else { return }
9999
try? await withPromisedContinuation()
100100
}
101101
}

Sources/AsyncObjects/AsyncObject.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ public enum TaskTimeoutResult: Hashable {
1111
case timedOut
1212
}
1313

14-
/// An object type that can provide synchonization accross multiple task contexts
14+
/// An object type that can provide synchronization across multiple task contexts
1515
///
1616
/// Waiting asynchronously can be done by calling ``wait()`` method,
1717
/// while object decides when to resume task. Similarly, ``signal()`` can be used
18-
/// to indicate resuming of suspended tasks.
18+
/// to indicate resuming suspended tasks.
1919
public protocol AsyncObject: Sendable {
2020
/// Signals the object for task synchronization.
2121
///
@@ -69,7 +69,7 @@ public extension AsyncObject where Self: AnyObject {
6969
/// Waits for multiple objects to green light task execution.
7070
///
7171
/// Invokes ``AsyncObject/wait()`` for all objects
72-
/// and returns only when all the invokation completes.
72+
/// and returns only when all the invocation completes.
7373
///
7474
/// - Parameter objects: The objects to wait for.
7575
@inlinable
@@ -83,7 +83,7 @@ public func waitForAll(_ objects: [any AsyncObject]) async {
8383
/// Waits for multiple objects to green light task execution.
8484
///
8585
/// Invokes ``AsyncObject/wait()`` for all objects
86-
/// and returns only when all the invokation completes.
86+
/// and returns only when all the invocation completes.
8787
///
8888
/// - Parameter objects: The objects to wait for.
8989
@inlinable
@@ -95,7 +95,7 @@ public func waitForAll(_ objects: any AsyncObject...) async {
9595
/// within provided duration.
9696
///
9797
/// Invokes ``AsyncObject/wait()`` for all objects
98-
/// and returns either when all the invokation completes
98+
/// and returns either when all the invocation completes
9999
/// or the timeout expires.
100100
///
101101
/// - Parameters:
@@ -116,7 +116,7 @@ public func waitForAll(
116116
/// within provided duration.
117117
///
118118
/// Invokes ``AsyncObject/wait()`` for all objects
119-
/// and returns either when all the invokation completes
119+
/// and returns either when all the invocation completes
120120
/// or the timeout expires.
121121
///
122122
/// - Parameters:
@@ -135,7 +135,7 @@ public func waitForAll(
135135
/// by some(provided by count) of them.
136136
///
137137
/// Invokes ``AsyncObject/wait()`` for all objects
138-
/// and returns when some(provided by count) of the invokation completes.
138+
/// and returns when some(provided by count) of the invocation completes.
139139
///
140140
/// - Parameters:
141141
/// - objects: The objects to wait for.
@@ -153,7 +153,7 @@ public func waitForAny(_ objects: [any AsyncObject], count: Int = 1) async {
153153
/// by some(provided by count) of them.
154154
///
155155
/// Invokes ``AsyncObject/wait()`` for all objects
156-
/// and returns when some(provided by count) of the invokation completes.
156+
/// and returns when some(provided by count) of the invocation completes.
157157
///
158158
/// - Parameters:
159159
/// - objects: The objects to wait for.
@@ -167,7 +167,7 @@ public func waitForAny(_ objects: any AsyncObject..., count: Int = 1) async {
167167
/// by some(provided by count) of them within provided duration.
168168
///
169169
/// Invokes ``AsyncObject/wait()`` for all objects
170-
/// and returns when some(provided by count) of the invokation completes
170+
/// and returns when some(provided by count) of the invocation completes
171171
/// or the timeout expires.
172172
///
173173
/// - Parameters:
@@ -190,7 +190,7 @@ public func waitForAny(
190190
/// by some(provided by count) of them within provided duration.
191191
///
192192
/// Invokes ``AsyncObject/wait()`` for all objects
193-
/// and returns when some(provided by count) of the invokation completes
193+
/// and returns when some(provided by count) of the invocation completes
194194
/// or the timeout expires.
195195
///
196196
/// - Parameters:

Sources/AsyncObjects/AsyncSemaphore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public actor AsyncSemaphore: AsyncObject {
1818
/// Has value provided during initialization incremented by one.
1919
private var limit: UInt
2020
/// Current count of semaphore.
21-
/// Can have maximum value upto `limit`.
21+
/// Can have maximum value up to `limit`.
2222
private var count: Int
2323

2424
/// Add continuation with the provided key in `continuations` map.

Sources/AsyncObjects/CancellationSource.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import Foundation
22

33
/// An object that controls cooperative cancellation of multiple registered tasks and linked object registered tasks.
44
///
5-
/// An async event suspends tasks if current state is non-signaled and resumes execution when event is signaled.
5+
/// An async event suspends tasks if current state is non-signaled and resumes execution when event is signalled.
66
///
77
/// You can register tasks for cancellation using the ``register(task:)`` method
88
/// and link with additional sources by creating object with ``init(linkedWith:)`` method.
9-
/// By calling the ``cancel()`` method all the reigistered tasks will be cancelled
9+
/// By calling the ``cancel()`` method all the registered tasks will be cancelled
1010
/// and the cancellation event will be propagated to linked cancellation sources,
11-
/// which in turn cancels their rigistered tasks and further propagates cancellation.
11+
/// which in turn cancels their registered tasks and further propagates cancellation.
1212
///
1313
/// - Warning: Cancellation sources propagate cancellation event to other linked cancellation sources.
1414
/// In case of circular dependency between cancellation sources, app will go into infinite recursion.
1515
public actor CancellationSource {
16-
/// All the rigistered tasks for cooperative cancellation.
16+
/// All the registered tasks for cooperative cancellation.
1717
private var registeredTasks: [AnyHashable: () -> Void] = [:]
1818
/// All the linked cancellation sources that cancellation event will be propagated.
1919
///
@@ -27,7 +27,7 @@ public actor CancellationSource {
2727
///
2828
/// - Parameter task: The task to register.
2929
@inline(__always)
30-
private func add<Success, Faliure>(task: Task<Success, Faliure>) {
30+
private func add<Success, Failure>(task: Task<Success, Failure>) {
3131
guard !task.isCancelled else { return }
3232
registeredTasks[task] = { task.cancel() }
3333
}
@@ -36,7 +36,7 @@ public actor CancellationSource {
3636
///
3737
/// - Parameter task: The task to remove.
3838
@inline(__always)
39-
private func remove<Success, Faliure>(task: Task<Success, Faliure>) {
39+
private func remove<Success, Failure>(task: Task<Success, Failure>) {
4040
registeredTasks.removeValue(forKey: task)
4141
}
4242

@@ -56,7 +56,7 @@ public actor CancellationSource {
5656
/// Creates a new cancellation source object linking to all the provided cancellation sources.
5757
///
5858
/// Initiating cancellation in any of the provided cancellation sources
59-
/// will ensure newly created cancellation source recieve cancellation event.
59+
/// will ensure newly created cancellation source receive cancellation event.
6060
///
6161
/// - Parameter sources: The cancellation sources the newly created object will be linked to.
6262
///
@@ -73,7 +73,7 @@ public actor CancellationSource {
7373
/// Creates a new cancellation source object linking to all the provided cancellation sources.
7474
///
7575
/// Initiating cancellation in any of the provided cancellation sources
76-
/// will ensure newly created cancellation source recieve cancellation event.
76+
/// will ensure newly created cancellation source receive cancellation event.
7777
///
7878
/// - Parameter sources: The cancellation sources the newly created object will be linked to.
7979
///
@@ -95,13 +95,13 @@ public actor CancellationSource {
9595
}
9696
}
9797

98-
/// Register task for cooperative cancellation when cancellation event recieved on cancellation source.
98+
/// Register task for cooperative cancellation when cancellation event received on cancellation source.
9999
///
100100
/// If task completes before cancellation event is triggered, it is automatically unregistered.
101101
///
102102
/// - Parameter task: The task to register.
103103
@Sendable
104-
public func register<Success, Faliure>(task: Task<Success, Faliure>) {
104+
public func register<Success, Failure>(task: Task<Success, Failure>) {
105105
add(task: task)
106106
Task { [weak self] in
107107
let _ = await task.result
@@ -134,7 +134,7 @@ public actor CancellationSource {
134134
}
135135

136136
public extension Task {
137-
/// Runs the given nonthrowing operation asynchronously as part of a new task on behalf of the current actor,
137+
/// Runs the given non-throwing operation asynchronously as part of a new task on behalf of the current actor,
138138
/// with the provided cancellation source controlling cooperative cancellation.
139139
///
140140
/// A child task with the provided operation is created, cancellation of which is controlled by provided cancellation source.
@@ -186,7 +186,7 @@ public extension Task {
186186
}
187187
}
188188

189-
/// Runs the given nonthrowing operation asynchronously as part of a new task,
189+
/// Runs the given non-throwing operation asynchronously as part of a new task,
190190
/// with the provided cancellation source controlling cooperative cancellation.
191191
///
192192
/// A child task with the provided operation is created, cancellation of which is controlled by provided cancellation source.
@@ -238,7 +238,7 @@ public extension Task {
238238
}
239239
}
240240

241-
/// Runs the given nonthrowing operation asynchronously as part of a new top-level task on behalf of the current actor,
241+
/// Runs the given non-throwing operation asynchronously as part of a new top-level task on behalf of the current actor,
242242
/// with the provided cancellation source controlling cooperative cancellation.
243243
///
244244
/// The created task will be cancelled when cancellation event triggered on the provided cancellation source.
@@ -280,7 +280,7 @@ public extension Task {
280280
await cancellationSource.register(task: self)
281281
}
282282

283-
/// Runs the given nonthrowing operation asynchronously as part of a new top-level task,
283+
/// Runs the given non-throwing operation asynchronously as part of a new top-level task,
284284
/// with the provided cancellation source controlling cooperative cancellation.
285285
///
286286
/// The created task will be cancelled when cancellation event triggered on the provided cancellation source.

Sources/AsyncObjects/Continuable.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protocol ThrowingContinuable: Continuable {
3636
/// with a throwing continuation for the current task.
3737
///
3838
/// The continuation can be resumed exactly once,
39-
/// subsequent resumes have different behavior depending on type implemeting.
39+
/// subsequent resumes have different behaviors depending on type implementing.
4040
///
4141
/// - Parameter fn: A closure that takes the throwing continuation parameter.
4242
/// You can resume the continuation exactly once.
@@ -92,12 +92,12 @@ protocol NonThrowingContinuable: Continuable {
9292
/// The type of error to resume the continuation with in case of failure.
9393
associatedtype Failure = Never
9494
/// Suspends the current task, then calls the given closure
95-
/// with a nonthrowing continuation for the current task.
95+
/// with a non-throwing continuation for the current task.
9696
///
9797
/// The continuation can be resumed exactly once,
98-
/// subsequent resumes have different behavior depending on type implemeting.
98+
/// subsequent resumes have different behavior depending on type implementing.
9999
///
100-
/// - Parameter fn: A closure that takes the nonthrowing continuation parameter.
100+
/// - Parameter fn: A closure that takes the non-throwing continuation parameter.
101101
/// You can resume the continuation exactly once.
102102
///
103103
/// - Returns: The value passed to the continuation by the closure.
@@ -107,7 +107,7 @@ protocol NonThrowingContinuable: Continuable {
107107

108108
extension UnsafeContinuation: NonThrowingContinuable where E == Never {
109109
/// Suspends the current task, then calls the given closure
110-
/// with an unsafe nonthrowing continuation for the current task.
110+
/// with an unsafe non-throwing continuation for the current task.
111111
///
112112
/// The continuation must be resumed exactly once, subsequent resumes will cause runtime error.
113113
/// Use `CheckedContinuation` to capture relevant data in case of runtime errors.
@@ -124,7 +124,7 @@ extension UnsafeContinuation: NonThrowingContinuable where E == Never {
124124

125125
extension CheckedContinuation: NonThrowingContinuable where E == Never {
126126
/// Suspends the current task, then calls the given closure
127-
/// with a checked nonthrowing continuation for the current task.
127+
/// with a checked non-throwing continuation for the current task.
128128
///
129129
/// The continuation must be resumed exactly once, subsequent resumes will cause runtime error.
130130
/// `CheckedContinuation` logs messages proving additional info on these errors.

Sources/AsyncObjects/Future.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public actor Future<Output, Failure: Error> {
4040
}
4141

4242
/// Creates a future that can be fulfilled later by ``fulfill(with:)`` or
43-
/// any other variation of this methos.
43+
/// any other variation of this methods.
4444
///
4545
/// - Returns: The newly created future.
4646
public init() { }
@@ -115,7 +115,7 @@ extension Future where Failure == Never {
115115
/// The published value of the future, delivered asynchronously.
116116
///
117117
/// This property exposes the fulfilled value for the `Future` asynchronously.
118-
/// Immidiately returns if `Future` is fulfilled otherwise waits asynchronously
118+
/// Immediately returns if `Future` is fulfilled otherwise waits asynchronously
119119
/// for `Future` to be fulfilled.
120120
public var value: Output {
121121
get async {
@@ -329,7 +329,7 @@ extension Future where Failure == Error {
329329
/// The published value of the future or an error, delivered asynchronously.
330330
///
331331
/// This property exposes the fulfilled value for the `Future` asynchronously.
332-
/// Immidiately returns if `Future` is fulfilled otherwise waits asynchronously
332+
/// Immediately returns if `Future` is fulfilled otherwise waits asynchronously
333333
/// for `Future` to be fulfilled. If the Future terminates with an error,
334334
/// the awaiting caller receives the error instead.
335335
public var value: Output {

0 commit comments

Comments
 (0)