ざっくりとまとめていきます。随時追加予定
CFString とかが Dictionaryのキーとしてそのまま使えなくなった
let dictionary = [
...,
kCTParagraphStyleAttributeName: style
]
エラー:
'_' is not convertible to 'CFString'
修正:
let dictionary = [
...,
kCTParagraphStyleAttributeName as String: style
]
補足:
Objective-CクラスからSwiftクラスへの自動変換がされなくなったらしい。
http://stackoverflow.com/questions/29874625/dictionary-now-gives-error-not-convertible-to-booleanliteralconvertible-since
optionを指定するところで .allZeros が無くなり、 かわりに[]を渡すように
let regex = NSRegularExpression(pattern: pattern, options: .allZeros, error: nil)
エラー:
Could not find member 'allZeros'
修正:
swift
let regex = NSRegularExpression(pattern: pattern, options: [], error: nil)
// 注意: まだこれでもエラー。次項参照
補足:
RawOptionSetTypeがOptionSetTypeに置き換えられて、複合オプションの表現がビットマスクからArrayに変更になったため
&NSError を渡していたところが軒並み try catch に移行
↑の修正をしてもまだエラーがでます
let regex = NSRegularExpression(pattern: pattern, options: [], error: nil)
エラー:
Could not find an overload for 'init' that accepts the supplied arguments
修正:
do {
let regex = NSRegularExpression(pattern: pattern, options: [])
...
} catch let error as NSError {
...
}
count(), countElements() がlengthプロパティに
// swift 1.1
let count = count(text)
// swift 1.2
let count = countElements(text)
エラー:
// count()
'count' is unavailable: access the 'count' property on the collection
// countElements()
use of unresolved identifier 'countElements'
修正方法:
swift
let len = text.length
何回変わるんだ・・・