How to check the string is Nil or Not and
Solution:
The function will return empty string if your variable contains nil value otherwise it will returns its value.
func noNilString(string: AnyObject?) -> String {
if let category = string as? String {
return category
} else {
return ""
}
}
Comments
Post a Comment