All Projects → yokurin → RealmSwiftService

yokurin / RealmSwiftService

Licence: MIT License
Support Realm CRUD functions. Support Dao Object and Protocol Extension.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to RealmSwiftService

Swift-Viper-Weather-App
iOS app with Clean Architecture
Stars: ✭ 20 (+66.67%)
Mutual labels:  realm, realmswift
realm-mapper-ios
Realm + ObjectMapper
Stars: ✭ 28 (+133.33%)
Mutual labels:  realm, realmswift
realms-ios
Safe method for Realm
Stars: ✭ 22 (+83.33%)
Mutual labels:  realm, realmswift
Realm-and-Swift-Codable
How to implement Swift 4 Codable with Realm Database
Stars: ✭ 34 (+183.33%)
Mutual labels:  realm, realmswift
DailyFeed
iOS client for newsapi.org
Stars: ✭ 128 (+966.67%)
Mutual labels:  realm, realmswift
RealmSearchView
SearchView with result list powered by Realm
Stars: ✭ 23 (+91.67%)
Mutual labels:  realm
shadowrealm-api
🗳️ A implementation of the ShadowRealm API Proposal, a JavaScript sandbox, test with TC39 Test262 cases.
Stars: ✭ 44 (+266.67%)
Mutual labels:  realm
NewsReader
Android News Reader app. Kotlin Coroutines, Retrofit and Realm
Stars: ✭ 21 (+75%)
Mutual labels:  realm
RealmAndCharts-example
Simple example of how to use RealmSwift and Charts together - iOS 10 & Swift 3
Stars: ✭ 20 (+66.67%)
Mutual labels:  realmswift
RxRealm
Utilities for using RxJava with Realm
Stars: ✭ 23 (+91.67%)
Mutual labels:  realm
my-first-realm-app
ToDo demo app using Realm and Realm Object Server to synchronize tasks.
Stars: ✭ 38 (+216.67%)
Mutual labels:  realm
o-fish-realm
Realm application code and sample data for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection. The web app allows agencies to gain insights from the aggregated information.
Stars: ✭ 23 (+91.67%)
Mutual labels:  realm
UseCases
This a library that offers a generic implementation of the data layers from the clean architecture by Uncle bob.
Stars: ✭ 23 (+91.67%)
Mutual labels:  realm
dolores-ios
dolores iOS 客户端
Stars: ✭ 22 (+83.33%)
Mutual labels:  realm
aaf-easyphotomap
📷 Easy Photo Map is a photomap application that displays the location of the photo on the map using the location information included in the photo.
Stars: ✭ 36 (+200%)
Mutual labels:  realm
ToDo-App
Manage your chores with this ToDo-App in Swift
Stars: ✭ 27 (+125%)
Mutual labels:  realmswift
Clean Marvel Kotlin
This repository contains a detailed sample app that implements Clean architecture and MVP in Kotlin using RxJava2, Retrofit
Stars: ✭ 27 (+125%)
Mutual labels:  realm
mobile-realm
mobile-realm
Stars: ✭ 21 (+75%)
Mutual labels:  realm
realm-dart-samples
Samples for Realm Flutter and Realm Dart SDKs
Stars: ✭ 26 (+116.67%)
Mutual labels:  realm
Linux-Active-Directory-join-script
Active directory Join script for Ubuntu, Debian, CentOS, Linux Mint, Fedora, Kali, Elementary OS and Raspbian with built in failchcheck and debugmode for Ubuntu. "The most advanced and updated AD join script on GITHUB for Linux"
Stars: ✭ 97 (+708.33%)
Mutual labels:  realm

RealmSwiftService

Support default CRUD functions.

Platform License

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Open Example/RealmSwiftService.xcworkspace and run Example to see a simple demonstration.

Functions

all() -> Results<ObjectType>
find(by key: Any) -> ObjectType?
first() -> ObjectType?
last() -> ObjectType?
deleteAll() throws -> Bool
delete(list: List<ObjectType>) throws -> Bool
save(update: Bool) throws -> Bool
delete() throws -> Bool

Usages

Support 2 way implementation.

1. Implements RealmAccessible Protocol ( Protocol Extension )

@objcMembers
class Cat: Object, RealmAccessible {

    dynamic var id = UUID().uuidString
    dynamic var name = ""

    override static func primaryKey() -> String? { return "id" }

    convenience init(name: String) {
        self.init()
        self.name = name
    }
}

// Save Realm Object
let cat = Cat(name: "tama")
try! cat.save()

// Get Realm Objects
Cat.all().forEach { print("\($0.name)-\($0.id)") } // tama-UUIDString

// RealmAccessible Example
// Instance Methods
let cat = Cat(name: "tama")  // Create Realm Object
try! cat.save()              // Save Object of Cat
try! cat.delete()            // Delete Object of Cat
// Static Methods
_ = Cat.all()                // Get All Object of Cat
_ = Cat.find(by: "id")       // Find Cat by id property
_ = Cat.first()              // Get First Object of Cat
_ = Cat.last()               // Get Last Object of Cat
try! Cat.deleteAll()         // Delete All Object of Cat

2. Use RealmDao

@objcMembers
class Dog: Object {

    dynamic var id = UUID().uuidString
    dynamic var name = ""

    override static func primaryKey() -> String? { return "id" }

    convenience init(name: String) {
        self.init()
        self.name = name
    }
}

// Save Realm Object
let dao = RealmDao<Dog>()
let dog = Dog(name: "pochi")
dao.save(dog)

// Get Realm Objects
dao.all().forEach { print("\($0.name)-\($0.id)") } // pochi-UUIDString

// Dao Example
let dao = RealmDao<Dog>()    // Create Dao of Dog
let dog = Dog(name: "pochi") // Create Realm Object
_ = dao.all()                // Get All Object of Dog
_ = dao.find(by: "id")       // Find Dog by id property
_ = dao.first()              // Get First Object of Dog
_ = dao.last()               // Get Last Object of Dog
try! dao.save(dog)           // Save Object of Dog
try! dao.delete(dog)         // Delete Object of Dog
try! dao.deleteAll()         // Delete All Object of Dog

Requirements

  • iOS 10.0+
  • Xcode 10.0+
  • Swift 4.2+

Installation

Manual

Add RealmAccessible.swift, RealmDao.swift into your Project.

CocoaPods

WIP...

RealmSwiftService is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'RealmSwiftService'

and run pod install

Author

Tsubasa Hayashi, [email protected]

License

RealmSwiftService is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].