Reputation: 1904
I have about 6 swift files with three iOS frameworks imported and compiling my projects takes about 10-15 seconds which is very slow.
I might have narrowed down it to a single swift file in my project that contains alot of code which according to the project navigater is taking more than 6 seconds to compile as opposed to the other swift files.
I chain a large amount of if else conditions in that swift file and I'm wondering if that is the reason why it takes so long to compile?
Upvotes: 1
Views: 305
Reputation: 20006
Adding type annotation to your variables helps compile times a lot. Most of the time is usually spent inferring the type.
let foo: String = "FOO"
let x: CGFloat = 1.0
In my experience adding type annotations for numeric types like CGFloat
, Int
is especially helpful.
Upvotes: 1