crossmate

A collaborative crossword app for iOS
Log | Files | Refs | LICENSE

commit ee7824c3e04964a634e0b988e91d9df7073b6b9f
parent b195e6bfd32f3cf9b63db586f70b5c044b55332f
Author: Michael Camilleri <[email protected]>
Date:   Sun, 12 Apr 2026 20:17:49 +0900

Ensure placeholder file is added to iCloud Drive

As both a mechanism to have the Crossmate folder be created on iCloud
Drive as well as a means to surface this to the user, this commit
ensures that an instructional file is created in the iCloud Drive.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

Diffstat:
MCrossmate/Services/UbiquityMonitor.swift | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/Crossmate/Services/UbiquityMonitor.swift b/Crossmate/Services/UbiquityMonitor.swift @@ -158,10 +158,22 @@ final class UbiquityMonitor { withIntermediateDirectories: true ) } + ensurePlaceholder(in: documents) self.documentsURL = documents self.containerAvailable = true } + private func ensurePlaceholder(in documents: URL) { + let readme = documents.appendingPathComponent("README.txt") + guard !FileManager.default.fileExists(atPath: readme.path) else { return } + let body = """ + Drop .xd crossword files into this folder to import them into Crossmate. + + Crossmate will list any .xd files you place here (including inside subfolders) in the Imported tab of the New Game sheet. + """ + try? body.data(using: .utf8)?.write(to: readme, options: .atomic) + } + private func uniqueDestination(for filename: String, in directory: URL) -> URL { let candidate = directory.appendingPathComponent(filename) if !FileManager.default.fileExists(atPath: candidate.path) {