Структуры (записи)

@MainActor
struct Setting {
    //type property
    static var mode: Int = 0

    //type method
    static func setNextMode() {
        mode = (mode + 1) % 3;
    }
}

Setting.mode = 3
Setting.setNextMode()
//Setting.mode is 1

print("mode is \(Setting.mode)")