56 lines
1.8 KiB
Swift
56 lines
1.8 KiB
Swift
//
|
|
// NotificationsView.swift
|
|
// tg_test
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct AppNotification: Identifiable {
|
|
let id = UUID()
|
|
let title: String
|
|
let message: String
|
|
let time: String
|
|
let icon: String
|
|
}
|
|
|
|
struct NotificationsView: View {
|
|
private let notifications: [AppNotification] = [
|
|
AppNotification(title: "Welcome aboard!", message: "Thanks for starting your iOS development journey.", time: "2m ago", icon: "sparkles"),
|
|
AppNotification(title: "Build Successful", message: "Your tab navigation app built with 0 errors.", time: "1h ago", icon: "checkmark.circle.fill"),
|
|
AppNotification(title: "New SwiftUI Feature", message: "Check out the latest navigation features.", time: "1d ago", icon: "star.fill")
|
|
]
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
List(notifications) { item in
|
|
HStack(alignment: .top, spacing: 12) {
|
|
Image(systemName: item.icon)
|
|
.font(.title2)
|
|
.foregroundStyle(.blue)
|
|
.frame(width: 32)
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
HStack {
|
|
Text(item.title)
|
|
.font(.headline)
|
|
Spacer()
|
|
Text(item.time)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
|
|
Text(item.message)
|
|
.font(.subheadline)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
.padding(.vertical, 4)
|
|
}
|
|
.navigationTitle("Notifications")
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
NotificationsView()
|
|
}
|