Wrong version of swift - xcode

How can I run swift 2.1?
I have Xcode 7.0.1 installed but when I run swift in the terminal,
I getting version 2.0.
> swift -v
Apple Swift version 2.0 (swiftlang-700.0.59 clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
/Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-target x86_64-apple-darwin14.5.0 -enable-objc-interop -sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -color-diagnostics"
Welcome to Apple Swift version 2.0 (700.0.59 700.0.72). Type :help for assistance.
I thought Xcode7 included swift 2.1

See the Wikipedia article on Xcode § Toolchain Versions.
In the table, it says that Xcode 7.0 includes Swift 2.0.
The first version of Xcode to include Swift 2.1 is version 7.1.
You will have to update Xcode from the App Store.

Related

I can't upgrade Xcode. What can I do?

I have Xcode version 8.3
macOS: 10.12.6 (I can´t upgrade)
rect-native: 0.59.5
watchman: 4.9.0
I can't upgrade because my Mac is too old and the project that comes with the react native is for the new version of Xcode.
What can I do?
All this is because I can´t program in react-native that is not compatible white Xcode 8 the new version and I can´t use and oldest version.
I have looked for previous versions I downloaded from Github. RN Version 0.55.4 there says that is for Xcode 8.3 but that doesn't work.
how do you program?
You can download any previous or current version (from 7.0 up to 10.2) of XCode using links, listed here:
https://stackoverflow.com/a/46652775/10556960
You will need to sign in with your Apple Developer account at developer.apple.com, tho.
According to Xcode Releases, the latest Xcode that runs on macOS 10.12.6 is Xcode 9.2.

Swift 3.0.1 support of SwiftyJSON framework

Does SwiftyJSON support Swift version 3.0.1?
The swift-version file states the version 3.0.
Need to know whether it supports swift 3.0.1 or not.
It doesn't work because it has to be compiled with Xcode 8.1, if you use carthage you do carthage update --platform <yourPlatform> --no-use-binaries
For more information look at this thread

xcode 8 beta Alamofire compiler errors after pod update to 3.4.1

I have downloaded a legacy swift app using git and run pod update. After git add -A, I open the workspace using xcode 8 beta then Product -> Clean and build I get 40 swift compiler Alamofire errors. I have not run convert o swift 2.3 or swift 3.
Podfile.lock has version 3.4.1 for Alamofire.
in Podfile I set the version to ios 10.0 and in Alamofire info also set infoDictionary version to 10.0 but it made no difference.
Mostly they are syntax errors like NSURL needs to be renamed URL, etc.
I can't find any answers to this problem with Google.
Xcode 8 compiles against the iOS 10 SDK. This differs slightly from the iOS 9 SDK and thus the errors. You won't be able to use Xcode 8 with Swift 2.2 code.
If you look at the Alamofire branches, https://github.com/Alamofire/Alamofire/branches, you'll see work on 2.3 and 3.0 compatibility.
Also, read this thread for details on how to use those branches: https://github.com/Alamofire/Alamofire/issues/1312.

Where are the swift/swiftc binaries for v3?

I've just downloaded the Xcode 8 beta, and am struggling to figure out where the swift and swiftc binaries are hidden.
The Swift website says that the toolchain should be available at /Library/Developer/Toolchains and that it can be exported for use on command line with:
$ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
But that path doesn't seem to exist for me.
I can see Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain, but that's for 2.3 rather than 3.
Any ideas?
Thanks to Marc B's suggestion:
⇒ find / -name swift -type f
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
/Users/myusername/Desktop/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/bin/swift
/Users/myusername/Desktop/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
/usr/bin/swift
Which for me are:
⇒ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --version
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
⇒ /Users/myusername/Desktop/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/bin/swift --version
Apple Swift version 2.3 (swiftlang-800.10.6 clang-800.0.24.1)
Target: x86_64-apple-macosx10.9
⇒ /Users/myusername/Desktop/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --version
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)
Target: x86_64-apple-macosx10.9
⇒ /usr/bin/swift --version
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
To set v3 as your 'main' swift, you can do the following (make sure to use the right path to your Xcode 8 application):
⇒ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
⇒ xcrun --find swift
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
⇒ swift --version
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)
Target: x86_64-apple-macosx10.9
As Arsen notes in Run Swift 3 from command line using Xcode 8 Beta, you can also change the settings through the Xcode menu directly. Just follow Xcode > Preferences > Locations > Command Line Tools. Then switch the drop down list from Xcode 7.3.1 to Xcode 8.0. Then enter your password for admin privileges. However, for scripting, xcode-select is the most useful answer.
http://i.stack.imgur.com/Nzi3q.png

What is the latest version of xcode I can use on 10.6.8?

What is the latest version of xcode I can use on 10.6.8? Is there any way to download it? I currently have the first version of xcode 4 (i.e. not even 4.2)
Can i upgrade?
It's xcode 4.2, you can download it in the dev center but you won't be able to use any newer version than that on snow leopard.
Xcode 4.2 Snow Leopard
4.2 for snow leopard seems to not be available any longer. 3.2.6 is
http://adcdownload.apple.com/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg
You can learn more from this:
What is the compatible IOS and XCODE for MAC 10.6.8?

Categories

Resources