xcode9 以上,黄色警告处理!

 

警告:'characters' is deprecated: Please use String or Substring directly

 

  self.characters.count

解决:

 

let edit = "Summary"
edit.count   // 

 

警报:'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator.

 

self.substring(to: self.index(of: Character(eT))!)

 

解决:

 

 

You should leave one side empty, hence the name "partial range".

let newStr = str[..<index]

The same stands for partial range from operators, just leave the other side empty:

let newStr = str[index...]

Keep in mind that these range operators return a Substring. If you want to convert it to a string, use String's initialization function:

let newStr = String(str[..<index])

You can read more about the new substrings here.

 

你可能感兴趣的:(IDE运行问题)