// // SaveController.swift // Todos // // Created by Sam Jaffe on 3/1/26. // import Foundation final class SaveController { static func filename(date: String) -> URL { URL.documentsDirectory.appending(path: "Weekly Tracker \(date).yml") } static func save(_ items: [Project], to: URL) { save(data: Data(items.map({ $0.yaml() }).joined().utf8), to: to) } static func save(data: Data, to: URL) { do { try data.write(to: to, options: [.atomic, .completeFileProtection]) let input = try String(contentsOf: to, encoding: .utf8) print(input) } catch { print(error.localizedDescription) } } }