Check if object is a string

 Problem

I have an object and want to check if it's a String object



 Recipe


// String literal
let s = "Hello World"

// Check if 's' is a String

if s is String {
    print("Yes, it's a String")
}
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground