Swift version
// ๅๅ ฑ Swift ็ๆฌ
public func swiftVersion() -> String {
#if swift(>=5.5)
return ("Swift 5.5")
#elseif swift(>=5.4)
return ("Swift 5.4")
#elseif swift(>=5.3)
return ("Swift 5.3")
#elseif swift(>=5.2)
return ("Swift 5.2")
#elseif swift(>=5.1)
return ("Swift 5.1")
#elseif swift(>=5.0)
return ("Swift 5.0")
#elseif swift(>=4.2)
return ("Swift 4.2")
#elseif swift(>=4.1)
return ("Swift 4.1")
#elseif swift(>=4.0)
return ("Swift 4.0")
#else
return ("How OLD are you?")
#endif
}
another example:
#if swift(>=4.2)
print("Swift 4.2")
#elseif swift(>=4.1)
print("Swift 4.1")
#elseif swift(>=4.0)
...
#endif
Last updated