Does anyone know if it is possible to have Swift 1.2 and Swift 2 source code in the same Xcode 7 project?
Swift 1.2 and Swift 2 in the same project?
Not possible. The new compiler doesn't accept Swift 1.2 source.
That *****, so I have to wait unitl all dependent code (other people's responsibility) convert to Swift 2 before I can convert my projects!
Well Apple told that there will be source breaking changes comming right from the start. Why are people now surprised?
There is always a penalty for using bleeding edge stuff. In the case of Swift, there has been significant penalties for early adopters as people have already discovered.
From my understanding, people who have deployed Swift 1.x apps before will be forced to update to Swift 2 if they want to target anything specific to iOS 9 or OS X 10.11 (assuming those SDKs will not be available for Swift 1.x on Xcode 6 at least officially). Otherwise, it is safer to stay with Swift 1.x on Xcode 6 for now (and even more safer if you had not adopted Swift at all so you can target latest APIs in Xcode 7 without penalties).
They have not officially confirmed yet which older iOS or OS X versions will be (and not be) supported for Swift 2. So, I am not sure how one can make a safe and informed decision on a migration path for a significant project using Swift.
What is your compelling use case that requires you to convert an existing project to Swift 2? Worth thinking about.
If the new language constructs, latest APIs, etc., are of interest then you are better off using the bleeding edge stuff for only new projects or throwaway apps that do not have any dependencies outside your control.
Supporting 1.x and 2 in the same project seems impractical even if possible since the run time support would have significantly changed between them.
You could try updating the other code yourself, since you have the source?
Switching to Swift 2.0 will probably throw up a lot of errors and warnings, but most issues that need fixing tend to be simple repetitive changes that the migrator probably could have handled (changing var to let, updating the old generic functions to be called as methods, etc).
It might not be very difficult at all, and when those other people update their code, you can always just swap it in.
They did, however, promise binary compatibility so I'm sure they could find a way to allow you to keep using Swift 1.2 in Xcode 7.
It's a little disappointing that I won't be able to test the new APIs in iOS9 or take advantage of improvements to LLDB until this all goes stable already, at which point my feedback has much less impact.
Binary compatibility mean that the compiled code remains running, not that you can continue using old source code.
Why dont you use a a macro and ifdef