Skip to content

Commit 3f25b67

Browse files
committed
fix escaping closure crash within Xcode 10
1 parent c72edbb commit 3f25b67

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Sources/Nimble/DSL+Wait.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,17 @@ internal class NMBWait: NSObject {
8989

9090
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE
9191
@objc(untilFile:line:action:)
92-
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
92+
internal class func until(
93+
_ file: FileString = #file,
94+
line: UInt = #line,
95+
action: @escaping (@escaping () -> Void) -> Void) {
9396
until(timeout: 1, file: file, line: line, action: action)
9497
}
9598
#else
96-
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
99+
internal class func until(
100+
_ file: FileString = #file,
101+
line: UInt = #line,
102+
action: @escaping (@escaping () -> Void) -> Void) {
97103
until(timeout: 1, file: file, line: line, action: action)
98104
}
99105
#endif

Tests/NimbleTests/objc/ObjCAsyncTest.m

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ - (void)testAsyncCallback {
2929
waitUntil(^(void (^done)(void)){
3030
done();
3131
});
32+
waitUntil(^(void (^done)(void)){
33+
dispatch_async(dispatch_get_main_queue(), ^{
34+
done();
35+
});
36+
});
3237

3338
expectFailureMessage(@"Waited more than 1.0 second", ^{
3439
waitUntil(^(void (^done)(void)){ /* ... */ });

0 commit comments

Comments
 (0)