対処法: count is unavailable: access the count property on the collection. Type String doesn’t conform to protocol CollectionType [Swift2.2]

Swift 6での書き方

現在は文字列のcountプロパティを使うよ。

以下はSwift 2.2当時の記録

Swift2.0にしたら出たエラー。

Swift2.0で文字列の長さを出すには、書き方が変わってるよ。

 

出たエラー

count is unavailable: access the count property on the collection. Type String doesn’t conform to protocol CollectionType

 

Swift1.2まで

 

 

Swift2.0から

 

これでおk

 

参考: How can I get the length of a String in Swift 2.0?

スポンサーリンク
スポンサーリンク
タイトルとURLをコピーしました