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 SnapKit | |
| class MyViewController: UIViewController { | |
| lazy var box = UIView() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.addSubview(box) |
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
| default: app | |
| .PHONY: clean | |
| clean: | |
| rm MakeTest.app/app | |
| SDKROOT:=$(shell xcrun --sdk iphonesimulator --show-sdk-path) | |
| app: main.m | |
| clang -isysroot $(SDKROOT) -framework Foundation -framework UIKit -o MakeTest.app/$@ $^ |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleDevelopmentRegion</key> | |
| <string>en</string> | |
| <key>CFBundleDisplayName</key> | |
| <string>MakeTest</string> | |
| <key>CFBundleExecutable</key> | |
| <string>app</string> |
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/UIKit.h> | |
| @interface AppDelegate : UIResponder <UIApplicationDelegate> | |
| @property (strong, nonatomic) UIWindow *window; | |
| @end | |
| @implementation AppDelegate | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(id)options { | |
| CGRect mainScreenBounds = [[UIScreen mainScreen] bounds]; |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleDevelopmentRegion</key> | |
| <string>en</string> | |
| <key>CFBundleDisplayName</key> | |
| <string>MakeTest</string> | |
| <key>CFBundleExecutable</key> | |
| <string>app</string> |
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 | |
| extension CGColor { | |
| var UIColor: UIKit.UIColor { | |
| return UIKit.UIColor(cgColor: self) | |
| } | |
| } |
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 | |
| @IBDesignable | |
| class TextFieldWithPadding: UITextField { | |
| @IBInspectable var paddingLeft: CGFloat = 0.0 | |
| @IBInspectable var paddingRight: CGFloat = 0.0 | |
| var padding: UIEdgeInsets { | |
| UIEdgeInsets(top: 0, left: paddingLeft, bottom: 0, right: paddingRight) |
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 | |
| extension UIView { | |
| @IBInspectable var dropShadow: Bool { | |
| set { | |
| layer.shadowOffset = CGSize(width: 0, height: 0) | |
| if newValue { | |
| updateShadow() | |
| } else { |
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
| @IBDesignable | |
| class TextViewWithPadding: UITextView { | |
| @IBInspectable var paddingLeft: CGFloat = 0.0 { | |
| didSet { | |
| updateInsets() | |
| } | |
| } | |
| @IBInspectable var paddingRight: CGFloat = 0.0 { | |
| didSet { |
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 | |
| @IBDesignable | |
| class GradientView: UIView { | |
| enum Direction: Int { | |
| case horizontal | |
| case vertical | |
| } | |
| @IBInspectable var startColor: UIColor = .white { |