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
}
任何人都知道如何解决这一问题?感谢