Subscript ‘subscript(_:)‘ requires that ‘String.Index‘ conform to ‘RangeExpression‘

Subscript ‘subscript(_😃’ requires the types ‘String.Index’ and ‘Int’ be equivalent

解决如下:

 let index: String.Index = contentStr.index(contentStr.startIndex, offsetBy: i)
 btn.setTitle(""+contentStr[index...index], for: .normal)
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页