LoginSignup
7
6

More than 5 years have passed since last update.

Xcode9.1で'characters' is deprecated: Please use String or Substring directlyのワーニングが出るようになった

Posted at

概要

Xcode9.1に上げた際に以下のワーニングが出た

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

image.png

結論

警告通り、charactersでなく直接Stringのメソッドを利用

-            .map { _ in self.nameField.text!.characters.count != 0 }
+            .map { _ in self.nameField.text!.count != 0 }

補足

ずっと言われていたけど対応してなくて、Xcode9.1で警告が出るようになってSwiftLintに怒られて対応しました:innocent:

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6