Nib file uploads extremely slow

Good afternoon friends!

I have very strange results when loading Nib files. Here is the TimeProfiler screen:

enter image description here

In general, it sometimes takes more than 1200 ms to load a simple two-point viewController. The threads are very simple. Here is an example. As you can see from the screenshot above, it takes 311 ms to download:

enter image description here

The code I use to download nibs is:

required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupXib() } func setupXib() { NSBundle.mainBundle().loadNibNamed("TimeSaver", owner: self, options: nil) bounds = view.bounds addSubview(view) setup() } func setup() { slider.maximumValue = 30.0 slider.minimumValue = 1.0 slider.value = 5.0 timeLabel.text = "\(sliderValue.format(format)) min" } 

I do not know if this can cause a problem, but this application uses application groups (for WatchExtension). As you can see, I am calling nibs from mainBundle, since they are all in the main target. Maybe this is the reason?

Thanks!

+5
source share
1 answer

So the problem was not in nib files at all. It was a non-standard font that was not installed correctly. It was listed on the Storyboard, but it was not a member of the right target. Therefore, the application scanned everywhere to find the damned font - and that was a performance issue.

+10
source

All Articles