経緯
Objective-CのコードをSwift2で書き直していた時に少しハマったのでメモ
Objective-CとSwift1.2以前での指定方法
Objective-CやSwift1.2では以下のように指定していました。
UIView *view = [[UIView alloc]init];
view.autoresizingMask
= UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
swift1.2
let view = UIView()
view.autoresizingMask = .FlexibleWidth | .FlexibleHeight
Swift2.0での指定方法
それがSwift2.0では以下の様な指定方法になりました。
swift2.0
let view = UIView()
view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
参考
stack overflow(http://stackoverflow.com/questions/30867325/binary-operator-cannot-be-applied-to-two-uiviewautoresizing-operands)