Structures type members in Swift
Forums:
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
- Log in to post comments