Decreasing Storyboard compiling time in Xcode 6
Asked Answered
D

3

7

I converted my storyboard from old project with about 30 scenes to Size Classes-enabled mode in Xcode 6. After setting constraints for at least one scene I am trying to compile project and Storyboard compile time is reaaly long. I separated storyboard to two storyboards to recompile only edited one, but looks like they are recompiled both every time (again, even though only one of them was edited): enter image description here

Is there a way to set option to compile only edited Storyboard, or only pointed Storyboard? Also maybe another options are available, will glad to read in answers!

Dysentery answered 11/12, 2014 at 20:57 Comment(8)
I haven't tried, but would it be possible if you remove reference and add it when you want it, skip the compilation.Fen
Thangs, @Vig! Compile time changed dramatically, and at first look project worked good. But I don't understand how it not caused numerous exceptions during compile timeDysentery
are you saying that you are getting more errors or warnings?Fen
No, I am not getting any additional errors, and this is weird for me. Shouldn't links to unchecked Storyboard crash the project?Dysentery
Not really, your storyboard has reference to your class and other information and not your classes. So you shouldn't have any linker issueFen
Try to set Build Active Architecture Only: Debug - Yes, maybe will help you a littleFireplug
@Alex Hi, I'm interested in this too. Did you find any solution to compile only edited storyboard?Chemar
@dig, said, but nothing more than unchecking storyboards manuallyDysentery
F
6

Possible solution would be to remove reference of the storyboard and add it when required. This should reduce the compilation time as it's not part of the build phase.

Other option is to remove the storyboard from "Copy Bundle Resources" found in the Build Phases tab

Fen answered 11/12, 2014 at 21:20 Comment(2)
Thanks again! Can this process be automated? I mean to recompile only edited storyboards without checking-unchecking them manually?Dysentery
@Fen Do you need add storyboard file for final release?Entanglement
T
2

Seperating story boards solved compile time problem for me. I seperated my storyboard (which contains more than 40 ViewControllers) module by module so now i have 8 storyboards instead of 1 and my compile time got like 10 times faster :)

You can call your views from seperate storyboards like this in Swift :

let sb = UIStoryboard(name: "MyOtherModuleStoryBoardFileName", bundle: nil)
let targetVC = sb.instantiateViewControllerWithIdentifier("MyTargetVC") as! MyTargetViewController
self.presentViewController(targetVC, animated: true, completion: nil)

Hope it helps ;)

Thiazole answered 16/8, 2015 at 19:22 Comment(2)
Was not this the purpose for storyboards? keeping viewcontrollers grouped and viewing them easilyExperimentation
@SilviuSt I thought that too but I think by using module you can split in pieces that can be more handy to maintain (following storyboard with thousand of lines of code is tough, specially with many developers) and reusable (different targets or apps, SDK maybe). At least, you'll be able to compile only what you need and has changed in your app.Barm
I
0

Another solution to this problem is to change the storyboard file attributes from finder to make it read-only. Then Xcode skips compiling the storyboard file when it detects that the file date and time was unchanged.

Ishmul answered 18/4, 2017 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.