jjaeko
jjaeko

Reputation: 235

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

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

Is this to distinguish whether only nil?

Upvotes: 3

Views: 190

Answers (1)

Mike Pollard
Mike Pollard

Reputation: 10195

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

()? is the optional version of that.

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

Upvotes: 6

Related Questions