74 lines
2.1 KiB
Swift
74 lines
2.1 KiB
Swift
//
|
|
// HomeView.swift
|
|
// tg_test
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct HomeView: View {
|
|
private let sampleItems = [
|
|
"Getting Started with SwiftUI",
|
|
"Understanding NavigationStack",
|
|
"Building Tab Bars",
|
|
"Customizing UI Components"
|
|
]
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
List {
|
|
Section {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
Text("Welcome to iOS Dev! 🚀")
|
|
.font(.title2)
|
|
.bold()
|
|
Text("This is your Home Tab. Explore how lists and navigation links work below.")
|
|
.font(.subheadline)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
.padding(.vertical, 8)
|
|
}
|
|
|
|
Section("Tutorial Highlights") {
|
|
ForEach(sampleItems, id: \.self) { item in
|
|
NavigationLink(destination: DetailView(title: item)) {
|
|
Label(item, systemImage: "book.fill")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.navigationTitle("Home")
|
|
}
|
|
}
|
|
}
|
|
|
|
struct DetailView: View {
|
|
let title: String
|
|
|
|
var body: some View {
|
|
VStack(spacing: 16) {
|
|
Image(systemName: "doc.text.fill")
|
|
.font(.system(size: 60))
|
|
.foregroundStyle(.blue)
|
|
|
|
Text(title)
|
|
.font(.title2)
|
|
.bold()
|
|
.multilineTextAlignment(.center)
|
|
|
|
Text("This is a detail view demonstrating push navigation inside SwiftUI's NavigationStack.")
|
|
.font(.body)
|
|
.foregroundStyle(.secondary)
|
|
.multilineTextAlignment(.center)
|
|
.padding(.horizontal)
|
|
|
|
Spacer()
|
|
}
|
|
.padding()
|
|
.navigationTitle("Detail")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
HomeView()
|
|
}
|