Hi!
So...
I’ve currently been working on an app, well an recipes app. I’ve currently created a TabBarView.swift where the code for the TabBar itself is an alone code, that’s what i think. Anyway, i wanna know how i can create separate SwiftUI (Files or View) for each page itself. Like for example when i press the home button on the TabBar i want to be able to create the content that’s gonna be in home, in a different file, so i easily can organize things, by category of the app, is that possible?
Im happy to share the code so you can understand it better on how to fix my problem.
Hope I understand your problem…
Just create a New file in the project in Xcode (Fle > New > File), and select SwiftUIView Name it MySwiftUIView
Adapt the template code to what you want to present:
import SwiftUI
struct MySwiftUIView: View {
var body: some View {
Text("Hello, World!")
}
}
struct MySwiftUIView_Previews: PreviewProvider {
static var previews: some View {
MySwiftUIView()
}
}
Then, call it in the tabbar:
TabView {
MySwiftUIView()
.tabItem {
Label("MyView", systemImage: "list.dash")
}