Since Xcode 7 and Swift 2.0, I get the error above, like in the screenshot shown here:
I have no idea where this is coming from, cleaning and deleting derived data didn't work.
Anyone else experiencing this problem?
Project settings:
Target settings:
I got this message when using do-try-catch in a Failable initializer:
The compilation succeeded when moving the try call to it's own local variable:
I was having this same problem and I found the problem was that I had changed the build system to "New Build System" after reading an article on "how to speed up your builds" (This is the article btw here)
So to go back to the standard build system:
Hope it helps someone and don't waste hours trying to find out why this was not working!
My case, Swift 5.1, Xcode 10.3 (10G8)
Code was crashing Swift when a nested function was using the argument of an outer function as a default parameter.
e.g.
I hope this helps.
In my case I had a
private struct Constants
declared in bothclass A
andextension A
.Probably it should be giving an error but it didn't.
For me below statement cause an error.
Fix the issue by
force unwraps
There is nothing related to the compiler. It is just type casting issue, Apple should give proper description instead of the giving compiler error
This worked for me, so just give it a try. i got this error while converting the code from swift 3 to swift 4.
Simply, go to Project>Target>Build Setting and search 'Swift Compiler - Code Generation' and set Optimization level to 'No Optimazation[-Onone]'.