I've downloaded Xcode 9 Beta 4 to fix a problem I have on my app in iOS 11.
However now Xcode won't let my build my app because Realm (and RealmSwift) are in Swift 3.1 and not 3.2.
Here is the message :
Module compiled with Swift 3.1 cannot be imported in Swift 3.2
I don't use CocoaPods or Carthage. Do you know how can I solve this issue ?
Make you selected command line tools for Xcode 9. You can find it Preferences -> Locations -> Command Line Tools.
Then clean your project and build again. Should work.
Related
I have just upgraded from xcode 10.1 to xcode 11.2.1. Now whenever I open my existing project in xcode 11.2.1 which was built in swift 3.0 it shows me "Unsupported Swift Version".
Please anyone can give me a brief description about it.
You cannot run swift 3 on Xcode 11. Download a version of XCode 10.1,You can run both.There will be option to migrate code to swift 4.
here you can download XCode 10.1:
XCode 10.1
Please check this link below. You can upgrade to swift 4.
https://medium.com/#hanif.awan2007/tips-upgrading-your-code-from-swift-3-to-swift-4-dbcba128b48b
You have a guide on official documentation:
https://swift.org/migration-guide-swift4/
First check you build settings:
You have an option "Swift language version" change this to swift4.
Then, try to compile and fix your warns / errors. Most of them can be automatically fixed by xcode.
If you got some pod dependencies, update it.
Go to project navigator> Build Settings. search for swift Compiler - Language and change this to desired version.
I want to use Hero framework. I don't get any pod command from their documentation. I have used pod "Hero". It's worked but after installing and downloading pod when try to open project it says
Xcode 9 does not support building or migrating Swift 2.x targets"
How can i solve this?
You can find the pod installation section in their documentation here.
If the process not work you try to read more...
This error means that XCode 9 does not offer any solution to migrate from Swift 2 to 4.
In fact into Build Setting you can switch from Swift 3.2 or 4.
You can try to open the project with XCode 8 firstly (that support Swift 2) and then after converting the library to Swift 3, reopen the project with XCode 9.
I'm using Swift 2.3 on Xcode 7.3.1 and when in AppDelegate I'm trying to import
import UserNotifications
it gives me the error that "No such module UserNotifications". What is the problem and how can I fix that?
I've tried to run it on Xcode 8 with defined SWIFT_VERSION = 2.3, but I get a lot of errors in Alamofire framework, but I set inside of Alamofire swift version, too. So I decided to continue working on Xcode 7.
So, is it because of Xcode versions or I can fix that on Xcode 7, too? My target iOS is 10. I copied inside of supported platforms 10.2 folder, so I can run on iOS 10 device from Xcode 7
You can't simply mix swift2.3 and swift3 in a single project within single target and this is also not a recommended approach.
The error which you are getting is due to UserNotifications framework. This framework has been added in xcode8 so you can't use this framework in xcode7.3.1 .
Also if you are planning to use swift2.3 in Xcode 8 then you have to use Legacy Swift Version if you made it yes then you will be able to run your project which is in swift2.3, but you will be not able to use syntax of swift3.
TO open swift 2.3 project in xcode 8, you have to on legacy form build setting for target and alamofire both.
I'm using Xcode 7.3 but my project is in Swift 2.1. I don't want to update my codes right now. So how can I choose or download older version of Swift compiler? Many thanks in advance!
The following example is tested on Xcode 8.3 with swift 3.1
If you are using Xcode 8 you can download toolchains with needed Swift versions
1) Open this link:
https://swift.org/download/#releases
2) Download Toolchain with swift version that you need. For example I have 3.1 version of swift and downloaded swift 3.0.2
3) Open .pkg file and install it.
4) Open Xcode and select in menu:
Xcode -> Toolchains -> Select Swift Version you need.
That is all folks
Originally I posted this is a comment, but I should have just posted it as an answer:
If you're writing an app for the App Store, you can only use a release (non-beta) version of Xcode (see “Submitting Apps to the App Store using Xcode”) and the toolchain supplied with that version of Xcode (see “Using Downloads / Apple Platforms”). So you can either use Xcode 7.2 and continue using Swift 2.1, or you can use Xcode 7.3 and update your code to Swift 2.2.
You can have multiple versions of Xcode installed. You can keep Xcode 7.2 installed and use it for your non-updated Swift 2.1 projects, and use Xcode 7.3 on new projects. Note that you'll have to manually open each project in the appropriate version of Xcode. You can download old versions of Xcode here.
If you're not going to put your app in the App Store, then maybe you could extract the Swift 2.1 toolchain from the Xcode 7.2 bundle and turn it into a .xctoolchain for use with Xcode 7.3, but you're really in unexplored, unsupported territory if you go that route.
If you're following the answers involving a .xctoolchain combined with Xcode 9 beta you'll encounter an error similar to this:
<unknown>:0: error: unknown argument: '-index-store-path' Command /Library/Developer/Toolchains/swift-3.1.1-RELEASE.xctoolchain/usr/bin/swiftc failed with exit code 1
The reason is that Apple has added a new feature/argument, which hasn't made its way to open source Swift yet. You can get around this issue by launching Xcode from the command line with the feature disabled like this:
/path/to/Xcode-beta.app/Contents/MacOS/Xcode -IDEIndexEnableBoltIndex NO
Thanks to the Swift team
Xcode 9 - Xcode 10
Select your target, then in your Build Settings, search for "swift language" and then you will find Swift Language Version.
I have a project that I've been working on with my friend on Swift 1.1/1.2.
Unfortunately, when I upgraded my Xcode to the latest version, I noticed that the app will no longer compile and there are lots of errors.
Is there a way for Xcode 7 to compile for Swift 1.2?
If not, how do I get the old version of Xcode which does not use Swift 2?
Is Swift 2 app backward compatible with Swift 1 apps?
Can Swift 1.2 app run on iOS 9?
Are most developers using the Swift 2 now or not?
In Xcode start with Edit->Convert->To Latest Swift Syntax...
You may still have errors that you will have to resolve manually. Read the Xcode Release Notes to see what changed in Swift 2.