I would appreciate knowing the limitations the iPad Swift Playgrounds app imposes. For example I was surprised to find that I got a runtime error when I tried to create more than five sub views. Playing with UILabels to present a form is very limiting!
This is the code I used:
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
let square50 = CGSize(width: 50, height: 50)
override func viewDidLoad() {
var myFrame = CGRect(origin: .zero, size: square50)
for index in 0...4 {
view.addSubview(UIView(frame: myFrame)) // fails at 6th!
(view.subviews[index] as! UIView).backgroundColor = .red
myFrame.origin.y += 80
}
}
}
PlaygroundPage.current.liveView = MyViewController()