📌  相关文章
📜  将文件从 macOS 应用程序保存到桌面 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:40.794000             🧑  作者: Mango

代码示例1
let homePath = FileManager.default.homeDirectoryForCurrentUser
let desktopPath = homePath.appendingPathComponent("Desktop")
print(desktopPath)
let filePath = desktopPath.appendingPathComponent("TestFile.txt")
do {
  try unicodeString.write(to: filePath, atomically: false, encoding: .utf8)
} catch {
  errorMessage = error.localizedDescription + "\n" + unicodeString
}