skip to Main Content

After some months of not opening this project, when I opened it today, every new view I add to my ViewController’s interface in the corresponding Storyboard is not reflected. For instance, changing a button background does not reflect in the app at runtime.

Also, adding new views and referencing them through a @IBOutlet doesn’t work as well. I get a nil view reference on my viewDidLoad. Weirdly enough, all the views I had before, and am accessing on the viewDidLoad are not nil. Only the new views I add have this problem.

I have tried clearing the DerivedData folder and simulator caches but I ran out of stuff to try out. Anyone else having this issue?

To sum it all, every change I do on the interface builder now is to being applied to my view.

I am running Xcode 12.5.

EDIT: I tried adding a UILabel programmatically and it works. So, this is something that is wrong with how the storyboard creates the view reference in the ViewController. I still need help tho.

enter image description here

enter image description here

3

Answers


  1. Chosen as BEST ANSWER

    I found the issue after some hours. What led to this was that somehow, when I localized the storyboard in the past, XCode created one storyboard per language instead of just creating 2 .string files for each language. So this did the trick:

    Before:

    enter image description here

    After:

    enter image description here

    Problem solved! Thank you all


  2. One scenario in which that might happen is this:

    1. You have multiple targets with different sets of storyboards for each target
    2. You modify a storyboard that is not accessible in the current target that you build
    Login or Signup to reply.
  3. Have you checked the constraints? any of them are overlapped/ clipped or not defined any constraints at all? (In case of new Views and not the BG color)

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