Mixonomer-iOS/Mixonomer/Views/AppSkeleton.swift

65 lines
1.4 KiB
Swift
Raw Normal View History

2020-02-16 18:47:09 +00:00
//
// AppSkeleton.swift
2022-08-07 13:31:15 +01:00
// Mixonomer
2020-02-16 18:47:09 +00:00
//
// Created by Andy Pack on 16/02/2020.
// Copyright © 2020 Sarsoo. All rights reserved.
//
import SwiftUI
import Alamofire
import SwiftyJSON
2020-02-16 18:47:09 +00:00
struct AppSkeleton: View {
@EnvironmentObject var liveUser: LiveUser
@State private var selection = 0 // Tab view selection
2020-02-16 18:47:09 +00:00
var body: some View {
TabView {
PlaylistList()
.tabItem {
VStack {
Image(systemName: "music.note.list")
Text("Playlists")
}
}
.tag(0)
TagList()
.tabItem {
VStack {
Image(systemName: "tag")
Text("Tags")
}
2020-02-16 18:47:09 +00:00
}
.tag(1)
SettingsList()
.tabItem {
VStack {
Image(systemName: "slider.horizontal.3")
Text("Settings")
}
}
.tag(2)
}.onAppear {
self.fetchAll()
2020-02-16 18:47:09 +00:00
}
}
private func fetchAll() {
self.liveUser.refreshPlaylists()
self.liveUser.refreshTags()
}
2020-02-16 18:47:09 +00:00
}
struct RootView_Previews: PreviewProvider {
2020-02-16 18:47:09 +00:00
static var previews: some View {
AppSkeleton()
2020-02-16 18:47:09 +00:00
}
}