Last active
November 14, 2017 04:22
-
-
Save 0xinterface/943f461bf19aec8c2030d6d9bdfa7fd1 to your computer and use it in GitHub Desktop.
Cheatsheet
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
var window: UIWindow? | |
var navigationController: UINavigationController? | |
var mainViewController: UIViewController? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
window = UIWindow(frame: UIScreen.main.bounds) | |
mainViewController = UIViewController() | |
navigationController = UINavigationController(rootViewController: mainViewController!) | |
window?.rootViewController = navigationController | |
window?.makeKeyAndVisible() | |
return true | |
} |
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
extension UIColor { | |
convenience init(red: Int, green: Int, blue: Int, a: CGFloat = 1.0) { | |
self.init( | |
red: CGFloat(red) / 255.0, | |
green: CGFloat(green) / 255.0, | |
blue: CGFloat(blue) / 255.0, | |
alpha: a | |
) | |
} | |
convenience init(rgb: Int, a: CGFloat = 1.0) { | |
self.init( | |
red: (rgb >> 16) & 0xFF, | |
green: (rgb >> 8) & 0xFF, | |
blue: rgb & 0xFF, | |
a: a | |
) | |
} | |
} |
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
extension UIButton { | |
func applyRaisedStyle(){ | |
self.setTitleColor(UIColor.black, for: .normal) | |
self.backgroundColor = UIColor.white | |
self.layer.cornerRadius = 6 | |
self.layer.masksToBounds = false | |
self.layer.shadowColor = UIColor.black.cgColor | |
self.layer.shadowOffset = CGSize(width: 0, height: 0.08) | |
self.layer.shadowOpacity = 0.075 | |
self.layer.shadowRadius = 5 | |
self.layer.shadowPath = UIBezierPath(rect: self.bounds).cgPath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment