1
@IBInspectable  var numLines:UInt! = 2

The above code shows a message

Failed to set (numLines) user defined inspected property

UIViewNewClass [setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key numLines.

It does work with another IBInspectable property which is UIColor.

Does IBInspectable work with Int or UInt or am I doing something wrong here or it works only with NSNumber?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
NNikN
  • 3,720
  • 6
  • 44
  • 86

1 Answers1

1

It should work with Int, UInt, or any other numeric type. I've verified this locally with the code below:

@IBDesignable
class TestViewController: UIViewController {
    ...

    @IBInspectable var test: UInt = 0

    ...
}

This is showing up and working in interface builder as expected. I would make sure you have @IBDesignable on your class definition and also try doing a clean and deleting derived data.

Jake
  • 13,097
  • 9
  • 44
  • 73
  • Yeah, I did Clean and build, but that did not work. So, closed the Xcode , opened it again and then it worked with no errors. – NNikN Jan 02 '17 at 16:37