LoginSignup
14
13

More than 5 years have passed since last update.

playground で非同期通信をする

Last updated at Posted at 2015-11-26

playground 上で非同期通信をする場合、普通に書いても動きません。

特に step3 が重要です!

step1: import

import XCPlayground

step2: 通信処理を書く

やりたい処理を書きましょう。

NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response, data, error) -> Void in
  何か処理
}

step3: 実行

XCPSetExecutionShouldContinueIndefinitely()
14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13