🎉 Create the iOS extension widget target

This commit is contained in:
2026-01-03 13:06:10 +08:00
parent f568baf14d
commit cf3a2b6340
11 changed files with 467 additions and 3 deletions

View File

@@ -0,0 +1,35 @@
//
// GroupDefaultSync.swift
// Runner
//
// Created by LittleSheep on 2026/1/3.
//
import Foundation
private let flutterKeyPrefix = "flutter."
private let flutterKeysToSync: [String] = [
"dyn_user_tk"
]
func syncDefaultsToGroup() {
let standard = UserDefaults.standard
let shared = UserDefaults(suiteName: "dev.solsynth.solian")
guard let shared else {
print("[iOS] App Group UserDefaults not available")
return
}
for key in flutterKeysToSync {
guard key.hasPrefix(flutterKeyPrefix) else { continue }
if let value = standard.object(forKey: key) {
print("[iOS] Syncing key to App Group: \(key)")
shared.set(value, forKey: key)
}
}
shared.synchronize()
}