Suppose I have String like :
var abc : NSString = \"ABC\"
and I want to check that it is nil or not and for that I try :
if
Swift 4.2
func isValid(_ object:AnyObject!) -> Bool { if let _:AnyObject = object { return true } return false }
Usage
if isValid(selectedPost) { savePost() }