GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - insidegui/CloudKitCodable: An encoder and decoder for CKRecord

BranchesTags
Open more actions menu

Latest commit

 

History

45 Commits
45 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
Sources/CloudKitCodable
Sources/CloudKitCodable
 
 
Tests/CloudKitCodableTests
Tests/CloudKitCodableTests
 
 
.gitignore
.gitignore
 
 
.spi.yml
.spi.yml
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.MD
README.MD
 
 

Repository files navigation

CloudKit + Codable = ❤️

Badge showing the current build status

This project implements CloudKitRecordEncoder and CloudKitRecordDecoder, allowing for custom data types to be converted to/from CKRecord automatically.

Usage

For details on how to use CloudKitCodable, please check the included documentation.

Example

Declaring a model that can be encoded as a CKRecord:

struct Person: CustomCloudKitCodable {
    var cloudKitSystemFields: Data?
    let name: String
    let age: Int
    let website: URL
    let avatar: URL
    let isDeveloper: Bool
}

Creating a CKRecord from a CustomCloudKitCodable type:

let rambo = Person(...)

do {
   let record = try CloudKitRecordEncoder().encode(rambo)
   // record is now a CKRecord you can upload to CloudKit
} catch {
   // something went wrong
}

Decoding a CustomCloudKitCodable type from a CKRecord:

let record = // record obtained from CloudKit
do {
   let person = try CloudKitRecordDecoder().decode(Person.self, from: record)
} catch {
   // something went wrong
}

Minimum Deployment Targets

  • iOS 14
  • tvOS 14
  • watchOS 5
  • macOS 11
  • Xcode 15 (recommended)

Installation

Swift Package Manager

Add CloudKitCodable to your Package.swift:

dependencies: [
    .package(url: "https://github.com/insidegui/CloudKitCodable.git", from: "0.3.0")
]

Manually

If you prefer not to use Swift Package Manager, you can integrate CloudKitCodable into your project manually by copying the files in.

About

An encoder and decoder for CKRecord

Resources

Readme
BSD-2-Clause license
Activity

Stars

395 stars

Watchers

17 watching

Forks

31 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.