Files
praca_inzynierska/Peered/ContentView.swift
T
2025-09-25 19:36:21 +02:00

41 lines
771 B
Swift

//
// ContentView.swift
// Peered
//
// Created by Oskar Chybowski on 11/05/2025.
//
import SwiftUI
struct ContentView: View {
@AppStorage("peered_username") private var username: String = ""
@State private var notes = [Note]()
var body: some View {
NavigationView {
List(notes) { note in
NavigationLink(note.name) {
NoteEditorScreen(note: note)
}
}
.navigationTitle("Peered")
.toolbar {
Button("Create note") {
NotesStorage().createNote(name: "New Note")
notes = NotesStorage().loadNotes()
}
}
}
.onAppear {
notes = NotesStorage().loadNotes()
}
.sheet(isPresented: .constant(username.isEmpty)) {
SetUserNameBottomSheetView(username: $username)
}
}
}
#Preview {
ContentView()
}