Created
January 13, 2020 15:46
-
-
Save letatas/84159a6f30c8223b757b6cddd125dc3d to your computer and use it in GitHub Desktop.
ReusableXibViews - NibWrapped - v1
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
/// Property wrapper used to wrapp a view instanciated from a Nib | |
@propertyWrapper public struct NibWrapped<T: UIView> { | |
/// Initializer | |
/// | |
/// - Parameter type: Type of the wrapped view | |
public init(_ type: T.Type) { } | |
/// The wrapped value | |
public var wrappedValue: UIView! | |
/// The final view | |
public var unwrapped: T { (wrappedValue as! NibWrapperView<T>).contentView } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment