1
我有文字指示碼其工作良好,快捷3,但遷移到SWIFT 4後,我得到了錯誤類型的值「NSLinguisticTag」沒有成員「範圍」
let tagScheme = [NSLinguisticTagScheme.language]
let tagger = NSLinguisticTagger(tagSchemes: tagScheme, options: 0)
tagger.string = self.text
let lang = tagger.tag(at: 0, scheme: NSLinguisticTagScheme.language,
tokenRange: nil, sentenceRange: nil)
if lang?.range(of: "he") != nil || lang?.range(of: "ar") != nil { //Value of type 'NSLinguisticTag' has no member 'range'
self.textAlignment = NSTextAlignment.right
} else {
self.textAlignment = NSTextAlignment.left
}
任何人都知道如何解決這一問題?感謝