PropertyKit alternatives and similar libraries
Based on the "Database" category.
Alternatively, view PropertyKit alternatives based on common mentions on social networks and blogs.
-
Realm
Realm is a mobile database: a replacement for Core Data & SQLite -
MMKV
An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX. -
GRDB.swift
A toolkit for SQLite databases, with a focus on application development -
YapDatabase
YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers. -
ParseAlternatives
GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development. [Moved to: https://github.com/relatedcode/GraphQLite] -
Couchbase Mobile
Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps. -
FCModel
An alternative to Core Data for people who like having direct SQL access. -
UserDefaults
Simple, Strongly Typed UserDefaults for iOS, macOS and tvOS -
CTPersistance
iOS Database Persistence Layer with SQLite, your next Persistence Layer! -
Unrealm
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm. -
Prephirences
Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, configurations and app-state. UserDefaults -
RealmIncrementalStore
Realm-powered Core Data persistent store -
UserDefaultsStore
Why not use UserDefaults to store Codable objects ๐ -
ObjectBox
Swift database - fast, simple and lightweight (iOS, macOS) -
PredicateEditor
A GUI for dynamically creating NSPredicates at runtime to query data in your iOS app. -
Nora
Nora is a Firebase abstraction layer for FirebaseDatabase and FirebaseStorage -
realm-cocoa-converter
A library that provides the ability to import/export Realm files from a variety of data container formats. -
SecureDefaults
Elevate the security of your UserDefaults with this lightweight โจ wrapper that adds an additional layer of AES-256 encryption -
MySQL
A stand-alone Swift wrapper around the MySQL client library, enabling access to MySQL servers. -
PersistenceKit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code! -
PersistentStorageSerializable
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk. -
YapDatabaseExtensions
YapDatabase extensions for use with Swift -
TypedDefaults
TypedDefaults is a utility library to type-safely use NSUserDefaults. -
MongoDB
A stand-alone Swift wrapper around the mongo-c client library, enabling access to MongoDB servers. -
PostgreSQL
A stand-alone Swift wrapper around the libpq client library, enabling access to PostgreSQL servers. -
ObjectiveRocks
An Objective-C wrapper for RocksDB - A Persistent Key-Value Store for Flash and RAM Storage. -
SQLite
A stand-alone Swift wrapper around the SQLite 3 client library. -
Storez
๐พ Safe, statically-typed, store-agnostic key-value storage written in Swift! -
FileMaker
A stand-alone Swift wrapper around the FileMaker XML Web publishing interface, enabling access to FileMaker servers.
Appwrite - The Open Source Firebase alternative introduces iOS support
* 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 PropertyKit or a related project?
Popular Comparisons
README
Light-weight, strict protocol-first styled PropertyKit helps you to easily and safely handle guaranteed values, keys or types on various situations of the large-scale Swift project on iOS, macOS and tvOS.
Installation
CocoaPods
pod 'PropertyKit'
Carthage
github "metasmile/PropertyKit"
Swift Package Manager
.Package(url: "https://github.com/metasmile/PropertyKit.git")
Modules
- PropertyWatchable for NSKeyValueObservation
- PropertyDefaults for UserDefaults
- ~
PropertyDefaults
The simplest, but reliable way to manage UserDefaults. PropertyDefaults automatically binds value and type from Swift property to UserDefaults keys and values. It forces only protocol extension pattern that is focusing on syntax-driven value handling, so it helps to avoid unsafe String key use. Therefore, natually, Swift compiler will protect all of missing or duplicating states with its own.
PropertyDefaults is new hard fork of DefaultsKit by nmdias with entirely different approaches.
Features
- [x] Swift 4 Codable Support
- [x] Compile-time UserDefaults guaranteeing.
- [x] Key-Type-Value relationship safety, no String literal use.
- [x] Structural extension-protocol-driven, instead of an intension.
- [x] Permission control
- [ ] Automatic private scope - In File, Class or Struct, Function
Usage
An example to define automatic UserDefaults keys with basic Codable types:
extension Defaults: PropertyDefaults {
public var autoStringProperty: String? {
set{ set(newValue) } get{ return get() }
}
public var autoDateProperty: Date? {
set{ set(newValue) } get{ return get() }
}
}
var sharedDefaults = Defaults()
sharedDefaults.autoStringProperty = "the new value will persist in shared scope"
// sharedDefaults.autoStringProperty == Defaults.shared.autoStringProperty
Defaults.shared.autoStringProperty = "another new value will persist in shared scope"
// Defaults.shared.autoStringProperty == sharedDefaults.autoStringProperty
var localDefaults = Defaults(suiteName:"local")
localDefaults.autoStringProperty = "the new value will persist in local scope"
// localDefaults.autoStringProperty != Defaults.shared.autoStringProperty
Directly save/load as Codable type
public struct CustomValueType: Codable{
var key:String = "value"
var date:Date?
var data:Data?
}
extension Defaults: PropertyDefaults {
// non-optional - must define the default value with the keyword 'or'
public var autoCustomNonOptionalProperty: CustomValueType {
set{ set(newValue) } get{ return get(or: CustomValueType()) }
}
// optional with/without setter default value
public var autoCustomOptionalProperty: CustomValueType? {
set{ set(newValue) } get{ return get() }
}
public var autoCustomOptionalPropertySetterDefaultValue: CustomValueType? {
set{ set(newValue, or: CustomValueType()) } get{ return get() }
}
}
Strongly guaranteeing unique key with Swift compiler.
//CodeFile1_ofLargeProject.swift
protocol MyDefaultsKeysUsingInA : PropertyDefaults{
var noThisIsMyKeyNotYours:Int?{ get }
}
extension Defaults : MyDefaultsKeysUsingInA{
var noThisIsMyKeyNotYours:Int?{ set{ set(newValue) } get{ return get() } }
}
//CodeFile2_ofLargeProject.swift
protocol MyDefaultsKeysUsingInB : PropertyDefaults{
var noThisIsMyKeyNotYours:Int?{ get }
}
extension Defaults : MyDefaultsKeysUsingInB{
var noThisIsMyKeyNotYours:Int?{ set{ set(newValue) } get{ return get() } }
}
โ๏ธSwift Compiler Error
~.swift:30:9: Invalid redeclaration of 'noThisIsMyKeyNotYours'
~.swift:21:9: 'noThisIsMyKeyNotYours' previously declared here
With this pattern, as you know, you also can control access permission with the protocol. It means you can use 'private' or 'file-private' defaults access.
// MyFile.swift
fileprivate protocol PrivateDefaultKeysInThisSwiftFile: PropertyDefaults{
var filePrivateValue: String? {set get}
}
extension Defaults: PrivateDefaultKeysInThisSwiftFile {
public var filePrivateValue: String? {
set{ set(newValue) } get{ return get() }
}
}
// Can access - ๐
Defaults.shared.filePrivateValue
// MyOtherFile.swift
// Not able to access - โ
Defaults.shared.filePrivateValue
And, Yes, It's a hack way to crack our design intention.
var p1:Int{
Defaults.shared.set(2)
return Defaults.shared.get(or:0)
}
var p2: Int{
return Defaults.shared.get(or:0)
}
p1 // == 2
p2 // == 0
//It means that are function/property-scoped capsulated defaults values.
PropertyWatchable
A protocol extension based on NSKeyValueObservation. It simply enables to let a class object become a type-safe keypath observable object. And unique observer identifier will be assigned to all observers automatically. That prevents especially duplicated callback calls and so it can let you atomically manage a bunch of key-value flows between its joined queues.
Features
- [x] Making an observable object with only protocol use.
- [x] Swift property literal based keypath observation.
- [x] Strictful type-guaranteed callback parameter support.
- [x] Automatic unique identifier support.
- [x] File-scoped observer removing support.
- [ ] Queue-private atomic operation support.
Usage
The simplest example to use.
class WatchableObject:NSObject, PropertyWatchable{
@objc dynamic
var testingProperty:String?
}
let object = WatchableObject()
object.watch(\.testingProperty) {
object.testingProperty == "some value"
//Do Something.
}
object.testingProperty = "some value"
All options and strongly typed-parameters are same with NSKeyValueObservation.
// Default option is the default of NSKeyValueObservation (.new)
// (WatchableObject, NSKeyValueObservedChange<Value>)
object.watch(\.testingProperty, options: [.initial, .new, .old]) { (target, changes) in
target.testingProperty == "some value"
//Dd Something.
}
let object = WatchableObject()
object.testingProperty = "initial value"
config.watch(\.testingProperty, options: [.initial]) { (o, _) in
o.testingProperty == "initial value"
}
Automatic line by line identifier support.
object.watch(\.testingProperty) {
// Listening as a unique observer 1
}
object.watch(\.testingProperty) {
// Listening as a unique observer 2
}
object.watch(\.testingProperty, id:"myid", options:[.old]) {
// Listening as an observer which has identifier "myid"
}
// total 3 separated each observers are listening each callbacks.
Remove observations with various options.
// Remove only an observer which has "myid" only
object.unwatch(\.testingProperty, forIds:["myid"])
// Remove all observers that are watching ".testingProperty"
object.unwatch(\.testingProperty)
//Automatically remove all observers in current file.
object.unwatchAllFilePrivate()
//Automatically remove entire observers in application-wide.
object.unwatchAll()