Tyro Settings View

A button must be provided for the administrators of your POS application to access Tyro settings. Render the TyroSettingsView to allow administrators to set a mandatory refund password and to access additional settings in the future. Add this view to your application upon click of the settings button. Your POS administrators must be authenticated before this button can be accessed.

Use the TyroSettingsView SwiftUI View in your application

Copy
Copied
TyroSettingsView()

Example Usage

Copy
Copied
struct Home: View {
  @Environment(\.scenePhase) private var scenePhase: ScenePhase
  private var contentViewModel: ContentViewModel

  @State private var isSettingsPresented = false
  @State private var selectedIndex: Int = 0

  ...
 
  var body: some View {
    TabView(selection: $selectedIndex) {
      NavigationStack {
        VStack {
          HStack {
            Spacer(minLength: 0)
            Image(.tyroLogo)
              .resizable()
              .aspectRatio(contentMode: .fit)
              .frame(maxWidth: 100)
              .padding()
            Spacer(minLength: 0)
            Button(action: {
              isSettingsPresented.toggle()
            }) {
              Image(systemName: "gear")
                .renderingMode(.template)
                .resizable()
                .frame(width: 25, height: 25)
            }.fullScreenCover(isPresented: $isSettingsPresented) {
              TyroSettingsViewWrapper()
            }
          }.padding()
          ContentView(viewModel: contentViewModel)
        }.navigationTitle("")
      }.tabItem {
        Label("Home", systemImage: "house")
      }.tag(0)

      NavigationStack {
        TyroSettingsView().navigationTitle("Tyro Settings")
      }.tabItem {
        Label("Admin", systemImage: "gear")
      }.tag(1)
    }
  }
}

struct TyroSettingsViewWrapper: View {
  @Environment(\.dismiss) var dismiss
  var body: some View {
    NavigationStack {
      ZStack {
        TyroSettingsView()
      }.toolbar(content: {
        Button {
          dismiss()
        } label: {
          Image(systemName: "xmark")
        }
      })
    }
  }
}
...
Copyright © Tyro Payments 2019-2024. All right reserved.