Is Xcode9 compatible with Swift 3 (or 3.1)?

I just started using Xcode9 (beta2). I realized that this would not force me to immediately change my code. However, I am getting build errors with the library I am using (Gloss):

1) For the following code:

public func valueForKeyPath(keyPath: String, withDelimiter delimiter: String = GlossKeyPathDelimiter, logger: Logger = GlossLogger()) -> Any? {

      

I get:

The initializer 'init ()' is internal and cannot refer to the default argument value

2) For this code:

internal func flatMap<KeyPrime : Hashable, ValuePrime>(_ transform: (Key, Value) throws -> (KeyPrime, ValuePrime)?) rethrows -> [KeyPrime : ValuePrime] {
    return Dictionary<KeyPrime,ValuePrime>(elements: try flatMap({ (key, value) in
        return try transform(key, value)
    }))
}

      

I get:

The closure parameter tuple '(key: _, value: _)' does not support destructuring

Both of these did not cause problems with Xcode 8.3 / Swift 3.1.

I am using Xcode9 with no option to upgrade to Swift 4. There are several possibilities:

  • There are several flags that need to be set to keep Swift 3.1 backward compatible.
  • Xcode9 is in beta and just not completely ready
  • Xcode9 will not be fully backward compatible with Swift 3.1

Thoughts?

+3


source to share


2 answers


Xcode 9 is cross compatible with Swift 3 and 4. However, you need to be in Swift 3.2, which is the minimum for Xcode 9.



+1


source


You can find a list of languages โ€‹โ€‹supported by a specific Xcode from Build Settings

your Xcode project.

Here is an example link, as you can see it:

(for Xcode 9, it supports Swift 3.2 and Swift 4.0)



enter image description here

Here is a reference answer how you can easily switch from Swift 3.0 to 4.0

0


source







All Articles