Group Group Group Group Group Group Group Group Group

. notation in Xcode

I dont understand why .white and .normal need a dot, what its means can someone explain ?

func updateUI() {
    if lightOn {
        view.backgroundColor = .white
        lightButton.setTitle("On", for: .normal)
    } else {
        view.backgroundColor = .black
        lightButton.setTitle("Off", for: .normal)
    }
}

@edwin001 Thanks very much for your question! The .notation means that those values are actually enum values. When referencing an enum value, you would use the dot (.) value.

Here is an article that discusses ENUMS and other topics in more detail:

Enums, Structs, and Classes in Swift

I hope this helps :slight_smile:

All the best!

This topic was automatically closed after 166 days. New replies are no longer allowed.