Description
CodableCloudKit allows you to easily save and retrieve Codable objects to iCloud Database (CloudKit)
CodableCloudKit alternatives and similar libraries
Based on the "Xcode" category.
Alternatively, view CodableCloudKit alternatives based on common mentions on social networks and blogs.
-
VVDocumenter-Xcode
DISCONTINUED. Xcode plug-in which helps you write Javadoc style documents easier. -
FuzzyAutocompletePlugin
A Xcode 5+ plugin that adds more flexible autocompletion rather than just prefix-matching. -
XAlign
An amazing Xcode Source Editor extension to align regular code. It can align anything in any way you want. -
ClangFormat-Xcode
Xcode plug-in to to use clang-format from in Xcode and consistently format your code with Clang -
CocoaPods Xcode Plugin
DISCONTINUED. Dependency management helper for your CocoaPods, right in Xcode. -
RTImageAssets
A Xcode plugin to automatically generate 2x, 1x image from 3x image for you, or upscale to 3x from 2x -
Animated Mask Label
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator. -
VWInstantRun
An Xcode plugin let you build & run your selected lines of code in Xcode without running the whole project, you'll have the output instantly in your Xcode console. -
HOStringSense-for-Xcode
XCODE 8 NOT SUPPORTED // Plugin for Xcode 7 to make working with strings less "escaped" -
BBUDebuggerTuckAway
Xcode plugin for auto-hiding the debugger once you start typing in the source code editor. -
FastStub-Xcode
Xcode Plugin helps you find missing methods in your class header, protocols, and super class, also makes fast inserting. -
Solarized-Dark-for-Xcode
Solarized Dark Theme for Xcode. Compatible with all modern versions of Xcode since 2013! -
Xcode Developer Disk Images
Quick fix your Xcode with the missing developer disk images. iOS, tvOS, watchOS files available. -
Surmagic
๐ Create XCFramework with ease! Surmagic is a command-line tool to create XCFramework for multiple platforms at one shot! You don't need to waste your time with command-line scripts when you want to create an XCFramework! Surmagic adds an elegant layer between you and the compiler, for your comfort. You can use Surmagic with your current CI/CD pipeline, or as a standalone tool in your toolbox. The better way to deal with XCFrameworks for iOS, iPadOS, Mac Catalyst, tvOS, macOS, and watchOS. -
Show in Github
Xcode plugin to open the GitHub page of the commit of the currently selected line in the editor window. -
KPRunEverywhereXcodePlugin
An Xcode 7 plugin to build and run an app across multiple iOS devices with one click.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of CodableCloudKit or a related project?
README
CodableCloudKit
CodableCloudKit allows you to easily save and retrieve Codable objects to iCloud Database (CloudKit)
Features
- [x] โน๏ธ Add CodableCloudKit features
Example
The example application is the best way to see CodableCloudKit
in action. Simply open the CodableCloudKit.xcodeproj
and run the Example
scheme.
Installation
CocoaPods
CodableCloudKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CodableCloudKit'
Manually
If you prefer not to use any of the aforementioned dependency managers, you can integrate CodableCloudKit into your project manually. Simply drag the Sources
Folder into your Xcode project.
Usage
Before you start, you have to enable CloudKit in your app.
When you did that, go to your dashboard and create all the record types you need to save.
In this example, we will use User
.
Add a new Field to User
with value
as field name and String
as field type.
All of your objects will be saved as a String.
After that, go in INDEXES, you have to add 2 indexes to your records.
The first one is value
with QUERYABLE
as index type.
The second one is modifiedAt
with SORTABLE
as index type.
Now, we should be good.
Example
Let's say you have a User
model you want to sync to CloudKit. This is what the model would look like:
class User: CodableCloud {
let username: String
}
//OR
class User: CodableCloud /* OR Codable & Cloud */ {
let username: String
enum CodingKeys: String, CodingKey {
case username
}
required init(username: String) {
self.username = username
super.init()
}
required override init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.username = try container.decode(String.self, forKey: .username)
try super.init(from: decoder)
}
}
CodableCloud
is a typealias of Codable & Cloud
.
Save
func saveInCloud(_ database: CKDatabase = CKContainer.default().privateCloudDatabase,
_ completion: ResultCompletion<CKRecord>? = nil)
Save method has 2 parameters : a database with a default value (PrivateCloudDatabase) and an optional completion that returns the CKRecord
. If the object already exists in iCloud, it will update instead of creating a new record.
// The Simplest Way
user.saveInCloud()
// With another Database. In this case, the public database
user.saveInCloud(CKContainer.default().publicCloudDatabase)
// With completion
user.saveInCloud { [weak self] (result: Result<CKRecord>) in
guard let `self` = self else { return }
switch result {
case .success(_):
print("\(user.username) saved in Cloud")
case .failure(let error):
print(error.localizedDescription)
}
}
Retrieve
func retrieveFromCloud(_ database: CKDatabase = CKContainer.default().privateCloudDatabase,
completion: @escaping ResultCompletion<[Self]>)
Retrieve method has 2 parameters : a database with a default value (PrivateCloudDatabase) and an optional completion that returns a [CodableCloud]
.
User.retrieveFromCloud(completion: { [weak self] (result: Result<[User]>) in
guard let `self` = self else { return }
switch result {
case .success(let users):
print("\(users.count) users retrieved from Cloud")
case .failure(let error):
print(error.localizedDescription)
}
})
Remove
func removeFromCloud(_ database: CKDatabase = CKContainer.default().privateCloudDatabase,
_ completion: ResultCompletion<CKRecord.ID?>? = nil)
Retrieve method has 2 parameters : a database with a default value (PrivateCloudDatabase) and an optional completion that returns the CKRecord.ID
as optional.
// The Simplest Way
user.removeFromCloud()
// With another Database. In this case, the public database
user.removeFromCloud(CKContainer.default().publicCloudDatabase)
// With completion
user.removeFromCloud { [weak self] (result: Result<CKRecord.ID?>) in
guard let `self` = self else { return }
switch result {
case .success(_):
print("\(user.username) removed from Cloud")
case .failure(let error):
print(error.localizedDescription)
}
}
Contributing
Contributions are very welcome ๐
License
CodableCloudKit
Copyright (c) 2019 CodableCloudKit [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*Note that all licence references and agreements mentioned in the CodableCloudKit README section above
are relevant to that project's source code only.