dimanche 26 février 2017

Are all brackets for if-statements and loops in Swift optional?

I'm new to swift and heard that you may put brackets but you don't have to use them in if-statements and loops.

for eachView in allSubViews {
    if (eachView is UILabel) {
        // code
    }
}

If i put brackets around the "eachView in allSubViews", my Xcode complains about it and i have to remove them :O Why? in the if-statement, it's ok with or without brackets.

Aucun commentaire:

Enregistrer un commentaire