I have one function where i use to pass object model. But in some case i need to pass only string. How can i do that ?
func push(destination: DestinationVC, object:NSObject?)
I have to pass one string value in object. What is did is :
self.delegate?.push(destination: NextVC, object: "message" as NSObject)
But i am passing string . Not an NSObject. What is the correct way of doing,
Any help would be great. Thanks
It works for me try this one may be it will helps you
var str : NSString = "Hello, playground"
var strObject : NSObject = str as NSObject
print(str)
print(strObject)
output: enter image description here