[SwiftUI] Sample MenuButton

Updated
Nov 22, 2019 4:11 PM
Created
Nov 22, 2019 3:41 PM
Tags
SwiftUIMemo
Keywords
Date

@State var isProduction: Bool = true
  
private var enviroment: String {
  isProduction ? "Production" : "Development"
}

MenuButton(label: Text(enviroment)) {
  Button(action: {
    self.isProduction = true
  }) { Text("Production") }
  Button(action: {
    self.isProduction = false
  }) { Text("Development")}
}