Is there a way to check strings for nil and \"\" in Swift? In Rails, I can use blank() to check.
I currently have this, but i
In my opinion, the best way to check the nil and empty string is to take the string count.
var nilString : String?
print(nilString.count) // count is nil
var emptyString = ""
print(emptyString.count) // count is 0
// combine both conditions for optional string variable
if string?.count == nil || string?.count == 0 {
print("Your string is either empty or nil")
}