How do I check if an optional string object is neither empty string "" nor nil in Swift4? I end up having to write weird checks like these, because
//object has instance variable
var title: String?
//invalid comparison - cannot compare optional and non optional
if object.title?.count > 0
{
}
//valid but ugly
if object.titleString == nil {
//has nil title
}
if let title = object.title
{
if title.count == 0
{
//has a "" string
}
}