I am converting my code to swift 4 but xCode is giving me below error.
what could be reason , current swift version is 3.2
As mentioned in the dialog, you need to successfully build your project first before migrating to swift 4
Related
Currently I am using Xcode 7.3 with Swift 2.3 . I received a message from Facebook Audiance Network that the SDK is going to be out dated and Ad will stop showing if I don't update the latest SDK (4.25 +). For that it needs minimum Xcode version 8 or higher.
These are the libraries in my pod file .
Alamofire
Side menu
Drop Down
Stripe
I need to change these libraries according to latest Swift syntax. So should I convert it first into Swift 3 or direct move into Swift 4 ?
I have a project I am trying out which is fine in Xcode 8. However, in Xcode 9 the RxSwift framework won't import into the playground. I get the following error
Module compiled with Swift 3.1 cannot be imported in Swift 4.0:
/Volumes/HGST3tb/CloudStation/Development/Frameworks/GuideView/GuideView/Carthage/Build/tvOS/RxSwift.framework/Modules/RxSwift.swiftmodule/x86_64.swiftmodule
All frameworks apart from RxSwift are swift 3.2 but the error seems to imply that the playgrounds are compiled with 4.0. I can't see any settings to be able to change this.
From how I interpret Apple's documentation, it should be possible. I believe that Xcode 9 compiles in Swift 4.0 regardless though and just supports the backwards compatibility.
One compiler for Swift 4 and Swift 3, Swift 4 and Swift 3 targets can
be compiled together in the same project.
Referencing this similar question you should try Shift+Command+K to clean your project. Unfortunately, I've been having cross-compatibility issues on things that should work too, though.
We have big enough project which is built up with Swift 2.x and now Apple has just released Swift 4 so to move forward for latest version of Swift which path we can choose...
Do we need to migrate our code to Swift 3 first? Or we can directly migrate our code to Swift 4 using Xcode 9?
Yes, you must migrate your code in Swift 3 compatible version. Xcode 9 allows conversion/migration from swift 3.0 only.
Swift 3.2 is supported by Xcode 9 & Xcode 8 both.
Convert your source code from Swift 2.0 to 3.2 using Xcode 8 and then continue with Xcode 9 (Swift 3.2 or 4).
For easier migration of your code, follow these steps: (it will help you to covert into latest version of swift supported by your Xcode Tool)
(Xcode) Menus: Edit ► Covert ► To Current Swift Syntax
Yes, you first need to migrate your code from Swift 2 to Swift 3, using Xcode 8.
Xcode 8 is the last version to support Swift 2.
Starting with Xcode 9, the supported Swift versions are 3.2 and 4
Yes, you need old versions of Xcode . Old version are available here https://developer.apple.com/download/more/
I have my playground project written in Swift 2.2 and I want take advantage of timeline visuals and try new debug features introduced in Xcode 8 beta. By default, Xcode 8 beta is using Swift 3 in Playgrounds and I cannot find a way to change that. Updating my code to Swift 3 is not an option unfortunately, because my code will be compiled on server with Swift 2.2 environment.
Unfortunately, according to Apple it is impossible:
For instance, Playgrounds in Xcode only work with Swift 3, and notably the Swift Playgrounds app for iPad also uses Swift 3. Xcode project templates all use Swift 3, and all documentation is presented in a format appropriate for Swift 3.
More here.
You can convert your Swift 2.2 to Swift 2.3 for use in Xcode-beta 8.
Yes, Swift 3 is the default, but you get the following dialog when you do Edit > Convert > To Current Swift Syntax... in Xcode.
This also created an entry in my project.pbxproj for SWIFT_VERSION = 2.3
I have a legacy playground (created using xcode 7) in a project that I've migrated to Swift 2.3 syntax on XCode 8 and my playground work even if it's still using Swift 2.3 syntax, so I guess there is a way.
I have start to develop my App with Xcode 6, if i update to Xcode 7, my App will work as well?
(Swift 1.2 to Swift 2.0)
(I used Swift 1.2 to code my App with Xcode6.)
Thanks
Everything will work fine, in Xcode 7 just do the following to convert from swift 1.2 to 2.0, From Xcode menu go to:
Edit> Convert > to Latest Swift Syntax.
Good luck !
Yes, your app will work but you will need to change some syntax for that.
For change code automatically when it's possible you can do this :
Edit >> Convert >> To Latest Swift Syntax...
If it may helps you, see what's change in new version : swift 2