32
32

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcode7.3のPlaygroundはついにインタラクションに対応!

Posted at

Xcode7.3からPlaygroundがタッチイベント等に対応しました。

sample.gif

上記のサンプルは以下のコード


import UIKit
import XCPlayground

class ViewController: UITableViewController {
  override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .whiteColor()
    view.frame = CGRectMake(0, 0, 1136/2, 640/2)
  }
}

extension ViewController {
  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 50
  }
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = UITableViewCell()
    cell.textLabel?.text = "hello \(indexPath.row)"
    return cell
  }
}

XCPlaygroundPage.currentPage.liveView = ViewController()

32
32
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
32
32

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?