ios - Using IBDesignable and IBInspectable with UIViewController -
i new ios development. using swift , want design views programmatically use ibdesigner , ibinspectable speed design process.
right have view controller various buttons , labels on it. here snippet of code:
@ibdesignable class landingview: uiviewcontroller, landingviewprotocol { @ibinspectable lazy var backbutton: uibutton = { var button = uibutton() button.backgroundcolor = styles.button_color return button }() @ibinspectable lazy var caption: uilabel = uilabel() }
my question how use interface builder ibdesignable , ibinspectable? need add .xib? saw other questions mentioning need use playground, trying avoid using that, wanted know if possible view entire viewcontroller?
thank you,
you can not use ibdesignable class not inherit uiview or nsview. check guideline apple ibdesignable:
you can use 2 different attributes—@ibdesignable , @ibinspectable—to enable live, interactive custom view design in interface builder. when create custom view inherits uiview class or nsview class, can add @ibdesignable attribute before class declaration
source: live rendering
a
Comments
Post a Comment