Create basic Empty Views
- create a
UI
group (a folder) to organize our code. Rigth click onGoodHabitsRealmApp
in the file navigator and selectNew Group
- move
MainView
there- if Xcode freaks out, comment and uncomment the preview
- create
TodayView
(File > New > File or ⌘ + N, select SwiftUI View)- leave it empty, just a
Text
with "Today"
- leave it empty, just a
- create empty
ConfigView
- leave it empty, just a
Text
with "Config"
- leave it empty, just a
TodayView.swift (ConfigView.swift is quite similar)
import SwiftUI
struct TodayView: View {
var body: some View {
Text("Today")
}
}
struct TodayView_Previews: PreviewProvider {
static var previews: some View {
TodayView()
}
}
- let's use both in MainView's tabs
MainView.swift
TabView {
TodayView()
.tabItem {
Image(systemName: "calendar")
Text("Today")
}
ConfigView()
.tabItem {
Image(systemName: "wrench.and.screwdriver")
Text("Config")
}
}