Last active
July 2, 2018 15:33
-
-
Save tikidunpon/e80024534564a50884ec78211c5f4d9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 以下サイトの4.1.2RELEASEで動きます。 | |
// http://online.swiftplayground.run/ | |
import Foundation | |
enum ViewMode: Equatable { | |
case normal | |
case createPosition(CGPoint) | |
case editMode | |
var isCreatePosition: Bool { | |
switch self { | |
case .createPosition: | |
return true | |
default: | |
return false | |
} | |
} | |
} | |
let current: ViewMode = .normal | |
let next: ViewMode = .createPosition(.zero) | |
// 普通にswitchではだめ? | |
switch next { | |
case .createPosition: | |
print("is create Position") | |
default: | |
print("is not createPosition") | |
} | |
// それかcomputed property化? | |
if !next.isCreatePosition { | |
print("is not createPosition") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これも良さそう