Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Demystifying IBDesignable

Demystifying IBDesignable

How to work with IBDesignable and IBInspectable.

Gabor Nagy Farkas

October 26, 2017
Tweet

More Decks by Gabor Nagy Farkas

Other Decks in Programming

Transcript

  1. Why? ▪ To create interfaces more easily ▪ To see

    more than white rectangles on a storyboard or xib ▪ To write less UI related code
  2. Resolving errors ▪ Unfortunately they are everywhere ▪ Get your

    constraints right without errors ▪ Always implement both in @IBDesignable
 init(frame: CGRect)
 init?(coder aDecoder: NSCoder) ▪ Delete contents of DerivedData 
 rm -rf ~/Library/Developer/Xcode/DerivedData ▪ Restart Xcode ▪ Look for the errors in:
 ~/Library/Logs/DiagnosticReports
  3. Conclusion ▪ Don’t be afraid of errors ▪ Interface Builder

    is not the place where Xcode shines but it’s usable ▪ With a little bit of workaround you can accomplish this