mirror of
https://github.com/1SecondEveryday/MemoryTree.git
synced 2026-03-25 08:55:47 +00:00
54 lines
1.3 KiB
Swift
54 lines
1.3 KiB
Swift
//
|
|
// CloudView.swift
|
|
// MemoryTree
|
|
//
|
|
// Created by Work on 2023-02-05.
|
|
//
|
|
|
|
import Boutique
|
|
import SwiftUI
|
|
|
|
struct CloudView: View {
|
|
// @Stored(in: .entriesStore) var entries
|
|
@Binding var entries: [Entry]
|
|
|
|
@Environment(\.dismiss) var dismiss
|
|
|
|
var body: some View {
|
|
VStack {
|
|
ForEach(entries) { entry in
|
|
Text(entry.text)
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.edgesIgnoringSafeArea(.bottom)
|
|
.background(Color.blue)
|
|
.foregroundColor(.white)
|
|
.toolbar {
|
|
ToolbarItem(placement: .destructiveAction) {
|
|
Button {
|
|
// Task {
|
|
// try await $entries.removeAll()
|
|
// }
|
|
entries.removeAll()
|
|
dismiss()
|
|
} label: {
|
|
Image(systemName: "flame")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct CloudView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group {
|
|
NavigationStack {
|
|
CloudView(entries: .constant([]))
|
|
|
|
CloudView(entries: .constant([Entry(text: "Coffee"), Entry(text: "Trees")]))
|
|
}
|
|
}
|
|
.tint(.white)
|
|
}
|
|
}
|