Inna Black
Inna Black

Reputation: 251

Swift3: if let where statements

I have an if let statement with a where clause in Swift2 but the syntax is not correct for Swift3.

if let car = createCar(), let color = car.color where color == UIColor.redColor() { }

How do you convert this code to Swift3?

Upvotes: 2

Views: 6056

Answers (1)

Jans
Jans

Reputation: 11250

The problem is actually in the statement, neither swift2 nor swift3 will accept it, the right for swift3 is:

if let car = createCar(), car.color == UIColor.red { }

Upvotes: 14

Related Questions