Skip to content

Commit 61d8d05

Browse files
committed
new helpers
1 parent e413699 commit 61d8d05

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ playground.xcworkspace
4444
#
4545
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
4646
# hence it is not needed unless you have added a package configuration file to your project
47-
# .swiftpm
47+
.swiftpm
4848

4949
.build/
5050

Operation-iOS/Classes/Helpers/DispatchQueueHelper.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ public func dispatchInQueueWhenPossible(
1717
mutex?.unlock()
1818
}
1919
}
20+
21+
public func callbackClosureIfProvided<T>(
22+
_ closure: ((Result<T, Error>) -> Void)?,
23+
queue: DispatchQueue?,
24+
result: Result<T, Error>
25+
) {
26+
guard let closure else {
27+
return
28+
}
29+
30+
dispatchInQueueWhenPossible(queue) {
31+
closure(result)
32+
}
33+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Foundation
2+
3+
public extension OperationCombiningService {
4+
static func compoundNonOptionalWrapper(
5+
operationQueue: OperationQueue,
6+
wrapperClosure: @escaping () throws -> CompoundOperationWrapper<T>
7+
) -> CompoundOperationWrapper<T> {
8+
compoundNonOptionalWrapper(
9+
operationManager: OperationManager(operationQueue: operationQueue),
10+
wrapperClosure: wrapperClosure
11+
)
12+
}
13+
}

0 commit comments

Comments
 (0)