skip to Main Content

After updating to the latest version of the xcode IBInspectable properties not showing up in the xib editor. You can see in the screenshots below that inspectable properties added both as extension and as properties for the specific class, both of them are not showing up in the xib file while editing.

inspectable properties code xib file. I was expecting that testCornerRadius inspectable property would be present in the xib file.

2

Answers


  1. Everything having to do with compiling storyboards in Xcode by way of Objective-C has been removed. That includes the old Xcode previews (not to be confused with SwiftUI previews), prepareForInterfaceBuilder, @IBDesignable, and @IBInspectable. This stuff never worked very well and led to crashes.

    As was always the case, you can achieve exactly the same effect as IBInspectable by using the User Defined Runtime Attributes.

    Login or Signup to reply.
  2. <userDefinedRuntimeAttributes>
       <userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
           <size key="value" width="0.0" height="0.0"/>
       </userDefinedRuntimeAttribute>
       <userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
           <color key="value" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
       </userDefinedRuntimeAttribute>
       <userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
           <real key="value" value="15"/>
       </userDefinedRuntimeAttribute>
       <userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
           <real key="value" value="1"/>
       </userDefinedRuntimeAttribute>
    

    Source Code

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search