0xWDG/iCloudStorage
iCloudStorage is a property wrapper around NSUbiquitousKeyValueStore to easily access your shared UserDefaults.
Requirements
- Swift 5.9+ (Xcode 15+)
- iOS 13+, macOS 10.15+
Installation (Pakage.swift)
dependencies: [
.package(url: "https://github.com/0xWDG/iCloudStorage.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "iCloudStorage", package: "iCloudStorage"),
]),
]Installation (Xcode)
- In Xcode, open your project and navigate to File β Swift Packages β Add Package Dependency...
- Paste the repository URL (
https://github.com/0xWDG/iCloudStorage) and click Next. - Click Finish.
Usage
import SwiftUI
import iCloudStorage
struct ContentView: View {
@iCloudStorage("key")
var value: String = "default"
var body: some View {
VStack {
Text(value)
Button("Change value") {
value = "Hello there at \(Date())"
}
}
.task {
value = "Hello there"
}
.padding()
}
}Contact
π¦ @0xWDG π mastodon.social/@0xWDG π¦ @0xWDG π§΅ @0xWDG π wesleydegroot.nl π€ Discord
Interested learning more about Swift? Check out my blog.
Package Metadata
Repository: 0xWDG/iCloudStorage
Homepage: https://0xwdg.github.io/iCloudStorage/
Stars: 8
Forks: 0
Open issues: 2
Default branch: main
Primary language: swift
License: MIT
Topics: 0xwdg, hacktoberfest, icloud, key-value-store, nsubiquitouskeyvaluestore, propertywrapper, swift, swiftui
README: README.md