Skip to content

Instantly share code, notes, and snippets.

@yoching
Created November 5, 2019 22:36
Show Gist options
  • Save yoching/fe538921e5c680eec6a8b844b9133ad3 to your computer and use it in GitHub Desktop.
Save yoching/fe538921e5c680eec6a8b844b9133ad3 to your computer and use it in GitHub Desktop.
import UIKit
import PlaygroundSupport
// 1. define style as function
// 2. make syntax readable
// 3. make parameter configurable
// 4. make same style reusable
// 5. generalize custom operators
class ViewController : UIViewController {
override func loadView() {
self.view = UIView()
self.view.backgroundColor = .darkGray
let someView = UIView()
someView.frame = CGRect(x: 37.5, y: 200, width: 300, height: 300)
someView.backgroundColor = .white
view.addSubview(someView)
// 1
// 2
// 3
// 4
}
}
PlaygroundPage.current.liveView = ViewController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment