aboutsummaryrefslogtreecommitdiff
path: root/iosApp/iosApp/Session/UserInformationView.swift
blob: 98d4bfde74acaa9f4d91b5b4165951aa2eb5f8be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
//  UserInformationView.swift
//  iosApp
//
//  Created by Iván on 15/02/22.
//  Copyright © 2022 orgName. All rights reserved.
//

import SwiftUI

struct UserInformationView: View {
    @Environment(\.presentationMode) var presentationMode
    @State var action = Action.account
    
    enum Action {
        case account
        case about
    }
    
    var body: some View {
        NavigationView {
            VStack {
                switch action {
                case .account:
                    AccountView()
                case .about:
                    AboutView()
                }
            }
            .navigationBarTitleView(
                Picker(selection: $action) {
                    Text("account").tag(Action.account)
                    Text("about").tag(Action.about)
                } label: {
                    EmptyView()
                }.pickerStyle(SegmentedPickerStyle())
            )
            .navigationBarTitleDisplayMode(.inline)
            .toolbar {
                ToolbarItem(placement: .navigationBarTrailing) {
                    Button {
                        presentationMode.wrappedValue.dismiss()
                    } label: {
                        Text("done").bold()
                    }
                }
            }
        }
    }
}