I get that a wrapped optional is more secure in that you can't just modify the data contained inside without unwrapping it, but, is there any benefit outside of that to using a wrapped optional as opposed to just using an unwrapped optional. From my perspective at the minute doing
var name:String = ""
vs
var name:String!
is creating two variables, both of which can be modified in pretty much the same way, but
var name:String?
Seems to be just adding a extra step only to have to unwrap it to change it at a later date.
Also, I am new to learning swift.
So, what reason would you choose to use a wrapped optional over an unwrapped optional
var name:String = ""
vs
var name:String!
is creating two variables, both of which can be modified in pretty much the same way, but
var name:String?
Seems to be just adding a extra step only to have to unwrap it to change it at a later date.
Also, I am new to learning swift.
So, what reason would you choose to use a wrapped optional over an unwrapped optional