Type 'String' does not conform to protocol 'SequenceType' - Swift 2.0

后端 未结 2 1640
情深已故
情深已故 2021-01-13 07:26

I\'m trying to reverse string in Swift 2.0 but I get an error on the string ifself.

func reverseString(string: String) -> String {
    var buffer = \"\"
          


        
2条回答
  •  旧时难觅i
    2021-01-13 08:15

    As of Swift 2, String doesn't conform to SequenceType.

    You can add an extension.

    extension String: SequenceType {}
    

提交回复
热议问题