Skip to content

empty_string

Ian Applebaum edited this page Jun 13, 2020 · 1 revision

Empty String

Prefer checking isEmpty over comparing string to an empty string literal.

  • Identifier: empty_string
  • Enabled by default: Disabled
  • Supports autocorrection: No
  • Kind: performance
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning

Non Triggering Examples

myString.isEmpty
!myString.isEmpty
"""
foo==
"""

Triggering Examples

myString == ""
myString != ""
Clone this wiki locally