Refactor project, add loading/editing/saving notes, add client/server basic logic
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user