GolangHub

公众号:Golang语言开发栈

Swift2.2有哪些更新

Swift2.2有哪些更新

Swift2.2更新一:

println废弃。

如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ xcrun swift
Welcome to Apple Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29). Type :help for assistance.
1> print ("Hello Swift")
Hello Swift
2> println ("Hello World")
repl.swift:2:1: error: 'println' has been renamed to 'print'
println ("Hello World")
^~~~~~~
print
Swift.println:2:13: note: 'println' has been explicitly marked unavailable here
public func println<T>(value: T)
^

2>

Swift2.2更新二:

类型转换,String类型可以使用转换为整型。代码如下:

1
2
var str = "Hello World"
var x = Int(str)

String类型用于将其内容转换为Int类型的特殊方法toInt()已被废弃。

更多精彩内容,请关注公众号 Golang语言开发栈公众号二维码
感谢赞赏.

Welcome to my other publishing channels