Refactor project, add loading/editing/saving notes, add client/server basic logic

This commit is contained in:
2025-10-05 23:23:19 +02:00
parent 209e08754b
commit 58ad4d47fd
5 changed files with 130 additions and 4 deletions
+9 -2
View File
@@ -11,10 +11,17 @@ struct NotesStorage {
let storageProvider: FileManager = FileManager.default
func loadNotes() -> [Note] {
let files = try! storageProvider.contentsOfDirectory(atPath: URL.documentsDirectory.path)
let files = try! storageProvider
.contentsOfDirectory(atPath: URL.documentsDirectory.path)
var notes = [Note]()
for file in files.compactMap(URL.init) {
for file in files.compactMap({
URL(
filePath: $0,
directoryHint: .notDirectory,
relativeTo: URL.documentsDirectory
)
}) {
let name = file.lastPathComponent
let note = Note(
name: name,