Giter Site home page Giter Site logo

mohsinalimat / rbsrealmbrowser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bearjaw/rbsrealmbrowser

1.0 2.0 0.0 22.86 MB

A lightweight RealmSwift database browser written in Swift based on NBNRealmBrowser

License: MIT License

Ruby 2.48% Swift 97.52%

rbsrealmbrowser's Introduction

RBSRealmBrowser

CI Status Version License Platform

RBSRealmBrowser is based on NBNRealmBrowser by Nerdish by Nature. It's a simple lightweight browser that lets you inspect which objects are currently in your realm database on your iOS device or simulator. Simply edit your existing object's property values by switching into edit mode.

Features

  • Quickly browse realm objects
  • Edit Realm objects
  • Delete Realm objects
  • Search for specific values
  • Quick actions (start the browser from the homescreen)
  • Open RealmBrowser constrained to specific classes (i.e. you only want to inspect the Person classes)

For editing objects these types are currently supported:

  • Bool
  • String
  • Int
  • Float
  • Double

Usage

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

This browser only works with RealmSwift because Realm (Objective-C) and RealmSwift 'are not interoperable and using them together is not supported.'

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // add a UIBarButtonItem 
        let bbi = UIBarButtonItem(title: "Open", style: UIBarButtonItemStyle.plain, target: self, action:   #selector(ViewController.openBrowser))
        navigationItem.rightBarButtonItem = bbi
    }

    @objc func openBrowser() {
        guard let realmBrowser = RBSRealmBrowser.realmBrowser(showing: ["Person"]) else { return }
        present(realmBrowser, animated: true, completion: nil)
    }
}

Use one of the methods to browse your Realm database

All these convenience methods come with a second method using a classes option. Use these methods if you want to restrict the results to (a) specific class(es).

If you pass in nil, all objects will be displayed. The [String] must be composed of classNames and they must match.

If you quickly want to access all objects in the default realm database use one these two methods:

// get the RealmBrowser for default Realm 
public static func realmBrowser() -> UINavigationController?
// get the RealmBrowser for default Realm, filtered by an optional class names array 
public static func realmBrowser(showing classes:[String]?) -> UINavigationController?

If you want to specifiy a realm use one of these two methods:

// get the RealmBrowser for Realm 
public static func realmBrowserForRealm(_ realm: Realm) -> UINavigationController?
// Pass an optional array of class names you want to display & your realm
public static func realmBrowserForRealm(_ realm: Realm, showing filteredClasses:[String]?) -> UINavigationController?

If you want to access your realm at a given URL use one of theses methods:

// get the RealmBrowser for Realm at a specific url
public static func realmBroswerForRealmURL(_ url: URL) -> UINavigationController?
// Same as the above but you can pass an optional [String] containing Class names
public static func realmBrowser(showing classes:[String]?,aURL URL:URL) -> UINavigationController?

Quick actions

This latest version supports dynamic quick actions on iOS 9.0 and above. To use the quick action add this code to your AppDelegate applicationDidFinishLaunching(:) method.

// add the realmbrowser quick action to your shortcut items array
 ย  if #available(iOS 9.0, *) {
       application.shortcutItems = [RBSRealmBrowser.addBrowserQuickAction()]
   } else {
       // Fallback on earlier versions
   }

Now handle the action:

    func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
        
        // handle the quick action
        guard let rb = RBSRealmBrowser.realmBrowser() else {
            print("realm browser is nil!")
            return
        }
        let vc = (window?.rootViewController)! as UIViewController
        vc.present(rb, animated: true)
    }

Try

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

Requirements

  • Xcode 8
  • iOS 9.0+
  • Swift 3.0 for any release after 0.1.4
  • Swift 4.0 for any release after 0.1.9
  • Swift 4.1 for any release after 0.2.2
  • Swift 4.2 for any release after 0.2.4
  • Swift 5.0 for any release after 0.2.9

Installation

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

pod 'RBSRealmBrowser', :configurations => ['Debug']

Future features

What's on the roadmap... ๐Ÿš€

  • Tests
  • Be able to create objects
  • Clean up
  • Live reload the browser if updates happen in the background
  • Layout improvements
  • Basic search
  • Better search

Documentation

Available method documentation here

RealmBrowser for Android

Realm browser by Jonas Rottmann for your Android projects available jonasrottmann/realm-browser

Author

Max Baumbach, [email protected]

License

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

rbsrealmbrowser's People

Contributors

bearjaw avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.