Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What (()?) and ()? means in swift?

var aa: (()?) = (john.residence?.address = someAddress)
var bb: ()? = john.residence?.printNumberOfRooms()

Is this to distinguish whether only nil?

like image 335
jjaeko Avatar asked Dec 17 '25 18:12

jjaeko


1 Answers

() is the empty tuple type (same as Void).

()? is the optional version of that.

(()?) is a tuple containing the type ()? so reduces to just ()?

like image 171
Mike Pollard Avatar answered Dec 19 '25 14:12

Mike Pollard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!