7

Problem:

I am working on a UIViewController on my Storyboard/Interface Builder, with a UICollectionView in it that defines a UICollectionViewCell. Everytime I change something in this cell, all its subviews goes to blank white, making it impossible to see anything. Also when I update constraints frame won't move even if I refresh, like the whole interface builder is broken. It's only for this UIViewController, sometimes does it for an other one. Interface Builder Builds show warnings from Pods (I can't help it). I have no broken constraints.

(Very) Temporary solution:

If I quit Xcode, clean, rebuild and re-open the Storyboard, it will be back to "almost" normal (meaning not all views shows properly but at least I can see them and it's not fully white) until I switch to an other file and come back. When I come back to the storyboard will be blank again. Sometimes I have to delete my DerivedData and the cell will display perfect. Only for a few minutes.

Also, I do not have any constraints warnings or anything.

EDIT: I removed all classes from all the views in the cell, just in case something in my custom views was causing these problems. My views mostly implement layers and gradients so I thought I might have been doing something wrong breaking the IB rendering. On the top of the cell there is a custom UIView that I made, that uses a CAGradientLayer. If I remove the class from this view, the cell will start displaying again. But I can't be sure this is the cause since when I leave the storyboard and come back on it, the cell will be white again. Without having putting back the class in place.

EDIT2: I uninstalled and reinstalled Xcode and cocoapods. Updated the pods. Created a new xcworspace.

Screenshot

enter image description here

enter image description here

Details on my environment

I am using Swift, XCode 9.3, Cocoapods 1.5.0, High Sierre 10.13.4 Feel free to ask any other details My Pods (that generate lots of warnings due to swift 4 compatibility) :

  pod 'FBSDKLoginKit'
  pod 'FBSDKCoreKit'
  pod 'FSPagerView'
  pod 'CropViewController'
  pod 'SwiftLint'
  pod 'Parse'
  pod 'Parse/FacebookUtils'
  pod 'ImagePicker'
  pod 'XLPagerTabStrip', '~> 8.0'
  pod 'Eureka'
Community
  • 1
  • 1
Scaraux
  • 3,841
  • 4
  • 40
  • 80

3 Answers3

1

You should call the super parent in the awakeFromNib method.

You must call the super implementation of awakeFromNib to give parent classes the opportunity to perform any additional initialization they require.

override func awakeFromNib() {
  super.awakeFromNib()
  setup()
}
Alexis Darnat
  • 581
  • 6
  • 13
1

Can be one of your Dependency, look at the issues on these dependencies.

Try to remove your dependencies one by one.

Alexis Darnat
  • 581
  • 6
  • 13
0

The problem was caused by Cocoapods an Xcode.

First, I realized by cloning my project on an other machine, that my Xcode was not displaying the Interface Builder errors, but only the warnings.

How to display Interface Builder errors ?

On the left pane in Xcode (the one with the file hierarchy), click on the last item looking like a comic bubble. You will see the build, workspace and interface builder errors. My Xcode for some reason would not display anything, so I re-installed for the second time Xcode.

How to properly re-install Xcode ?

Simply delete all those files :

/Applications/Xcode.app
/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/Xcode
~/Library/Developer
~/Library/Developer/Xcode
~/Library/Developer/CoreSimulator

Source : How to Completely Uninstall Xcode and Clear All Settings

Then, Xcode showed me this error :

enter image description here

Finally, I could confirm that removing the pod related to this framework would stop breaking my storyboard. By looking more on the internet, I found that this is an actual issue related to Frameworks signing, caused by cocoa pods.

I uninstalled Cocoapods 1.5.0 and re-installed the 1.4.0 version.

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.4.0

Source : Xcode - @IBDesignables - Required code signing missing for X.framework

All problems fixed.

Scaraux
  • 3,841
  • 4
  • 40
  • 80