USB-Meter / USB Meter / Views / ContentView.swift
Newer Older
45 lines | 1.099kb
Bogdan Timofte authored 2 months ago
1
//
2
//  ContentView.swift
3
//  USB Meter
4
//
5
//  Created by Bogdan Timofte on 01/03/2020.
6
//  Copyright © 2020 Bogdan Timofte. All rights reserved.
7
//
8

            
9
//MARK: Bluetooth Icon: https://upload.wikimedia.org/wikipedia/commons/d/da/Bluetooth.svg
10

            
11
import SwiftUI
12

            
13
struct ContentView: View {
Bogdan Timofte authored a month ago
14
    #if os(iOS)
15
    private static let isPhone: Bool = UIDevice.current.userInterfaceIdiom == .phone
16
    #else
17
    private static let isPhone: Bool = false
18
    #endif
19

            
Bogdan Timofte authored 2 months ago
20
    var body: some View {
Bogdan Timofte authored a month ago
21
        if Self.isPhone {
22
            navigationViewPhone
23
        } else {
24
            navigationViewPad
25
        }
26
    }
27

            
28
    @ViewBuilder
29
    private var navigationViewPhone: some View {
30
        NavigationView {
31
            SidebarView()
32
                .navigationBarTitle(Text("USB Meters"), displayMode: .inline)
33
        }
34
        .navigationViewStyle(.stack)
35
    }
36

            
37
    @ViewBuilder
38
    private var navigationViewPad: some View {
Bogdan Timofte authored 2 months ago
39
        NavigationView {
Bogdan Timofte authored 2 months ago
40
            SidebarView()
41
                .navigationBarTitle(Text("USB Meters"), displayMode: .inline)
Bogdan Timofte authored 2 months ago
42
        }
Bogdan Timofte authored a month ago
43
        .navigationViewStyle(.columns)
Bogdan Timofte authored 2 months ago
44
    }
Bogdan Timofte authored 2 months ago
45
}