Enum사용법

작성일

struct ExampleView: View {
    var myFruit: Fruit = .Banana

    var body: some View {
        switch myFruit {
        case .Apple:
            Text("🍏🍏")
        case .Peach:
            Text("🍑🍑")
        default:
            Text("🍌🍌") // Displays 🍌🍌
        }
    }
}

enum Fruit{
    case Banana
    case Apple
    case Peach
}