Alejandro Martinez

BlogPodcastPortfolio Youtube

07 September, 2014Development🕐 1min read

Wait for async code in a Swift playground

By default a Swift playground stops it's execution when the top level function finishes. If you want to run async code you will never see the results. The system doesn't provides a waiting architecture like node.js, which is a bad thing scripts.

	</div>

</div>

But in the playground you can continue running the main loop even if the top level funcitons has finished. You just need to import XCPlayground framework and call XCPSetExecutionShouldContinueIndefinitely(). This will continue running the playground until the time out (by default 30s). You can change that time out in the assistant editor.

I want Headers in SwiftScripting helpers for Swift

Alejandro Martinez
alexito4@gmail.com

Buka pintu

alexito4
alexito4