// // 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], toUrl: URL) { save(data: Data(items.map({ $0.yaml() }).joined().utf8), toUrl: toUrl) } static func save(data: Data, toUrl: URL) { do { try data.write(to: toUrl, options: [.atomic, .completeFileProtection]) let input = try String(contentsOf: toUrl, encoding: .utf8) print(input) } catch { print(error.localizedDescription) } } }