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

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift