Skip to content

Commit dff7eb3

Browse files
committed
wow, async methods can be exposed to Objective-C
1 parent e11f2ed commit dff7eb3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bk1ch14Appendix/Appendix/ViewController.swift

+8
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,14 @@ class ViewController: UIViewController, Proto { // Objective-C can see this beca
663663
}
664664

665665
@objc func doNewGame(_ sender:Any) { print("do new game") }
666+
667+
@objc func asyncFunc() async -> Data { Data() } // legal!
668+
669+
@objc func asyncFunc2() async throws -> Data { Data() }
670+
671+
func callAsyncFunc() async {
672+
_ = await self.asyncFunc()
673+
}
666674

667675
}
668676

0 commit comments

Comments
 (0)