iCloudStorage

0.0.5

iCloudStorage is a property wrapper around NSUbiquitousKeyValueStore to easily access your shared UserDefaults.
0xWDG/iCloudStorage

What's New

0.0.5

2025-03-13T18:52:02Z

Property wrapper now works in a ObservableObject ๐ŸŽ‰

Full Changelog: 0.0.4...0.0.5

iCloudStorage

iCloudStorage is a property wrapper around NSUbiquitousKeyValueStore to easily access your shared UserDefaults.

Swift Package Manager License

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)

  1. In Xcode, open your project and navigate to File โ†’ Swift Packages โ†’ Add Package Dependency...
  2. Paste the repository URL (https://github.com/0xWDG/iCloudStorage) and click Next.
  3. 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.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun May 04 2025 01:15:31 GMT-0900 (Hawaii-Aleutian Daylight Time)