Skip to content

Instantly share code, notes, and snippets.

@novinfard
Created January 23, 2019 10:19
Show Gist options
  • Save novinfard/d725bb8c91df9c9011369e59a2b77e36 to your computer and use it in GitHub Desktop.
Save novinfard/d725bb8c91df9c9011369e59a2b77e36 to your computer and use it in GitHub Desktop.
[Live View in Playground]
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class CustomView: UIView {
override func draw(_ rect: CGRect) {
super.draw(rect)
// draw stuff
let rect = UIBezierPath(roundedRect: CGRect(x: 150, y: 150, width: 100, height: 100), cornerRadius: 5.0)
UIColor.green.set()
rect.fill()
}
}
let containerView = CustomView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
containerView.backgroundColor = UIColor.blue
PlaygroundPage.current.liveView = containerView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment