eonil
eonil

Reputation: 86155

@IBInspectable property doesn't show up in Interface Builder

I have a class like this, and this IB doesn't show the property foo1 in inspection pane.

@IBDesignable
final class Foo: UIView {
    @IBInspectable var bar1 = CGFloat(0) 
}

What's wrong?

(Xcode 10.1)

Upvotes: 3

Views: 368

Answers (1)

eonil
eonil

Reputation: 86155

I don't know why, but explicit property type expression fixes the problem.

@IBDesignable
final class Foo: UIView {
    @IBInspectable var bar1 = CGFloat(0)   // No work. 
    @IBInspectable var bar2: CGFloat = 0   // Works!
}

I really don't know why one form doesn't work while the other works. I hope Apple to fix this ASAP.

Upvotes: 6

Related Questions