RBSRealmBrowser is based on NBNRealmBrowser by Nerdish by Nature. It's a simple lightweight browser that let's you inspect which objects currently are in your realm database on your iOS device or simulator. Simply edit your existing object's property values by switching into edit mode.
If you want to use the latest version of Swift make sure you check out the swift-4
branch in your pod file.
- quickly browse realm objects
- edit realm objects
- delete realm objects
- quick actions(start the browser from the homescreen)
For editing objects these types are currently supported:
- Bool
- String
- Int
- Float
- Double
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.'
override func viewDidLoad() {
super.viewDidLoad()
// add a UIBarButtonItem
let bbi = UIBarButtonItem(title: "Open", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ViewController.openBrowser))
self.navigationItem.rightBarButtonItem = bbi
}
func openBrowser(id:AnyObject) {
// get an instance of RBSRealmBrowser
let rb = RBSRealmBrowser.realmBrowser()
self.presentViewController(rb as! UIViewController, animated: true) {
}
}
Use one of the three methods to browse your Realm database
// get the RealmBrowser for default Realm
realmBrowser()
// get the RealmBrowser for Realm
realmBrowserForRealm(realm:Realm)
// get the RealmBrowser for Realm at a specific url
realmBroswerForRealmAtURL(path:String)
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)
}
To try the example project, clone the repo, and run pod try
from the Example directory first.
- Xcode 8
- iOS 8.0
- Swift 3.0 for any release after 0.1.4
RBSRealmBrowser is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RBSRealmBrowser'
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
- Search
Available method documentation here
Realm browser by Jonas Rottmann for your Android projects available jonasrottmann/realm-browser
Max Baumbach, [email protected]
RBSRealmBrowser is available under the MIT license. See the LICENSE file for more info.