Skip to content

@IBInspectable, @IBDesignable

Ken Harris edited this page Feb 20, 2018 · 1 revision

TL;DR: avoid.

There's a mostly-undocumented feature of Xcode called @IBInspectable / @IBDesignable. It looks really cool in the demos. It's a great idea.

Don't get sucked in. I've never gotten it to work in any non-trivial project. You might discover that you need to explicitly declare types for each @IBInspectable, and then you run into "Error", and then the error tooltip changes between builds for no apparent reason, and you file Radars and can't get any help there, either ... just don't. You can feel like you're 10 seconds away from getting to work, but you can feel that way for days on end. It's not worth it.

Your project shouldn't take more than a few seconds to rebuild one view, and it shouldn't take more than a few seconds to display your view when you run it. (If either one isn't true, you need to fix your build, or fix your design. Or make a standalone test app to let you tweak your view.) The edit-compile-run loop won't be instantaneous, but it's not too bad.

Clone this wiki locally