2

I am having an issue with IBDesignable elements not appearing in the storyboard view. It seems to be particular to my machine/version of Xcode (2015 11" Macbook Air running MacOS 10.14.4 and Xcode 10.2.1) and not an error in the code, as the same project displays fine when run on a 13" Retina (Xcode 9.2). It also displays correctly in the simulator.

I have tried cleaning and rebuilding the project, creating a new project, restarting Xcode, restarting the computer, deleting derived data, and updating to the latest version of Xcode but have had no success.

When I attempt to run Editor > Debug Selected Views, I get the following error: "Could not attach to pid: #### Error 1."

Below is an image showing my IBDesignable class and the resulting storyboard presentation.

storyboard and IBDesignable class

Any help with this would be greatly appreciated!

UPDATE: I also noticed that when I select the designable view, the inspector reads "Designables Updating," as in the image below:

enter image description here

kamisama42
  • 595
  • 4
  • 18
  • Do you have you designables in their own framework target? – Rob May 12 '19 at 14:54
  • What properties of `DesignableView` are not visible in `storyboard`? I don't find any `IBInspectables` in your code that should be visible in the `attributed inspector`. – PGDev May 13 '19 at 08:38
  • @Rob Thank you for the suggestion. I have not messed with any of the default settings with regard to designables. How can I determine whether the designables are in their own framework target? – kamisama42 May 13 '19 at 10:14
  • @PGDev Thank you. There are no IBInspectables because I am drawing the rectangle in the draw method and not from the storyboard. This exact project displays fine on my other mac, which leads me to believe that the problem must not be the code but either a bug in Xcode or some issue with my settings. – kamisama42 May 13 '19 at 10:14
  • 1
    @kamisama42 - In WWDC 2014 video [What's New in Interface Builder](https://developer.apple.com/videos/play/wwdc2014/411/) Apple was very specific that designables need to be in their own “target”. (In practice, we’ve found that you can get away with leaving these designables in your main target, but at the very least, it seems to minimizes problems to use separate target.) So “File” » “New” » “Target...” » “Cocoa Touch Framework”. If your main app is `MyApp`, then perhaps you might name this new framework target `MyAppKit` or `MyAppDesignables`. – Rob May 13 '19 at 16:14
  • @Rob I was able to solve the problem by enabling Automatically Refresh Views, but thank you for the link link and detailed explanation. I am sure it will be useful for future reference. – kamisama42 May 17 '19 at 01:35

2 Answers2

0

This finally solved my problem: https://stackoverflow.com/a/26720740/5291486

To sum up, I enabled Editor > Automatically Refresh Views and then clicked Editor > Refresh All Views.

kamisama42
  • 595
  • 4
  • 18
-1

Verify if the code in your draw function is correct.

Sujan
  • 147
  • 1
  • 3