If you're dealing with optional Strings, this works:
(string ?? "").isEmpty
The ??
nil coalescing operator returns the left side if it's non-nil, otherwise it returns the right side.
You can also use it like this to return a default value:
(string ?? "").isEmpty ? "Default" : string!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…