Mit*_*oto 16 xcode ios swift xcode6.3
Xcode 6.3上的示例代码...
var str1 = ""
var str2 = ""
if str1.isEmpty ^ str2.isEmpty {
// do something.
}
Run Code Online (Sandbox Code Playgroud)
显示以下错误.
'^' is unavailable: use the '!=' operator instead
Run Code Online (Sandbox Code Playgroud)
我在Apple文档中找不到该规范.这个规范(我必须把它搞砸)?
los*_*sit 28
假设您正在尝试使用逻辑XOR,则!=应该满足您的目的.这^是一个按位异或.因此,苹果公司为了bool价值而取消了它.
rin*_*aro 11
这显然是故意的:
$ echo ':print_module Swift' | swift -deprecated-integrated-repl | fgrep "use the '!=' operator instead"
Run Code Online (Sandbox Code Playgroud)
说明:
@availability(*, unavailable, message="use the '!=' operator instead") func ^=(inout lhs: Bool, rhs: Bool)
@availability(*, unavailable, message="use the '!=' operator instead") func ^(lhs: Bool, rhs: Bool) -> Bool
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6474 次 |
| 最近记录: |