개발/swift

Swift IBInspectable and IBDesignable

lemonade 2020. 10. 6. 22:57
반응형

What is IBInspectable and IBDesignable in swift?

 

With IBInspectable and IBDesignable, it’s possible to build a custom interface.

@IBInspectable properties provide new access to your own attributes 

to be configured on the Interface Builder. 

@IBInspectable  properties are runtime property.
So you can’t see how it changed without building and running your app

Otherwise @IBDesignable is user defined run time property.

If any @IBDesignable view is rendered on the storyboard,

the value of the @IBInspectable property rendered too.
This allows you to check @IBInspectable without building and running your app!

 

Add @IBInspectable properties to UIView

Tada! You can see that properties in storyboard!

 

 

Make own @IBDesignable view.

 

With this custom view, you can check how @IBInspectable property change view!

반응형
그리드형

'개발 > swift' 카테고리의 다른 글

Alamofire 5 Network Interceptor  (0) 2020.10.12
Multiple link UILabel in swift  (0) 2020.10.11
Swift navigation controller freeze on swipe gesture  (0) 2020.10.07
Swift validation  (0) 2020.10.05
Swift structure vs class  (0) 2020.10.01