I believe there should be an easier way than .lowercase() to compare 2 Strings without caring about the case.
Unless I missed something, we don't have isEqualToString: in Foundation with an option for the case.
The best String could have would be an operator like ~=, but at least a method (.e.g. isEqual(caseSensitive: Bool). That one reads very long and the true version barely makes any use case.
Maybe you are my opinion though that this doesn't read awesome.
Fair ’nuff.
As you contemplate improving that, keep in mind that case-insensitive comparisons only really make sense in the context of a locale. Consider:
import Foundation
let s = "I"
let sEN = s.lowercased(with: Locale(identifier: "en_AU"))
let sTR = s.lowercased(with: Locale(identifier: "tr_TR"))
print(sEN) // prints: i
print(sTR) // prints: ı
The character in the second example is U+0131 LATIN SMALL LETTER DOTLESS I. If you search the ’net for turkish lowercase bug you’ll find an explanation of what’s going on here.