Is it more correct to think that it can be used from the N version of the SDK than from the N version of Swift?

Asked 1 years ago, Updated 1 years ago, 47 views

CaseIterable comes online when you can use it from Swift 4.2.But I feel like I'm working on Swift4

As I asked you in , I found that the one introduced to be available from the N version of Swift can actually be used in the less than N version of Swift.

Based on the Swift version, I don't think it's a factor that determines whether it can be used or not.Even if I talk to my development colleagues, I get confused.

Actually
https://developer.apple.com/documentation/swift/caseiterable#overview
I was wondering when I was watching

SDK

Xcode 10.0+ Framework

Swift Standard Library

is described as

This is

Am I correct in understanding that CaseIterable can be used in Xcode 10.0 or higher?
If this interpretation is acceptable, you don't have to be aware of the Swift version.

swift

2022-09-30 21:37

1 Answers

It's not a very bright and clear answer, but
Maybe it's because of version compatibility and a mix of compiler and target versions.
https://docs.swift.org/swift-book/GuidedTour/Compatibility.html#

Xcode 10.0 comes with the swift compiler 4.2 and its swift standard library, which will allow you to compile the code in Swift3 mode. Whether or not any version of XCode (or the Switch compiler) can be compiled in swift3 mode is another story.
Even though it's called swift3 mode, if you actually compile 4.2 in swift3 mode, the version is swift3.4, and

as shown in the previous link.
you can use conditional compilation blocks like #if swift(>=3.4) to write code that's 
compatible with multiple versions of the Swift compiler.

If you do not specify a compiler version, you may not be able to compile with the old compiler.
(Maybe XCode 9.2 can compile Swift4 code as described in Compatibility above)

I think it depends on the situation in which you use the word "useful."
If you're using XCode 10 and you're talking about Swift 4.2, you can say that you can use it in any situation.
I think it's certain that we can talk about the XCode version, but it's difficult because we often talk about the swift version.

You may also find it helpful to specify which version of the swift compiler you will specify in the compiler version directive.

https://github.com/apple/swift-evolution/blob/master/proposals/0212-compiler-version-directive.md


2022-09-30 21:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.