Newer Older
41 lines | 1.276kb
Bogdan Timofte authored 2 weeks ago
1
//
2
//  ControlView.swift
3
//  USB Meter
4
//
5
//  Created by Bogdan Timofte on 09/03/2020.
6
//  Copyright © 2020 Bogdan Timofte. All rights reserved.
7
//
8

            
9
import SwiftUI
10

            
11
struct ControlView: View {
12

            
13
    @EnvironmentObject private var meter: Meter
14

            
15
    var body: some View {
16
        HStack {
17
            VStack {
18
                HStack {
19
                    Button(action: { self.meter.rotateScreen() }, label: { Image(systemName: "arrow.clockwise") })
20
                }
21
                HStack {
22
                    Button(action: { self.meter.previousScreen() }, label: { Image(systemName: "arrowtriangle.left") })
Bogdan Timofte authored 2 weeks ago
23
                    Text(meter.currentScreenDescription)
Bogdan Timofte authored 2 weeks ago
24
                    Button(action: { self.meter.nextScreen() }, label: { Image(systemName: "arrowtriangle.right") })
25
                }
Bogdan Timofte authored 2 weeks ago
26
                if !meter.reportsCurrentScreenIndex {
27
                    Text("This protocol supports page navigation, but not current-page reporting.")
28
                        .font(.footnote)
29
                        .foregroundColor(.secondary)
30
                        .multilineTextAlignment(.center)
31
                }
Bogdan Timofte authored 2 weeks ago
32
            }
33
        }
34
    }
35
}
36

            
37
struct ControlView_Previews: PreviewProvider {
38
    static var previews: some View {
39
        ControlView()
40
    }
41
}