NibDesignableProtocol

public protocol NibDesignableProtocol: NSObjectProtocol

Protocol for NibDesignable pattern (related to @IBDesignable) for loading xib-based views for UIView subclasses in an @IBDesignable-compatible way. Views which are NibDesignable may typically be rendered in Interface Builder.

See also

NibDesignable project on github.com (MIT License)

Authors

@mbogh, et al.
  • Identifies the view that will be the superview of the contents loaded from the Nib. Referenced in setupNib().

    Declaration

    Swift

    var nibContainerView: UIView

    Return Value

    Superview for Nib contents.

  • Called in the default implementation of loadNib(). Default is class name.

    Declaration

    Swift

    var nibName: String

    Return Value

    Name of a single view nib file.

  • Called in the default implementation of loadNib(). Default is the bundle of the custom view class.

    Declaration

    Swift

    var bundle: Bundle

    Return Value

    the bundle of the NibDesigable to look for the Nib for.

  • Specifies which class should be responsible for loading the Nib of this NibDesignable. Defaults to the class that implements NibDesignable protocol. However, if subclasses of NibDesignable views (i.e. subclasses of subclasses of NibDesignable) don’t want to handle their own Nib but rely on that of their superclass, they should override this variable and return the super class handling Nib-loading.

    Declaration

    Swift

    var nibLoadingClass: AnyClass

    Return Value

    the class that handles the nib loading. This class needs to be implementing NibDesignableProtocol.