How do I run Asynchronous callbacks in Playground

前端 未结 8 749
夕颜
夕颜 2020-11-22 11:38

Many Cocoa and CocoaTouch methods have completion callbacks implemented as blocks in Objective-C and Closures in Swift. However, when trying these out in Playground, the co

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 12:03

    This API changed again in Xcode 8 and it was moved to the PlaygroundSupport:

    import PlaygroundSupport
    
    PlaygroundPage.current.needsIndefiniteExecution = true
    

    This change was mentioned in Session 213 at WWDC 2016.

提交回复
热议问题