Swift 1.2(Xcode 6.3)删除了布尔值的xor'^'运算符? [英] Swift 1.2 (Xcode 6.3) removed xor '^' operator for Bool value?
本文介绍了Swift 1.2(Xcode 6.3)删除了布尔值的xor'^'运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此示例代码在Xcode 6.3上...
This sample code on Xcode 6.3 ...
var str1 = ""
var str2 = ""
if str1.isEmpty ^ str2.isEmpty {
// do something.
}
显示以下错误.
'^' is unavailable: use the '!=' operator instead
我在Apple文档中找不到规范. 是这个规范(我必须把它统统包起来)吗?
I cannot find the spec in Apple documentation. Is this specification (and I'll have to lump it)?
推荐答案
这显然是故意的:
$ echo ':print_module Swift' | swift -deprecated-integrated-repl | fgrep "use the '!=' operator instead"
显示:
@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
这篇关于Swift 1.2(Xcode 6.3)删除了布尔值的xor'^'运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文