NibIdentifiable
public protocol NibIdentifiable: class
Mechanica
Objects adopting the NibIdentifiable
protocol are nib based and are the only XIB root object.
-
nibIdentifier
Default implementationMechanica
The name of the nib file.
Default Implementation
Mechanica
The name of the nib file.
By default the nibIdentifier is the name of the class.
Declaration
Swift
static var nibIdentifier: String
-
nib(inBundle:)
Extension methodMechanica
Example:
extension MyView: NibIdentifiable {} //in a MyView.xib should exists only an object of class "MyView". let nib = nib()
Declaration
Swift
static func nib(inBundle bundle: Bundle? = nil) -> Nib
Parameters
bundle
the bundle where the .xib file is located.
Return Value
the nib whose
Self
is the the only XIB root object. -
instantiateFromNib(inBundle:)
Extension methodMechanica
Example:
extension MyView: NibIdentifiable {} //in a MyView.xib should exists only an object of class "MyView" let view = MyView.instantiateFromNib()
Declaration
Swift
static func instantiateFromNib(inBundle bundle: Bundle? = nil) -> Self
Parameters
bundle
the bundle where the .xib file is located
Return Value
an instance of ‘Self´ unarchived from the nib whose
Self
is the the only XIB root object.