Latest 3.0.0
Homepage https://github.com/quver/Queryable
License MIT
Platforms ios 8.0
Dependencies RealmSwift
Authors

Realm Query Extension

Build Status
codecov
codebeat badge
Readme Score

Requirements

  • iOS 8.0+ / macOS 10.9+ / tvOS / watchOS
  • Xcode 8.0+
  • Swift 3.0+

Contribute

  • If you want to add something feels free to add pull request
  • If you find bug or suggestion, please create issue
  • Thanks for all starts

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

Then go to your project directory and run:

$ pod init

in Podfile add:

use_frameworks!

target '<Target Name>' do
    pod 'Queryable'
end

Usage

CUD operations

// Simple class
class Foo: Object {
    dynamic var bar = ""
}

// Conform to protocol
extension Foo: Queryable {}

// Create simple object
let foo = Foo()
foo.bar = "something"

// Save objec
foo.add()

// Update object
foo.update(transaction: {
    foo.bar = "something other"
}, completion: nil)

// Remove object
foo.remove()

Fetching objects

// Fetch all objects
_ = Foo.arrayOfObjects

// Realm results
_ = Foo.resultsOfObjects

// Fetch filtred array
_ = Foo.filtredArray("bar == 'something'")

// Fetch filtred results
_ = Foo.filtredResults("bar == 'something'")

DBManager

Queryable has also DBManger which provides generic methods

// Fetching objects
public class func getObjects<T: Object>(of entity: T.Type, filter: String? = nil) -> [T]

// Add
public class func add(object: Object) -> Bool

//Update
public class func update(transaction: @escaping ()->()) -> Bool

//Remove
public class func remove(object: Object) -> Bool

Remove all from Realm

public class func removeAll() -> Bool

Latest podspec

{
    "name": "Queryable",
    "version": "3.0.0",
    "summary": "Realm Query Extension",
    "description": "Extension for CRUD operation just on object",
    "homepage": "https://github.com/quver/Queryable",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Paweu0142 Bednorz": "[email protected]"
    },
    "source": {
        "git": "https://github.com/quver/Queryable.git",
        "tag": "3.0.0"
    },
    "social_media_url": "https://twitter.com/plquver",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/**/*",
    "dependencies": {
        "RealmSwift": [
            "~> 2.0"
        ]
    },
    "pushed_with_swift_version": "3"
}

Pin It on Pinterest

Share This