Created
November 5, 2019 22:36
-
-
Save yoching/fe538921e5c680eec6a8b844b9133ad3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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