This file contains 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 UIDevice { | |
enum UIDeviceModelType : Equatable { | |
///iPhoneX | |
case iPhoneX | |
///Other models | |
case other(model: String) | |
This file contains 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 UIView { | |
/// | |
/// Loads a view from nib. | |
/// | |
/// Please note that if you are assigning directly to an optinonal or unwrapped | |
/// optional you have to specify `name` of the nib. | |
/// | |
class func loadFromNib<T>(_ name: String = String(describing: T.self), owner: AnyObject? = nil, options: [AnyHashable: Any]? = nil, bundle: Bundle? = Bundle.main) -> T { | |
return UINib(nibName: name, bundle: bundle).instantiate(withOwner: owner, options: options).first as! T | |
} |
This file contains 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
@propertyWrapper | |
public struct UseAutoLayout<T: UIView> { | |
var value: T | |
public var wrappedValue: T { | |
get { return value } | |
set { self.value.translatesAutoresizingMaskIntoConstraints = false } | |
} | |
public init(wrappedValue: T) { |