When I open my iOS project built before the iOS 10 was released, I find it has an error about the ReactiveCocoa because of the version of swift. I try to use the method provided by Github, but it seems I failed. There are at least 18 errors when I try to convert to current swift.
There's RAC Releases for each Swift version, so if you're updating an old(er) codebase to a new version of swift, you will need to update RAC to the appropriate version.
RAC 4.x is for Xcode 7.3.x/Swift 2.2.x or Xcode 8.0.x/Swift 2.3.x
RAC 5.x is compatible with Swift 3.0 and 3.1.
RAC 6.x (not yet released) will be for Swift 3.1 with preliminary support of Swift 3.2 and Swift 4.0.
Related
I provide a Swift framework for my customers.
It would only work in Xcode 10.3 (Or am I doing anything wrong?)
For other Xcode, it does have Swift compatibility issues.
So I am planning to release a series of versions of my framework so that a customer with a particular Xcode version can have the respective framework version of mine.
And it is pretty complex. Because for every release or bug fix I need to generate a bunch of versions.
I just want validation if this is the right approach.
How do I simplify this?
The compatibility issue you have is not from the version of the Xcode, is from the Swift version of the Framework. There is a difference.
In every project you can set the Swift version, but unfortunately you can't have more than one swift version per project. The current accepted ones are Swift 4, Swift 4.2 or Swift 5, as you can see in Xcode > Target > Build Settings:
Xcode 10.0 was the last version to support Swift 3 and is currently obsolete. I wouldn't create a framework version for it.
So, I would recommend you to either focus only on the latest Swift version and create a new Framework version every time a new Swift version appears (the most common approach), or start with the current three Swift versions and give them maintenance until the Swift version is deprecated.
I keep downloading sample codes and many times it says "Unsupported Swift Version 3.x...Use Xcode 10.1 to migrate the code to Swift 4".
Why is it not possible to migrate to Swift 4 using Xcode 10.3 or Xcode 11 beta?
More importantly, I am using Swift 4.2 in my own Project that has several dependancies as well through Pods. If I don't upgrade to Swift 5.1 or later, it seems my own project would start getting such errors in Xcode 12 or so, correct? While I can convert my own code to Swift 5.1, I have no idea if dependencies such as SwiftyDropbox would migrate to Swift 5.1 so easily. What implications it would have for my project in future and what could I do to future proof my project in that case?
Ask Apple. The company has decided – certainly for good reasons – to migrate files only to the Current Swift Syntax. Feel free to create legacy system partitions with older versions of Xcode to migrate code step by step.
The grace period to update the Swift version is long enough to ensure a smooth transition. At least Xcode allows to use the 3 most recent Swift versions in the same project. However you are responsible to maintain the version control. Check the dependencies periodically for updates. If a dependency is not able to release an update within the grace period it's not much good.
I have a static library that I converter from old Swift to Swift 2.3 and later to Swift 3.0.
Now I need both version (2.3 and 3.0) of the library, but I forgot to take a backup of version 2.3. And I only have 3.0.
Is there a simple way to convert back from Swift 3.0 to Swift 2.3?
Simple, not really, but this will work.
If you don't have it, download XCode 7.3.1 from Apple
Open your library in the 7.3.1 version and correct whatever errors appear
Migrate the corrected code from step 2 into XCode 8.2 or lower (8.3 will not support Swift 2.3)
As mentioned in the comments, maintaining your code in a version control system will spare you problems like this in the future, and is generally just a good idea.
You don't even need to set up your own system, since git is part of MacOS, and XCode can handle simple git features for you.
I have 2 Xcodes in my Mac(7.3.1 & 8.1). I want to work with ReactiveCocoa so I installed it via Cocoapods and later with Carthage. And when I import later in my ViewController import ReactiveCocoa I get the next error:
Module compiled with Swift 2.3 cannot be imported in Swift 3.0: /Users/myUser/Library/Developer/Xcode/DerivedData/RAC-grddczfrbaumbtglfcuzhxyzoodk/Build/Products/Debug-iphonesimulator/ReactiveCocoa.framework/Modules/ReactiveCocoa.swiftmodule/x86_64.swiftmodule
How can I fix that? I'm already working over it over 3-4 hours and nothing
Referring to the latest documentation (github):
"This documents the RAC 5 which targets Swift 3.0.x ..."
I assume that should not install 4.x version. try to "pod 'ReactiveCocoa'" -for installing the latest version-, version 5 for targeting Swift 3.
Also, check the section "Objective-C and Swift".
Hope that helped.
If you are looking for ReactiveCocoa that supports Swift 3.0, ReactiveCocoa 5.0 alpha 1 and the master branch does not support CocoaPods yet. But the support is WIP.
In the meantime, you may try the rex-modulemap branch.
How to migrate from swift 2.2 to swift 3.0 on Xcode 8.0.
Do i need to update all the 3rd party libraries also ?
Please help !!!
Swift 2.2 unfortunately doesn't work with Xcode 8. But Apple made a good move still supporting Swift 2.3, which is basically almost the same as 2.2.
The problem is with 3rd party libraries, which must be in the same version of Swift as your project.
So, if you're using Swift 2.3, you can't use libraries, that are written in Swift 3.0.