Empty String
Prefer checking isEmpty
over comparing string
to an empty string literal
- Identifier:
empty_string
- Enabled by default: No
- Supports autocorrection: No
- Kind: performance
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
myString.isEmpty
!myString.isEmpty
"""
foo==
"""
Triggering Examples
myString↓ == ""
myString↓ != ""
myString↓==""
myString↓ == #""#
myString↓ == ##""##