I have a function that returns AnyObject?
func aFunction(param:String) -> AnyObject?
How do I cast it to a String? and String
Try this:
if let result = aFunction("test") as? String {
// Here, `result` is String
println(result)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With