Xcode 8.3 can't support Swift 2.3
It is said in release note clearly that Xcode 8.3 doesn't support swift 2.x any more. You can either choose to use wizard to update your code to swift 3.1, or go back to Xcode 8.2.1.
https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html
How can i support iOS Version 10.3 with swift 2.3 project
It's said in release note clearly that Xcode 8.3 no longer
supports Swift 2.3
version. So you need to migrate your projects containing Swift 2.3
code to Swift 3
syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.
Xcode 8 Beta 3 Use Legacy Swift issue
I have been ignoring this problem for a while now and just working on other stuff in the meantime - I finally found the solution to my problem.
Since my project is Objective-C I figured maybe one of the Pods I am using was using Swift, I checked each Pod and none of them were.
The final solution was that my Core Data model was set to generate code in Swift even though I have been manually generating them in the File > New > NSManagedObjectSubclass menu. All I had to do was switch it to Objective-C.
Use Swift 2.2 in Xcode 8?
It is not possible to use Swift2.2 in XCode8, and it is also not possible to use Swift2.3 or Swift3 in XCode3.
The best solution i found is to create a single project file that will compile for both iOS 9 (Xcode 7) and iOS 10 (Xcode 8), and that will support Swift2.2 and Swift2.3 (very similar).
What versions of Swift are supported by what versions of Xcode?
Since I've been gathering data and doing tests, I'll post my results as an updated chart in this answer:
Awhile ago, I found out that newer versions of Xcode do not, in fact, support migrating from all older versions of Swift. I did explicitly test that Xcodes 10.2 through 11 don't support Swift 3.x and earlier, so I colored those white. I've not yet had time to test Xcode 8.3 through 10.1, but I suspect they will migrate 3.x but not 2.x or earlier; that's why there's a big "Unknown" block at the top.
Sources- Manual testing with this test code: https://github.com/BenLeggiero/Swift-Version-Checker
- Xcode Release Notes
- Swift Release Notes
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift
In the navigator selection bar, click the magnifying glass, then search for "SWIFT_VERSION
" You will find the places in the project where you can adjust the swift version accordingly.
Substitute for AnyForwardCollection on Swift 3 (Xcode 8.3)
AnyCollection
is the Swift 3 equivalent to Swift 2's AnyForwardCollection
. It is a type-erased wrapper for any Collection
conforming type (i.e a type that represents a collection of elements that can be indexed through forwards and be iterated through non-destructively).
For example:
// c is an AnyCollection<Int>
var c = AnyCollection([1, 2, 3])
print(c.first!) // 1
print(c[c.index(after: c.startIndex)]) // 2
let set: Set = [4, 5, 6]
c = AnyCollection(set)
for element in c {
print(element)
}
// 5
// 4
// 6
It's worth noting that AnyCollection
's collection initialisers (for example) impose many constraints on the collection being passed. These are requirements that are expected of types conforming to Collection
to satisfy – but currently aren't able to be enforced by Collection
itself due to current inability to have where
clauses on associated types (but this will change in Swift 4).
Xcode not displaying compile errors
Besides the DerivedData
folder, also try cleaning Xcode caches completely:
rm -rf $HOME/Library/Caches/com.apple.dt.Xcode/
I would recommend also killing the SourceKit
process — always a source of issues these days! — but since you are already did a full reboot, so looks like you are good there.
If everything fails, you might consider upgrading to the latest Xcode, version 8.3. Just be aware that:
Xcode 8.3 no longer supports Swift 2.3. Please migrate your projects containing Swift 2.3 code to Swift 3 syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.
Substitute for AnyForwardCollection on Swift 3 (Xcode 8.3)
AnyCollection
is the Swift 3 equivalent to Swift 2's AnyForwardCollection
. It is a type-erased wrapper for any Collection
conforming type (i.e a type that represents a collection of elements that can be indexed through forwards and be iterated through non-destructively).
For example:
// c is an AnyCollection<Int>
var c = AnyCollection([1, 2, 3])
print(c.first!) // 1
print(c[c.index(after: c.startIndex)]) // 2
let set: Set = [4, 5, 6]
c = AnyCollection(set)
for element in c {
print(element)
}
// 5
// 4
// 6
It's worth noting that AnyCollection
's collection initialisers (for example) impose many constraints on the collection being passed. These are requirements that are expected of types conforming to Collection
to satisfy – but currently aren't able to be enforced by Collection
itself due to current inability to have where
clauses on associated types (but this will change in Swift 4).
Related Topics
Reference as Key in Swift Dictionary
Reading Currently Playing Track in MACos Using Scriptingbridge Not Working
Swift: How to Assign a Variable by Reference, Not by Value
Swift Http Request Use Urlsession
Block Scroll Down in Scrollview - Swiftui
Difference Between Force Unwrapping Optionals and Implicitly Unwrapped Optionals
Apply Vertical Alpha Gradient to Uitableview
What Is the Practical Use of Nested Functions in Swift
How to Capture Notifications in a Wkwebview
Swift Combine Sink Stops Receiving Values After First Error
Check If Class Conforms to Protocol
Trying to Stream Audio from Microphone to Another Phone via Multipeer Connectivity
How to Drag and Drop a Sprite in Swift 3.0
Swift: Second Occurrence with Indexof
Bool Being Seen as Int When Using Anyobject
How to Check the Network Speed Using Swift
Conditionally Use View in Swiftui
Swiftui: How to Implement a Custom Init With @Binding Variables