I read that
init
in Swift does not return value, then why i can write this :
var str = String.init("mystring")
The function init doesn't return you are right, but in this case, you are just making a variable equal the struct String which is initialised with "hello"
It is the same as:
var class = someClass()
The () is an init function with no arguments.
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