Jul 31 - Update PhotoCapture.swift

This commit is contained in:
Nguyen Ngo
2026-07-31 14:40:32 -04:00
parent d9a6ffcca2
commit 49fa39fe98
3 changed files with 18 additions and 5 deletions
+12 -1
View File
@@ -107,11 +107,22 @@ final class PhotoLocationProvider: NSObject, CLLocationManagerDelegate {
// MARK: - Wire format
enum PhotoCaptureFormat {
// Explicitly not @MainActor. SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor makes
// every type MainActor-isolated by default, but this formatter is read from
// `actor APIClient` while building the photo-upload multipart body a
// nonisolated context. Without this the reference warns ("Main actor-isolated
// static property 'iso8601' can not be referenced from a nonisolated context")
// and becomes a hard error under the Swift 6 language mode. Same treatment as
// `Constants` / `ServerConfig` and `SyncManager.isoFormatter` (rule 35).
nonisolated enum PhotoCaptureFormat {
/// ISO-8601 with an explicit offset the format the server's
/// `_parse_client_datetime()` expects. A naive string with no offset would
/// be read as Eastern wall time, so the offset must always be present.
///
/// Created once and reused: formatter init is expensive, and this runs per
/// photo upload. Foundation formatters are thread-safe for formatting, so
/// sharing one across isolation domains is safe.
static let iso8601: ISO8601DateFormatter = {
let f = ISO8601DateFormatter()
f.formatOptions = [.withInternetDateTime]