├── .gitignore ├── Design ├── CheckmarkIcon.pcvd ├── CollapseArrow.pcvd ├── RealmBrowserIcons.pcvd └── Spanner.psd ├── LICENSE ├── Podfile ├── Podfile.lock ├── README.md ├── RealmBrowser.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── RealmBrowserExample.xcscheme ├── RealmBrowser.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── RealmBrowser.xcscmblueprint ├── RealmBrowser ├── Categories │ ├── RLMObject │ │ ├── RLMObject+JSONSerialization.h │ │ └── RLMObject+JSONSerialization.m │ ├── RLMProperty │ │ ├── RLMProperty+BrowserDescription.h │ │ └── RLMProperty+BrowserDescription.m │ ├── RLMRealm │ │ ├── RLMRealm+BrowserCaptureRealms.h │ │ ├── RLMRealm+BrowserCaptureRealms.m │ │ ├── RLMRealm+BrowserCaptureWrites.h │ │ ├── RLMRealm+BrowserCaptureWrites.m │ │ ├── RLMRealm+RealmBrowser.h │ │ └── RLMRealm+RealmBrowser.m │ ├── RLMRealmConfiguration │ │ ├── RLMRealmConfiguration+BrowserCompare.h │ │ └── RLMRealmConfiguration+BrowserCompare.m │ ├── UIColor │ │ ├── UIColor+BrowserRealmColors.h │ │ └── UIColor+BrowserRealmColors.m │ ├── UIImage │ │ ├── UIImage+BrowserIcons.h │ │ └── UIImage+BrowserIcons.m │ └── UILabel │ │ ├── UILabel+RealmBrowser.h │ │ └── UILabel+RealmBrowser.m ├── Controllers │ ├── RLMBrowserEmptyViewController.h │ ├── RLMBrowserEmptyViewController.m │ ├── RLMBrowserLogoViewController.h │ ├── RLMBrowserLogoViewController.m │ ├── RLMBrowserObjectListViewController.h │ ├── RLMBrowserObjectListViewController.m │ ├── RLMBrowserObjectSchemaPickerViewController.h │ ├── RLMBrowserObjectSchemaPickerViewController.m │ ├── RLMBrowserObjectSchemaViewController.h │ ├── RLMBrowserObjectSchemaViewController.m │ ├── RLMBrowserObjectViewController.h │ ├── RLMBrowserObjectViewController.m │ ├── RLMBrowserRealmListViewController.h │ ├── RLMBrowserRealmListViewController.m │ ├── RLMBrowserRealmTableViewController.h │ └── RLMBrowserRealmTableViewController.m ├── Models │ ├── Configuration │ │ ├── RLMBrowserConfiguration.h │ │ └── RLMBrowserConfiguration.m │ ├── Global │ │ ├── RLMBrowserConstants.h │ │ └── RLMBrowserConstants.m │ ├── RealmObjects │ │ ├── RLMBrowserAppGroupRealm.h │ │ ├── RLMBrowserAppGroupRealm.m │ │ ├── RLMBrowserList.h │ │ ├── RLMBrowserList.m │ │ ├── RLMBrowserObjectProperty.h │ │ ├── RLMBrowserObjectProperty.m │ │ ├── RLMBrowserRealm.h │ │ ├── RLMBrowserRealm.m │ │ ├── RLMBrowserSchema.h │ │ └── RLMBrowserSchema.m │ └── Services │ │ ├── RLMBrowserObjectsCoordinator.h │ │ └── RLMBrowserObjectsCoordinator.m ├── RLMBrowserViewController.h ├── RLMBrowserViewController.m └── Views │ ├── EmptyContentViews │ ├── RLMBrowserEmptyContentView.h │ ├── RLMBrowserEmptyContentView.m │ └── RLMBrowserEmptyContentView.xib │ ├── FooterView │ ├── RLMBrowserSchemaPreviewView.h │ ├── RLMBrowserSchemaPreviewView.m │ └── RLMBrowserSchemaPreviewView.xib │ ├── HeaderViews │ ├── RLMBrowserNavigationTitleView.h │ ├── RLMBrowserNavigationTitleView.m │ ├── RLMBrowserNavigationTitleView.xib │ ├── RLMBrowserRealmHeaderView.h │ ├── RLMBrowserRealmHeaderView.m │ ├── RLMBrowserRealmHeaderView.xib │ ├── RLMBrowserRealmTableCellHeaderView.h │ ├── RLMBrowserRealmTableCellHeaderView.m │ ├── RLMBrowserTableHeaderView.h │ └── RLMBrowserTableHeaderView.m │ ├── RealmLogoViews │ ├── RLMRealmLogoView.h │ ├── RLMRealmLogoView.m │ ├── RLMRealmMonochromeLogoView.h │ └── RLMRealmMonochromeLogoView.m │ └── TableViewCells │ ├── ObjectListTableViewCell │ ├── RLMBrowserObjectListContentView.h │ ├── RLMBrowserObjectListContentView.m │ └── RLMBrowserObjectListContentView.xib │ ├── ObjectTableViewCellContentView │ ├── RLMBrowserObjectContentView.h │ ├── RLMBrowserObjectContentView.m │ └── RLMBrowserObjectContentView.xib │ ├── PropertyTableViewCell │ ├── RLMBrowserPropertyTableViewCell.h │ ├── RLMBrowserPropertyTableViewCell.m │ └── RLMBrowserPropertyTableViewCell.xib │ ├── RLMBrowserTableViewCell.h │ ├── RLMBrowserTableViewCell.m │ ├── RealmSchemaTableViewCell │ ├── RLMBrowserSchemaTableViewCell.h │ ├── RLMBrowserSchemaTableViewCell.m │ └── RLMBrowserSchemaTableViewCell.xib │ └── RealmTableViewCell │ ├── RLMBrowserRealmTableViewCell.h │ ├── RLMBrowserRealmTableViewCell.m │ └── RLMBrowserRealmTableViewCell.xib ├── RealmBrowserExample ├── AppDelegate.h ├── AppDelegate.m ├── Controllers │ ├── ViewController.h │ └── ViewController.m ├── Models │ ├── Person.h │ └── Person.m ├── Resources │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ └── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard └── Supporting Files │ ├── Info.plist │ └── main.m ├── RealmBrowserKit.podspec └── screenshot.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | .DS_Store 62 | -------------------------------------------------------------------------------- /Design/CheckmarkIcon.pcvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/RealmBrowser-iOS/a4c4603f0fd7e3bff698fc4f4412208629f5ae5c/Design/CheckmarkIcon.pcvd -------------------------------------------------------------------------------- /Design/CollapseArrow.pcvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/RealmBrowser-iOS/a4c4603f0fd7e3bff698fc4f4412208629f5ae5c/Design/CollapseArrow.pcvd -------------------------------------------------------------------------------- /Design/RealmBrowserIcons.pcvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/RealmBrowser-iOS/a4c4603f0fd7e3bff698fc4f4412208629f5ae5c/Design/RealmBrowserIcons.pcvd -------------------------------------------------------------------------------- /Design/Spanner.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/RealmBrowser-iOS/a4c4603f0fd7e3bff698fc4f4412208629f5ae5c/Design/Spanner.psd -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Tim Oliver 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '8.0' 2 | 3 | target 'RealmBrowserExample' do 4 | use_frameworks! 5 | 6 | pod 'Realm' 7 | pod 'Reveal-SDK', :configurations => ['Debug'] 8 | pod 'TORoundedTableView' 9 | pod 'TOSplitViewController' 10 | pod 'TODocumentPickerViewController' 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Realm (3.0.1): 3 | - Realm/Headers (= 3.0.1) 4 | - Realm/Headers (3.0.1) 5 | - Reveal-SDK (11) 6 | - TODocumentPickerViewController (0.1.1) 7 | - TORoundedTableView (0.1.3) 8 | - TOSplitViewController (0.0.4) 9 | 10 | DEPENDENCIES: 11 | - Realm 12 | - Reveal-SDK 13 | - TODocumentPickerViewController 14 | - TORoundedTableView 15 | - TOSplitViewController 16 | 17 | SPEC REPOS: 18 | https://github.com/cocoapods/specs.git: 19 | - Realm 20 | - Reveal-SDK 21 | - TODocumentPickerViewController 22 | - TORoundedTableView 23 | - TOSplitViewController 24 | 25 | SPEC CHECKSUMS: 26 | Realm: ba6144c74f835f7497791f6599d63a7755377b83 27 | Reveal-SDK: 7fa13d04bb55db61ff2342a990cf731d5159361d 28 | TODocumentPickerViewController: 563d97ad8d8014e6b30245e31bf4248f2778c0fb 29 | TORoundedTableView: cd1437ef81ab3888dea8c06d2dfe4795bcaac768 30 | TOSplitViewController: 3d59b95c3e09511cc4540bc05d1db6a7d3289eed 31 | 32 | PODFILE CHECKSUM: 1aecb5074ff6ec1a54439612e689c2ee5365cd7d 33 | 34 | COCOAPODS: 1.5.3 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Realm Browser for iOS 2 | > An on-device debugging framework for introspecting local Realm files. 3 | 4 | 5 | 6 | **This library is still a heavy WIP with several relatively crucial features still missing. In any case, it's finished to the point where it's presentable, so I figured I'd stop hoarding it to myself. Enjoy!** 7 | 8 | The Realm Browser for iOS is an unofficial debugging framework for apps that implement [Realm](http://realm.io). It uses the Objective-C dynamic runtime to monitor an app's interaction with Realm, and then allows developers to present a UI dialog displaying the contents of any Realm files in the app. 9 | 10 | When developing an app using Realm, sometimes it is very important to be able to inspect the contents of the Realm file to make sure the right data is getting saved. While this is easy on the Simulator, it's a lot harder on an actual device to get at the Realm file. The goal here is that the Realm Browser can be embedded in debug builds of apps, and able to be used to inspect the contents of Realm files at any given moment, even when away from a Mac. 11 | 12 | ## Disclaimer 13 | This is not an official project of Realm. It was one I did in my free time as a development tool for one of my apps. Please ensure to file issues and bug reports here, and not on the main Realm repo. 14 | 15 | ## License 16 | Realm Browser for iOS is licensed under the MIT license. Please see the [LICENSE](License) file for more information. 17 | 18 | ## Credits 19 | 20 | Realm Browser for iOS was designed and developed by [Tim Oliver](http://timoliver.blog). 21 | 22 | iPad Pro mockup by [Pixeden](http://pixeden.com). ![analytics](https://ga-beacon.appspot.com/UA-5643664-16/RealmBrowser-iOS/README.md?pixel) 23 | 24 | -------------------------------------------------------------------------------- /RealmBrowser.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RealmBrowser.xcodeproj/xcshareddata/xcschemes/RealmBrowserExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /RealmBrowser.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RealmBrowser.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RealmBrowser.xcworkspace/xcshareddata/RealmBrowser.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "6761D795567FBCFF6BB70CBC1B07EC23A3A86990", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "27B5CECF931F7A0681CF44844512ADAF1FD59271" : 9223372036854775807, 8 | "BE53331EE98D89A4A5462CA7AECF0285284DD1C7" : 9223372036854775807, 9 | "6761D795567FBCFF6BB70CBC1B07EC23A3A86990" : 9223372036854775807, 10 | "5C8D020D0CE0E6AC65382FAC6AA1A11821B19AAC" : 9223372036854775807 11 | }, 12 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "28F45B83-0415-434B-8404-B20106C92633", 13 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 14 | "27B5CECF931F7A0681CF44844512ADAF1FD59271" : "TOStatusBarSimulator\/", 15 | "BE53331EE98D89A4A5462CA7AECF0285284DD1C7" : "TODocumentPickerViewController\/", 16 | "6761D795567FBCFF6BB70CBC1B07EC23A3A86990" : "RealmBrowser-iOS\/", 17 | "5C8D020D0CE0E6AC65382FAC6AA1A11821B19AAC" : "TOSplitViewController\/" 18 | }, 19 | "DVTSourceControlWorkspaceBlueprintNameKey" : "RealmBrowser", 20 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 21 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "RealmBrowser.xcworkspace", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 23 | { 24 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/TimOliver\/TOStatusBarSimulator.git", 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "27B5CECF931F7A0681CF44844512ADAF1FD59271" 27 | }, 28 | { 29 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/TimOliver\/TOSplitViewController", 30 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 31 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5C8D020D0CE0E6AC65382FAC6AA1A11821B19AAC" 32 | }, 33 | { 34 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/TimOliver\/RealmBrowser-iOS.git", 35 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 36 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6761D795567FBCFF6BB70CBC1B07EC23A3A86990" 37 | }, 38 | { 39 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/TimOliver\/TODocumentPickerViewController.git", 40 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 41 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "BE53331EE98D89A4A5462CA7AECF0285284DD1C7" 42 | } 43 | ] 44 | } -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMObject/RLMObject+JSONSerialization.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMObject+JSONSerialization.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | @interface RLMObject (JSONSerialization) 27 | 28 | - (NSDictionary *)RLMBrowser_toJSONDictionary; 29 | - (NSString *)RLMBrowser_toJSONStringWithError:(NSError **)error; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMObject/RLMObject+JSONSerialization.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMObject+JSONSerialization.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMObject+JSONSerialization.h" 24 | 25 | @implementation RLMObject (JSONSerialization) 26 | 27 | - (NSDictionary *)RLMBrowser_toJSONDictionary 28 | { 29 | return [[self class] JSONDictionaryForObject:self]; 30 | } 31 | 32 | - (NSString *)RLMBrowser_toJSONStringWithError:(NSError **)error 33 | { 34 | NSDictionary *JSONDictionary = [self RLMBrowser_toJSONDictionary]; 35 | NSData *JSONData = [NSJSONSerialization dataWithJSONObject:JSONDictionary options:NSJSONWritingPrettyPrinted error:error]; 36 | if (*error) { 37 | return nil; 38 | } 39 | 40 | return [[NSString alloc] initWithData:JSONData encoding:NSUTF8StringEncoding]; 41 | } 42 | 43 | + (id)JSONValueForValue:(id)value ofType:(RLMPropertyType)propertyType 44 | { 45 | switch (propertyType) { 46 | case RLMPropertyTypeInt: 47 | case RLMPropertyTypeBool: 48 | case RLMPropertyTypeFloat: 49 | case RLMPropertyTypeDouble: 50 | return (NSNumber *)value; 51 | case RLMPropertyTypeString: 52 | return (NSString *)value; 53 | case RLMPropertyTypeData: 54 | { 55 | NSData *encodedData = [(NSData *)value base64EncodedDataWithOptions:NSDataBase64Encoding64CharacterLineLength]; 56 | return [[NSString alloc] initWithData:encodedData encoding:NSUTF8StringEncoding]; 57 | } 58 | case RLMPropertyTypeDate: 59 | { 60 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 61 | dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; 62 | return [dateFormatter stringFromDate:value]; 63 | } 64 | case RLMPropertyTypeObject: 65 | return [[self class] JSONDictionaryForObject:value]; 66 | // case RLMPropertyTypeArray: 67 | // { 68 | // NSMutableArray *array = [NSMutableArray array]; 69 | // for (RLMObject *object in (RLMArray *)value) { 70 | // [array addObject:[[self class] JSONDictionaryForObject:object]]; 71 | // } 72 | // return array; 73 | // } 74 | default: 75 | break; 76 | } 77 | 78 | return nil; 79 | } 80 | 81 | + (NSDictionary *)JSONDictionaryForObject:(RLMObject *)object 82 | { 83 | NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 84 | RLMObjectSchema *schema = object.objectSchema; 85 | 86 | for (RLMProperty *property in schema.properties) { 87 | id value = [[self class] JSONValueForValue:object[property.name] ofType:property.type]; 88 | dictionary[property.name] = value ?: [NSNull null]; 89 | } 90 | 91 | return [NSDictionary dictionaryWithDictionary:dictionary]; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMProperty/RLMProperty+BrowserDescription.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMProperty+RLMBrowser_formattedDescription.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | @interface RLMProperty (BrowserDescription) 27 | 28 | - (NSString *)RLMBrowser_typeDescription; 29 | - (NSString *)RLMBrowser_configurationDescription; 30 | - (NSString *)RLMBrowser_typeAndConfigurationDescription; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMProperty/RLMProperty+BrowserDescription.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMProperty+RLMBrowser_formattedDescription.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMProperty+BrowserDescription.h" 24 | 25 | @implementation RLMProperty (BrowserDescription) 26 | 27 | - (NSString *)RLMBrowser_typeDescription 28 | { 29 | NSString *propertyString = nil; 30 | switch (self.type) { 31 | case RLMPropertyTypeInt: 32 | propertyString = @"Integer"; 33 | break; 34 | case RLMPropertyTypeBool: 35 | propertyString = @"Boolean"; 36 | break; 37 | case RLMPropertyTypeFloat: 38 | propertyString = @"Float"; 39 | break; 40 | case RLMPropertyTypeDouble: 41 | propertyString = @"Double"; 42 | break; 43 | case RLMPropertyTypeString: 44 | propertyString = @"String"; 45 | break; 46 | case RLMPropertyTypeData: 47 | propertyString = @"Data"; 48 | break; 49 | case RLMPropertyTypeDate: 50 | propertyString = @"Date"; 51 | break; 52 | case RLMPropertyTypeObject: 53 | propertyString = self.objectClassName; 54 | break; 55 | case RLMPropertyTypeLinkingObjects: 56 | return [NSString stringWithFormat:@"LinkingObjects <%@>", self.linkOriginPropertyName]; 57 | default: 58 | return @"Unknown"; 59 | } 60 | 61 | if (self.array) { 62 | propertyString = [NSString stringWithFormat:@"Array <%@", propertyString]; 63 | } 64 | 65 | return propertyString; 66 | } 67 | 68 | - (NSString *)RLMBrowser_configurationDescription 69 | { 70 | NSString *description = self.optional ? @"Optional" : @"Non-Optional"; 71 | if (self.indexed) { 72 | description = [description stringByAppendingString:@" • Indexed"]; 73 | } 74 | 75 | return description; 76 | } 77 | 78 | - (NSString *)RLMBrowser_typeAndConfigurationDescription 79 | { 80 | NSString *description = [self RLMBrowser_typeDescription]; 81 | 82 | BOOL numberProperty = (self.type == RLMPropertyTypeInt || self.type == RLMPropertyTypeBool 83 | || self.type == RLMPropertyTypeFloat || self.type == RLMPropertyTypeFloat); 84 | 85 | BOOL optional = (self.optional && numberProperty); 86 | BOOL indexed = self.indexed; 87 | 88 | if (!indexed && !optional) { 89 | return description; 90 | } 91 | 92 | description = [description stringByAppendingString:@" ("]; 93 | if (optional) { 94 | description = [description stringByAppendingFormat:@"Optional%@", indexed ? @" • " : nil]; 95 | } 96 | 97 | if (indexed) { 98 | [description stringByAppendingString:@"Indexed"]; 99 | } 100 | 101 | description = [description stringByAppendingString:@")"]; 102 | 103 | return description; 104 | } 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealm/RLMRealm+BrowserCaptureRealms.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmConfiguration+RLMRealmConfiguration_Capture.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMBrowserRealm; 26 | 27 | @interface RLMRealm (BrowserCapture) 28 | 29 | + (RLMRealm *)RLMBrowser_realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealm/RLMRealm+BrowserCaptureWrites.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealm+RLMRealm_UpdateCapture.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMRealm (BrowserCaptureWrites) 26 | 27 | + (void)RLMBrowser_updateSchemaObjectCountForRealmWithConfiguration:(RLMRealmConfiguration *)configuration; 28 | - (BOOL)RLMBrowser_commitWriteTransaction:(NSError *)error; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealm/RLMRealm+BrowserCaptureWrites.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealm+RLMRealm_UpdateCapture.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMRealm+BrowserCaptureWrites.h" 24 | #import "RLMRealm+BrowserCaptureRealms.h" 25 | #import 26 | 27 | #import "RLMBrowserConfiguration.h" 28 | #import "RLMBrowserRealm.h" 29 | 30 | #import 31 | 32 | @implementation RLMRealm (BrowserCaptureWrites) 33 | 34 | #pragma mark - Method Swizzling - 35 | 36 | + (void)load { 37 | static dispatch_once_t onceToken; 38 | dispatch_once(&onceToken, ^{ 39 | [RLMRealm RLMBrowser_swizzleSelector:@selector(commitWriteTransaction:) withSelector:@selector(RLMBrowser_commitWriteTransaction:)]; 40 | [RLMRealm RLMBrowser_swizzleSelector:@selector(commitWriteTransactionWithoutNotifying:error:) withSelector:@selector(RLMBrowser_commitWriteTransactionWithoutNotifying:error:)]; 41 | }); 42 | } 43 | 44 | + (void)RLMBrowser_swizzleSelector:(SEL)originalSelector withSelector:(SEL)swizzledSelector 45 | { 46 | Class class = [self class]; 47 | 48 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 49 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 50 | 51 | BOOL didAddMethod = class_addMethod(class, originalSelector, 52 | method_getImplementation(swizzledMethod), 53 | method_getTypeEncoding(swizzledMethod)); 54 | 55 | if (didAddMethod) { 56 | class_replaceMethod(class, swizzledSelector, 57 | method_getImplementation(originalMethod), 58 | method_getTypeEncoding(originalMethod)); 59 | } else { 60 | method_exchangeImplementations(originalMethod, swizzledMethod); 61 | } 62 | } 63 | 64 | #pragma mark - Swizzled Methods - 65 | 66 | - (BOOL)RLMBrowser_commitWriteTransaction:(NSError *)error 67 | { 68 | BOOL result = [self RLMBrowser_commitWriteTransaction:error]; 69 | if (result) { 70 | [RLMRealm RLMBrowser_updateSchemaObjectCountForRealmWithConfiguration:self.configuration]; 71 | } 72 | return result; 73 | } 74 | 75 | - (BOOL)RLMBrowser_commitWriteTransactionWithoutNotifying:(NSArray *)tokens error:(NSError **)error 76 | { 77 | BOOL result = [self RLMBrowser_commitWriteTransactionWithoutNotifying:tokens error:error]; 78 | if (result) { 79 | [RLMRealm RLMBrowser_updateSchemaObjectCountForRealmWithConfiguration:self.configuration]; 80 | } 81 | return result; 82 | } 83 | 84 | #pragma mark - Update Logic - 85 | + (dispatch_queue_t)RLMBrowser_schemaUpdateQueue 86 | { 87 | static dispatch_queue_t dispatchQueue; 88 | static dispatch_once_t onceToken; 89 | dispatch_once(&onceToken, ^{ 90 | dispatch_queue_attr_t qosAttribute = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_UTILITY, 0); 91 | dispatchQueue = dispatch_queue_create("io.realm.realmbrowser.coordinator", qosAttribute); 92 | }); 93 | 94 | return dispatchQueue; 95 | } 96 | 97 | + (void)RLMBrowser_updateSchemaObjectCountForRealmWithConfiguration:(RLMRealmConfiguration *)configuration 98 | { 99 | void (^updateSchemaBlock)(void) = ^{ 100 | RLMRealm *backgroundRealm = [RLMRealm RLMBrowser_realmWithConfiguration:configuration error:nil]; 101 | RLMRealm *browserRealm = [RLMRealm RLMBrowser_realmWithConfiguration:[RLMBrowserConfiguration configuration] error:nil]; 102 | if ([backgroundRealm isEqual:browserRealm]) { return; } 103 | 104 | RLMBrowserRealm *browserRealmObject = [RLMBrowserRealm allBrowserRealmObjectsInRealm:browserRealm forConfiguration:configuration].firstObject; 105 | if (browserRealmObject == nil) { return; } 106 | 107 | BOOL hasChanges = NO; 108 | [browserRealm beginWriteTransaction]; 109 | for (RLMBrowserSchema *schema in browserRealmObject.schema) { 110 | RLMResults *results = [backgroundRealm allObjects:schema.className]; 111 | if (schema.numberOfObjects != results.count) { 112 | schema.numberOfObjects = results.count; 113 | hasChanges = YES; 114 | } 115 | } 116 | 117 | if (hasChanges) { 118 | [browserRealm RLMBrowser_commitWriteTransaction:nil]; 119 | } 120 | else { 121 | [browserRealm cancelWriteTransaction]; 122 | } 123 | }; 124 | 125 | dispatch_async([RLMRealm RLMBrowser_schemaUpdateQueue], ^{ 126 | @autoreleasepool { updateSchemaBlock(); } 127 | }); 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealm/RLMRealm+RealmBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealm.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMRealm (RealmBrowser) 26 | 27 | + (instancetype)defaultBrowserRealm; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealm/RLMRealm+RealmBrowser.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealm.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserRealm.h" 24 | #import "RLMBrowserConfiguration.h" 25 | 26 | @implementation RLMRealm (RealmBrowser) 27 | 28 | + (instancetype)defaultBrowserRealm 29 | { 30 | return [RLMRealm realmWithConfiguration:[RLMBrowserConfiguration configuration] error:nil]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealmConfiguration/RLMRealmConfiguration+BrowserCompare.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmConfiguration+BrowserCompare.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMRealmConfiguration (BrowserCompare) 26 | 27 | - (BOOL)RLMBrowser_isEqualToConfiguration:(RLMRealmConfiguration *)configuration; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/RLMRealmConfiguration/RLMRealmConfiguration+BrowserCompare.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmConfiguration+BrowserCompare.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMRealmConfiguration+BrowserCompare.h" 24 | 25 | @implementation RLMRealmConfiguration (BrowserCompare) 26 | 27 | - (BOOL)RLMBrowser_isEqualToConfiguration:(RLMRealmConfiguration *)configuration 28 | { 29 | if ([configuration.fileURL isEqual:self.fileURL]) { 30 | return YES; 31 | } 32 | else if ([configuration.inMemoryIdentifier isEqualToString:self.inMemoryIdentifier]) { 33 | return YES; 34 | } 35 | 36 | else if ([configuration.syncConfiguration isEqual:self.syncConfiguration]) { 37 | return YES; 38 | } 39 | 40 | return NO; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/UIColor/UIColor+BrowserRealmColors.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+RealmColors.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface UIColor (BrowserRealmColors) 26 | 27 | + (NSArray *)RLMBrowser_realmColors; 28 | + (NSArray *)RLMBrowser_realmColorsLight; 29 | + (NSArray *)RLMBrowser_realmColorsInvertedRepeating; 30 | + (NSArray *)RLMBrowser_realmColorsLightInvertedRepeating; 31 | @end 32 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/UIColor/UIColor+BrowserRealmColors.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+RealmColors.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "UIColor+BrowserRealmColors.h" 24 | 25 | @implementation UIColor (BrowserRealmColors) 26 | 27 | + (NSArray *)RLMBrowser_realmColors 28 | { 29 | return @[[UIColor colorWithRed:252.0f/255.0f green:195.0f/255.0f blue:151.0f/255.0f alpha:1.0f], 30 | [UIColor colorWithRed:252.0f/255.0f green:158.0f/255.0f blue:148.0f/255.0f alpha:1.0f], 31 | [UIColor colorWithRed:247.0f/255.0f green:124.0f/255.0f blue:135.0f/255.0f alpha:1.0f], 32 | [UIColor colorWithRed:242.0f/255.0f green:81.0f/255.0f blue:145.0f/255.0f alpha:1.0f], 33 | [UIColor colorWithRed:211.0f/255.0f green:75.0f/255.0f blue:163.0f/255.0f alpha:1.0f], 34 | [UIColor colorWithRed:154.0f/255.0f green:80.0f/255.0f blue:164.0f/255.0f alpha:1.0f], 35 | [UIColor colorWithRed:88.0f/255.0f green:86.0f/255.0f blue:157.0f/255.0f alpha:1.0f], 36 | [UIColor colorWithRed:56.0f/255.0f green:71.0f/255.0f blue:126.0f/255.0f alpha:1.0f] 37 | ]; 38 | } 39 | 40 | + (NSArray *)RLMBrowser_realmColorsLight 41 | { 42 | return @[[UIColor colorWithRed:253.0f/255.0f green:249.0f/255.0f blue:245.0f/255.0f alpha:1.0f], 43 | [UIColor colorWithRed:252.0f/255.0f green:246.0f/255.0f blue:245.0f/255.0f alpha:1.0f], 44 | [UIColor colorWithRed:252.0f/255.0f green:243.0f/255.0f blue:244.0f/255.0f alpha:1.0f], 45 | [UIColor colorWithRed:251.0f/255.0f green:240.0f/255.0f blue:245.0f/255.0f alpha:1.0f], 46 | [UIColor colorWithRed:248.0f/255.0f green:240.0f/255.0f blue:246.0f/255.0f alpha:1.0f], 47 | [UIColor colorWithRed:244.0f/255.0f green:239.0f/255.0f blue:246.0f/255.0f alpha:1.0f], 48 | [UIColor colorWithRed:240.0f/255.0f green:239.0f/255.0f blue:245.0f/255.0f alpha:1.0f], 49 | [UIColor colorWithRed:238.0f/255.0f green:238.0f/255.0f blue:243.0f/255.0f alpha:1.0f] 50 | ]; 51 | } 52 | 53 | + (NSArray *)RLMBrowser_realmColorsInvertedRepeating 54 | { 55 | NSArray *realmColors = [UIColor RLMBrowser_realmColors]; 56 | NSArray *invertedColors = [[realmColors reverseObjectEnumerator] allObjects]; 57 | 58 | NSMutableArray *colors = [NSMutableArray array]; 59 | [colors addObjectsFromArray:invertedColors]; 60 | [colors removeLastObject]; // Remove repeating color 61 | [colors addObjectsFromArray:realmColors]; 62 | [colors removeLastObject]; // Remove repeating color 63 | 64 | return [NSArray arrayWithArray:colors]; 65 | } 66 | 67 | + (NSArray *)RLMBrowser_realmColorsLightInvertedRepeating 68 | { 69 | NSArray *realmColors = [UIColor RLMBrowser_realmColorsLight]; 70 | NSArray *invertedColors = [[realmColors reverseObjectEnumerator] allObjects]; 71 | 72 | NSMutableArray *colors = [NSMutableArray array]; 73 | [colors addObjectsFromArray:invertedColors]; 74 | [colors removeLastObject]; // Remove repeating color 75 | [colors addObjectsFromArray:realmColors]; 76 | [colors removeLastObject]; // Remove repeating color 77 | 78 | return [NSArray arrayWithArray:colors]; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/UIImage/UIImage+BrowserIcons.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+BrowserTagIcons.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface UIImage (BrowserIcons) 26 | 27 | /* Small Realm icons for the Realms list view */ 28 | + (UIImage *)RLMBrowser_localRealmIcon; 29 | + (UIImage *)RLMBrowser_syncRealmIcon; 30 | + (UIImage *)RLMBrowser_inMemoryRealmIcon; 31 | 32 | /* Larger versions of the icons for the Realm info view */ 33 | + (UIImage *)RLMBrowser_localRealmLargeIcon; 34 | + (UIImage *)RLMBrowser_syncRealmLargeIcon; 35 | + (UIImage *)RLMBrowser_inMemoryRealmLargeIcon; 36 | 37 | /* Icon for the schema row of a Realm */ 38 | + (UIImage *)RLMBrowser_schemaIconForColor:(UIColor *)color; 39 | 40 | /* Icon indicating the Realm is using encryption */ 41 | + (UIImage *)RLMBrowser_encryptedIcon; 42 | 43 | /* A circle icon that can be tinted */ 44 | + (UIImage *)RLMBrowser_tintedCircleImageForRadius:(CGFloat)radius; 45 | 46 | /* A spanner icon for the Realm schema settings icon */ 47 | + (UIImage *)RLMBrowser_tweaksIcon; 48 | 49 | /* A standard Apple-style 'Quick Look' icon for more complex data like URLs and Data */ 50 | + (UIImage *)RLMBrowser_quickLookIcon; 51 | 52 | /* A chevron icon used for the collapsable Realm list sections */ 53 | + (UIImage *)RLMBrowser_headerDisclosureArrowIcon; 54 | 55 | /* A checkmark icon for the Realm schema configuration view */ 56 | + (UIImage *)RLMBrowser_checkmarkIcon; 57 | 58 | /* A favorite icon used to save specific Realms in the favorites list */ 59 | + (UIImage *)RLMBrowser_favoriteIconFilled:(BOOL)filled; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/UILabel/UILabel+RealmBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+RealmBrowser.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface UILabel (RealmBrowser) 26 | 27 | + (UILabel *)RLMBrowser_toolbarLabelWithText:(NSString *)text; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RealmBrowser/Categories/UILabel/UILabel+RealmBrowser.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+RealmBrowser.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "UILabel+RealmBrowser.h" 24 | 25 | @implementation UILabel (RealmBrowser) 26 | 27 | + (UILabel *)RLMBrowser_toolbarLabelWithText:(NSString *)text 28 | { 29 | UILabel *label = [[UILabel alloc] init]; 30 | label.font = [UIFont systemFontOfSize:11.0f]; 31 | label.textAlignment = NSTextAlignmentCenter; 32 | label.textColor = [UIColor blackColor]; 33 | label.text = text; 34 | [label sizeToFit]; 35 | return label; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserEmptyViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserEmptyViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserEmptyViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserEmptyViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserEmptyViewController.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserEmptyViewController.h" 24 | #import "RLMBrowserEmptyContentView.h" 25 | #import "RLMRealmMonochromeLogoView.h" 26 | #import "RLMRealmLogoView.h" 27 | 28 | @interface RLMBrowserEmptyViewController () 29 | 30 | @property (nonatomic, strong) RLMBrowserEmptyContentView *emptyView; 31 | 32 | @end 33 | 34 | @implementation RLMBrowserEmptyViewController 35 | 36 | - (void)viewDidLoad 37 | { 38 | [super viewDidLoad]; 39 | 40 | self.emptyView = [RLMBrowserEmptyContentView emptyView]; 41 | self.emptyView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | 42 | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; 43 | self.emptyView.center = (CGPoint){CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds)}; 44 | [self.view addSubview:self.emptyView]; 45 | 46 | self.view.backgroundColor = [UIColor colorWithRed:238.0f/255.0f green:239.0f/255.0f blue:244.0f/255.0f alpha:1.0f]; 47 | 48 | self.navigationItem.titleView = [[RLMRealmLogoView alloc] initWithFrame:(CGRect){0,0,30,30}]; 49 | 50 | NSString *appName = [[[NSBundle bundleForClass:self.class] infoDictionary] objectForKey:(id)kCFBundleNameKey]; 51 | NSString *subtitleString = [NSString stringWithFormat:NSLocalizedString(@"%@ needs to open each Realm before it will appear here.", @""), appName]; 52 | self.emptyView.subtitleLabel.text = subtitleString; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserLogoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserLogoViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserLogoViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserLogoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserLogoViewController.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserConstants.h" 24 | #import "RLMBrowserLogoViewController.h" 25 | #import "RLMRealmMonochromeLogoView.h" 26 | 27 | @interface RLMBrowserLogoViewController () 28 | @property (nonatomic, strong) RLMRealmMonochromeLogoView *logoView; 29 | @end 30 | 31 | @implementation RLMBrowserLogoViewController 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | RLM_RESET_NAVIGATION_CONTROLLER(self.navigationController); 37 | 38 | self.view.backgroundColor = [UIColor colorWithRed:238.0f/255.0f green:239.0f/255.0f blue:244.0f/255.0f alpha:1.0f]; 39 | 40 | self.logoView = [[RLMRealmMonochromeLogoView alloc] initWithFrame:(CGRect){0,0,150,150}]; 41 | self.logoView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin 42 | | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 43 | self.logoView.center = self.view.center; 44 | [self.view addSubview:self.logoView]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserObjectListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmsViewControllerTableViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMBrowserRealm; 26 | @class RLMBrowserSchema; 27 | 28 | @interface RLMBrowserObjectListViewController : UITableViewController 29 | 30 | - (instancetype)initWithBrowserRealm:(RLMBrowserRealm *)realm browserSchema:(RLMBrowserSchema *)schema; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserObjectSchemaPickerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectSchemaViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMObject; 26 | @class RLMBrowserRealm; 27 | @class RLMBrowserSchema; 28 | 29 | @interface RLMBrowserObjectSchemaPickerViewController : UIViewController 30 | 31 | @property (nonatomic, copy) void (^doneHandler)(void); 32 | 33 | - (instancetype)initWithBrowserRealm:(RLMBrowserRealm *)realm browserSchema:(RLMBrowserSchema *)schema demoObject:(RLMObject *)object; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserObjectSchemaViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectSchemaViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | @interface RLMBrowserObjectSchemaViewController : UITableViewController 27 | 28 | - (instancetype)initWithObjectSchema:(RLMObjectSchema *)objectSchema; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserObjectSchemaViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectSchemaViewController.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserObjectSchemaViewController.h" 24 | #import "UIImage+BrowserIcons.h" 25 | #import "RLMBrowserPropertyTableViewCell.h" 26 | #import "UIColor+BrowserRealmColors.h" 27 | 28 | static NSString *kRLMBrowserObjectPropertyTableViewCellIdentifier = @"PropertyCell"; 29 | 30 | @interface RLMBrowserObjectSchemaViewController () 31 | 32 | @property (nonatomic, strong) RLMObjectSchema *objectSchema; 33 | @property (nonatomic, strong) UIImage *circleImage; 34 | @property (nonatomic, strong) NSArray *realmColors; 35 | 36 | @end 37 | 38 | @implementation RLMBrowserObjectSchemaViewController 39 | 40 | - (instancetype)initWithObjectSchema:(RLMObjectSchema *)objectSchema 41 | { 42 | if (self = [super initWithStyle:UITableViewStyleGrouped]) { 43 | _objectSchema = objectSchema; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (void)viewDidLoad { 50 | [super viewDidLoad]; 51 | self.title = self.objectSchema.className; 52 | self.tableView.rowHeight = 54.0f; 53 | 54 | self.circleImage = [UIImage RLMBrowser_tintedCircleImageForRadius:15.0f]; 55 | self.realmColors = self.realmColors = [[[UIColor RLMBrowser_realmColors] reverseObjectEnumerator] allObjects]; 56 | 57 | NSBundle *bundle = [NSBundle bundleForClass:self.class]; 58 | UINib *tableNib = [UINib nibWithNibName:@"RLMBrowserPropertyTableViewCell" bundle:bundle]; 59 | [self.tableView registerNib:tableNib forCellReuseIdentifier:kRLMBrowserObjectPropertyTableViewCellIdentifier]; 60 | 61 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonTapped)]; 62 | } 63 | 64 | - (CGSize)preferredContentSize 65 | { 66 | CGSize preferredSize = CGSizeZero; 67 | preferredSize.width = 350.0; 68 | preferredSize.height = (self.tableView.rowHeight * self.objectSchema.properties.count) + 60.0f; 69 | return preferredSize; 70 | } 71 | 72 | - (void)doneButtonTapped 73 | { 74 | [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; 75 | } 76 | 77 | #pragma mark - Table view data source 78 | 79 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 80 | return 1; 81 | } 82 | 83 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 84 | return self.objectSchema.properties.count; 85 | } 86 | 87 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 88 | RLMBrowserPropertyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kRLMBrowserObjectPropertyTableViewCellIdentifier 89 | forIndexPath:indexPath]; 90 | cell.iconView.image = self.circleImage; 91 | cell.iconView.tintColor = self.realmColors[indexPath.row % self.realmColors.count]; 92 | 93 | RLMProperty *property = self.objectSchema.properties[indexPath.row]; 94 | [cell configureCellWithProperty:property]; 95 | 96 | return cell; 97 | } 98 | 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserObjectViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | @class RLMBrowserRealm; 27 | @class RLMBrowserSchema; 28 | 29 | @interface RLMBrowserObjectViewController : UITableViewController 30 | 31 | - (instancetype)initWithObject:(RLMObject *)realmObject 32 | forBrowserRealm:(RLMBrowserRealm *)realm 33 | browserSchema:(RLMBrowserSchema *)schema; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserRealmListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmsViewControllerTableViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserRealmListViewController : UITableViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RealmBrowser/Controllers/RLMBrowserRealmTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmTableViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMBrowserList; 26 | @class RLMBrowserRealm; 27 | 28 | @interface RLMBrowserRealmTableViewController : UITableViewController 29 | 30 | @property (nonatomic, readonly) RLMBrowserList *browserList; 31 | @property (nonatomic, readonly) RLMBrowserRealm *browserRealm; 32 | @property (nonatomic, assign) BOOL isDefaultRealm; 33 | 34 | - (instancetype)initWithBrowserRealm:(RLMBrowserRealm *)realm browserList:(RLMBrowserList *)list; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Configuration/RLMBrowserConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserConfiguration.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserConfiguration : RLMRealmConfiguration 26 | 27 | + (RLMRealmConfiguration *)configuration; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Configuration/RLMBrowserConfiguration.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserConfiguration.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserConfiguration.h" 24 | #import "RLMBrowserConstants.h" 25 | 26 | #import "RLMBrowserList.h" 27 | #import "RLMBrowserRealm.h" 28 | #import "RLMBrowserSchema.h" 29 | #import "RLMBrowserObjectProperty.h" 30 | #import "RLMBrowserAppGroupRealm.h" 31 | 32 | @implementation RLMBrowserConfiguration 33 | 34 | + (RLMRealmConfiguration *)configuration 35 | { 36 | // Get Application Support directory 37 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); 38 | NSString *applicationSupportDirectory = [paths firstObject]; 39 | 40 | // Create a uniquely named folder to store the Browser Realm 41 | NSString *browserRealmDirectory = [applicationSupportDirectory stringByAppendingPathComponent:kRLMBrowserIdentifier]; 42 | [[NSFileManager defaultManager] createDirectoryAtPath:browserRealmDirectory withIntermediateDirectories:YES attributes:nil error:nil]; 43 | 44 | // Build the final file path to the Realm file 45 | NSString *browserRealmPath = [browserRealmDirectory stringByAppendingPathComponent:@"browser.realm"]; 46 | 47 | // Generate the Realm Configuration 48 | RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init]; 49 | configuration.fileURL = [NSURL fileURLWithPath:browserRealmPath]; 50 | configuration.objectClasses = @[[RLMBrowserObjectProperty class], 51 | [RLMBrowserSchema class], 52 | [RLMBrowserRealm class], 53 | [RLMBrowserList class], 54 | [RLMBrowserAppGroupRealm class]]; 55 | 56 | configuration.deleteRealmIfMigrationNeeded = YES; 57 | return configuration; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Global/RLMBrowserConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserConstants.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | #import 26 | 27 | extern NSString * const kRLMBrowserIdentifier; 28 | 29 | @interface UIColor (RLMBrowserColors) 30 | + (UIColor *)RLMBrowser_tableBackgroundColor; 31 | @end 32 | 33 | static inline void RLM_RESET_NAVIGATION_CONTROLLER(UINavigationController *navController) { 34 | navController.navigationBar.barStyle = UIBarStyleDefault; 35 | navController.navigationBar.tintColor = nil; 36 | navController.navigationBar.barTintColor = nil; 37 | navController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor blackColor]}; 38 | } 39 | 40 | static inline NSString *RLM_OBJECT_VALUE_DESCRIPTION(RLMObject *object, NSString *key) { 41 | RLMProperty *property = object.objectSchema[key]; 42 | if (property == nil) { return nil; } 43 | 44 | switch (property.type) { 45 | case RLMPropertyTypeInt: 46 | case RLMPropertyTypeBool: 47 | case RLMPropertyTypeFloat: 48 | case RLMPropertyTypeDouble: 49 | case RLMPropertyTypeString: 50 | { 51 | NSString *string = [object[key] description]; 52 | return (string.length > 0 ? string : nil); 53 | } 54 | case RLMPropertyTypeData: 55 | { 56 | NSData *data = object[key]; 57 | if (!data || data.length == 0) { return nil; } 58 | NSString *formattedSize = [NSByteCountFormatter stringFromByteCount:data.length countStyle:NSByteCountFormatterCountStyleMemory]; 59 | return [NSString stringWithFormat:@"Data - %@", formattedSize]; 60 | } 61 | case RLMPropertyTypeDate: 62 | { 63 | NSDate *date = object[key]; 64 | if (!date) { return nil; } 65 | return date.description; 66 | } 67 | case RLMPropertyTypeObject: 68 | { 69 | RLMObject *childObject = object[key]; 70 | if (!childObject) { return nil; } 71 | return childObject.objectSchema.className; 72 | } 73 | // case RLMPropertyTypeArray: 74 | // { 75 | // RLMArray *array = object[key]; 76 | // NSString *className = array.objectClassName; 77 | // return [NSString stringWithFormat:@"RLMArray<%@>", className]; 78 | // } 79 | default: return nil; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Global/RLMBrowserConstants.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserConstants.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserConstants.h" 24 | 25 | NSString * const kRLMBrowserIdentifier = @"io.realm.browser"; 26 | 27 | @implementation UIColor(RLMBrowserColors) 28 | 29 | + (UIColor *)RLMBrowser_tableBackgroundColor { 30 | return [UIColor colorWithRed:238.0f/255.0f green:239.0f/255.0f blue:244.0f/255.0f alpha:1.0f]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserAppGroupRealm.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserAppGroupRealm.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserAppGroupRealm : RLMObject 26 | 27 | @property (nonatomic, copy) NSString *groupIdentifier; 28 | @property (nonatomic, copy) NSString *realmFilePath; 29 | 30 | @end 31 | 32 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserAppGroupRealm.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserAppGroupRealm.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserAppGroupRealm.h" 24 | 25 | @implementation RLMBrowserAppGroupRealm 26 | 27 | + (NSArray *)indexedProperties 28 | { 29 | return @[@"realmFilePath", @"groupIdentifier"]; 30 | } 31 | 32 | + (BOOL)shouldIncludeInDefaultSchema 33 | { 34 | return NO; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserList.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserList.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import "RLMBrowserRealm.h" 25 | 26 | NS_ASSUME_NONNULL_BEGIN 27 | 28 | @interface RLMBrowserList : RLMObject 29 | 30 | /** UI State Persistence */ 31 | @property (nonatomic, assign) BOOL defaultRealmCollapsed; 32 | @property (nonatomic, assign) BOOL starredRealmsCollapsed; 33 | @property (nonatomic, assign) BOOL allRealmsCollapsed; 34 | 35 | /** The default Realm for this app */ 36 | @property (nonatomic, strong) RLMBrowserRealm *defaultRealm; 37 | 38 | /** Any Realms the user explicitly favorited */ 39 | @property (nonatomic, strong) RLMArray *starredRealms; 40 | 41 | /** The remaining list of Realms, ordered by most recently touched */ 42 | @property (nonatomic, strong) RLMArray *allRealms; 43 | 44 | + (instancetype)defaultListInRealm:(RLMRealm *)realm; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserList.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserList.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserList.h" 24 | 25 | @implementation RLMBrowserList 26 | 27 | + (instancetype)defaultListInRealm:(RLMRealm *)realm 28 | { 29 | return [RLMBrowserList allObjectsInRealm:realm].firstObject; 30 | } 31 | 32 | + (BOOL)shouldIncludeInDefaultSchema 33 | { 34 | return NO; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserObjectProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectProperty.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | @interface RLMBrowserObjectProperty : RLMObject 28 | 29 | @property (nonatomic, copy) NSString *name; 30 | 31 | @end 32 | 33 | RLM_ARRAY_TYPE(RLMBrowserObjectProperty) 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserObjectProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectProperty.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserObjectProperty.h" 24 | 25 | @implementation RLMBrowserObjectProperty 26 | 27 | + (BOOL)shouldIncludeInDefaultSchema 28 | { 29 | return NO; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserRealm.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealm.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import "RLMBrowserSchema.h" 25 | #import "RLMBrowserAppGroupRealm.h" 26 | 27 | NS_ASSUME_NONNULL_BEGIN 28 | 29 | typedef NS_ENUM(NSInteger, RLMBrowserRealmType) { 30 | RLMBrowserRealmTypeLocal, 31 | RLMBrowserRealmTypeInMemory, 32 | RLMBrowserRealmTypeSync 33 | }; 34 | 35 | /* Snapshot data from the `RLMRealmConfiguration` of a Realm opened at runtime */ 36 | @interface RLMBrowserRealm : RLMObject 37 | 38 | /* The objet primary key */ 39 | @property (nonatomic, copy) NSString *uuid; 40 | 41 | /* A displayable string identifying this Realm */ 42 | @property (nonatomic, copy) NSString *name; 43 | 44 | /* File/Memory/Web Location of the Realm */ 45 | @property (nonatomic, copy) NSString *filePath; 46 | @property (nonatomic, copy) NSString *inMemoryIdentifier; 47 | @property (nonatomic, copy) NSString *syncURL; 48 | @property (nonatomic, copy) NSString *syncUserIdentifier; 49 | 50 | /* Encryption key of this Realm */ 51 | @property (nonatomic, copy) NSData *encryptionKey; 52 | 53 | /* Read-Write state of Realm file */ 54 | @property (nonatomic, assign) BOOL readOnly; 55 | 56 | /* A copy of the schema version */ 57 | @property (nonatomic, assign) long long schemaVersion; 58 | 59 | /* The schema in this Realm file */ 60 | @property (nonatomic, strong) RLMArray *schema; 61 | 62 | /* The absolute file path to this Realm */ 63 | @property (nonatomic, readonly) NSString *absoluteFilePath; 64 | 65 | /* A formatted description of its location */ 66 | @property (nonatomic, readonly) NSString *formattedLocation; 67 | 68 | /* An appropriately formatted configuration file to open this Realm. */ 69 | @property (nonatomic, readonly) RLMRealmConfiguration *realmConfiguration; 70 | 71 | /* The type of Realm container this instance reporesents */ 72 | @property (nonatomic, readonly) RLMBrowserRealmType type; 73 | 74 | /* If an app group, this is linked to give us context to derive the file path */ 75 | @property (nonatomic, strong) RLMBrowserAppGroupRealm *appGroup; 76 | 77 | /* A displayable string identifying the type of this Realm */ 78 | @property (nonatomic, readonly) NSString *localizedType; 79 | 80 | /* Convert any absolute file paths to relative before saving */ 81 | + (NSString *)relativeFilePathFromAbsolutePath:(NSString *)path; 82 | 83 | /* Query for any browser realm objects matching a configuration object */ 84 | + (RLMResults *)allBrowserRealmObjectsInRealm:(RLMRealm *)realm forConfiguration:(RLMRealmConfiguration *)configuration; 85 | 86 | @end 87 | 88 | RLM_ARRAY_TYPE(RLMBrowserRealm) 89 | 90 | NS_ASSUME_NONNULL_END 91 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserSchema.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserSchema.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import "RLMBrowserObjectProperty.h" 26 | 27 | NS_ASSUME_NONNULL_BEGIN 28 | 29 | /** A basic representation of each object schema backed by the parent Realm */ 30 | @interface RLMBrowserSchema : RLMObject 31 | 32 | /** The name of the class that's being backed by this object schema. */ 33 | @property (nonatomic, copy) NSString *className; 34 | 35 | /** The number of objects persisted in this object */ 36 | @property (nonatomic, assign) NSInteger numberOfObjects; 37 | 38 | /** The preferred property to represent objects from this schema. (e.g. 'name' over 'uuid') */ 39 | @property (nonatomic, copy) NSString *preferredPropertyName; 40 | 41 | /** The preferred secondary names to be displayed alongside the primary one */ 42 | @property (nonatomic, strong) RLMArray *secondaryPropertyNames; 43 | 44 | /** Export a copy of the secondary proeprty names as strings */ 45 | @property (nonatomic, readonly) NSArray *secondaryPropertyNameStrings; 46 | 47 | /** Given a list of properties, work out the most appropriate for display as the main property */ 48 | + (NSString *)preferredPropertyClassNameFromProperties:(NSArray *)properties; 49 | 50 | /** Given a list of properties, work out the best ones for display under the main property. */ 51 | + (NSArray *)preferredSecondaryPropertyClassNamesFromProperties:(NSArray *)properties maximumCount:(NSInteger)maximumCount excludingPropertyClassName:(NSString *)excludedName; 52 | 53 | @end 54 | 55 | RLM_ARRAY_TYPE(RLMBrowserSchema) 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /RealmBrowser/Models/RealmObjects/RLMBrowserSchema.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserSchema.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | #import "RLMBrowserSchema.h" 23 | 24 | @implementation RLMBrowserSchema 25 | 26 | + (NSArray *)ignoredProperties 27 | { 28 | return @[@"secondaryPropertyNameStrings"]; 29 | } 30 | 31 | + (NSString *)preferredPropertyClassNameFromProperties:(NSArray *)properties 32 | { 33 | for (RLMProperty *property in properties) { 34 | // Skip if not a string 35 | if (property.type != RLMPropertyTypeString) { 36 | continue; 37 | } 38 | // Skip if it contains 'ID' 39 | if ([property.name rangeOfString:@"ID" options:NSCaseInsensitiveSearch].location != NSNotFound) { 40 | continue; 41 | } 42 | 43 | return property.name; 44 | } 45 | 46 | // If all else fails, default to the first property 47 | return [properties.firstObject name]; 48 | } 49 | 50 | + (NSArray *)preferredSecondaryPropertyClassNamesFromProperties:(NSArray *)properties 51 | maximumCount:(NSInteger)maximumCount 52 | excludingPropertyClassName:(NSString *)excludedName 53 | { 54 | NSMutableArray *newProperties = [NSMutableArray array]; 55 | for (RLMProperty *property in properties) { 56 | if ([property.name isEqualToString:excludedName]) { continue; } 57 | [newProperties addObject:property.name]; 58 | if (newProperties.count >= maximumCount) { break; } 59 | } 60 | 61 | return [NSArray arrayWithArray:newProperties]; 62 | } 63 | 64 | + (BOOL)shouldIncludeInDefaultSchema 65 | { 66 | return NO; 67 | } 68 | 69 | - (NSArray *)secondaryPropertyNameStrings 70 | { 71 | NSMutableArray *properties = [NSMutableArray array]; 72 | for (RLMBrowserObjectProperty *property in self.secondaryPropertyNames) { 73 | [properties addObject:property.name]; 74 | } 75 | return properties; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Services/RLMBrowserObjectsCoordinator.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectsCoordinator.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMRealm; 26 | 27 | @interface RLMBrowserObjectsCoordinator : NSObject 28 | 29 | + (void)clearExpiredRealmObjects; 30 | + (void)updateSchemaObjectCountInRealm:(RLMRealm *)realm; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RealmBrowser/Models/Services/RLMBrowserObjectsCoordinator.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectsCoordinator.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserObjectsCoordinator.h" 24 | #import "RLMBrowserConfiguration.h" 25 | #import "RLMBrowserRealm.h" 26 | 27 | #import 28 | #import 29 | 30 | @implementation RLMBrowserObjectsCoordinator 31 | 32 | + (dispatch_queue_t)sharedDispatchQueue 33 | { 34 | static dispatch_queue_t dispatchQueue; 35 | static dispatch_once_t onceToken; 36 | dispatch_once(&onceToken, ^{ 37 | dispatch_queue_attr_t qosAttribute = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_UTILITY, 0); 38 | dispatchQueue = dispatch_queue_create("io.realm.realmbrowser.coordinator", qosAttribute); 39 | }); 40 | 41 | return dispatchQueue; 42 | } 43 | 44 | + (void)clearExpiredRealmObjects 45 | { 46 | static BOOL previouslyCompleted = NO; 47 | if (previouslyCompleted) { return; } 48 | 49 | 50 | } 51 | 52 | + (void)updateSchemaObjectCountInRealm:(RLMRealm *)realm 53 | { 54 | RLMRealmConfiguration *configuration = realm.configuration; 55 | 56 | void (^updateSchemaBlock)(void) = ^{ 57 | RLMRealm *browserRealm = [RLMRealm realmWithConfiguration:[RLMBrowserConfiguration configuration] error:nil]; 58 | RLMBrowserRealm *browserRealmObject = [RLMBrowserRealm allBrowserRealmObjectsInRealm:browserRealm forConfiguration:configuration].firstObject; 59 | if (browserRealmObject == nil) { return; } 60 | 61 | RLMRealm *backgroundRealm = [RLMRealm realmWithConfiguration:configuration error:nil]; 62 | 63 | BOOL hasChanges = NO; 64 | [browserRealm beginWriteTransaction]; 65 | for (RLMBrowserSchema *schema in browserRealmObject.schema) { 66 | RLMResults *results = [backgroundRealm allObjects:schema.className]; 67 | if (schema.numberOfObjects != results.count) { 68 | schema.numberOfObjects = results.count; 69 | hasChanges = YES; 70 | } 71 | } 72 | 73 | if (hasChanges) { 74 | [browserRealm commitWriteTransaction]; 75 | } 76 | else { 77 | [browserRealm cancelWriteTransaction]; 78 | } 79 | }; 80 | 81 | dispatch_async([RLMBrowserObjectsCoordinator sharedDispatchQueue], ^{ 82 | @autoreleasepool { updateSchemaBlock(); } 83 | }); 84 | } 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /RealmBrowser/RLMBrowserViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserViewController.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | @interface RLMBrowserViewController : TOSplitViewController 27 | 28 | + (void)registerAppGroupRealmAtRelativePath:(NSString *)path forGroupIdentifier:(NSString *)identifier; 29 | 30 | - (void)show; 31 | + (void)show; 32 | 33 | + (void)reset; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RealmBrowser/Views/EmptyContentViews/RLMBrowserEmptyContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserEmptyView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @class RLMRealmMonochromeLogoView; 26 | 27 | @interface RLMBrowserEmptyContentView : UIView 28 | 29 | @property (nonatomic, weak) IBOutlet RLMRealmMonochromeLogoView *logoView; 30 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 31 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 32 | 33 | + (instancetype)emptyView; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RealmBrowser/Views/EmptyContentViews/RLMBrowserEmptyContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserEmptyView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserEmptyContentView.h" 24 | #import "RLMRealmMonochromeLogoView.h" 25 | 26 | @implementation RLMBrowserEmptyContentView 27 | 28 | + (instancetype)emptyView 29 | { 30 | return [[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserEmptyContentView" owner:self options:nil].firstObject; 31 | } 32 | 33 | - (void)awakeFromNib 34 | { 35 | [super awakeFromNib]; 36 | self.logoView.backgroundColor = [UIColor clearColor]; 37 | self.logoView.strokeColor = [UIColor colorWithWhite:0.7f alpha:1.0f]; 38 | self.logoView.strokeWidth = 5.0f; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /RealmBrowser/Views/EmptyContentViews/RLMBrowserEmptyContentView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /RealmBrowser/Views/FooterView/RLMBrowserSchemaPreviewView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserSchemaPreviewView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import "RLMBrowserObjectListContentView.h" 26 | 27 | @interface RLMBrowserSchemaPreviewView : UIView 28 | 29 | @property (nonatomic, strong) IBOutlet UIView *contentView; 30 | @property (nonatomic, strong) IBOutlet UIView *topSeparatorView; 31 | @property (nonatomic, strong) IBOutlet UIView *bottomSeparatorView; 32 | @property (nonatomic, strong) IBOutlet UIView *viewSeparatorView; 33 | @property (nonatomic, strong) IBOutlet UILabel *label; 34 | @property (nonatomic, strong) IBOutlet UIView *navbar; 35 | @property (nonatomic, strong) RLMBrowserObjectListContentView *objectPreviewView; 36 | 37 | + (instancetype)contentView; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /RealmBrowser/Views/FooterView/RLMBrowserSchemaPreviewView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserSchemaPreviewView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserSchemaPreviewView.h" 24 | 25 | @implementation RLMBrowserSchemaPreviewView 26 | 27 | + (instancetype)contentView 28 | { 29 | return [[[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserSchemaPreviewView" owner:self options:nil] firstObject]; 30 | } 31 | 32 | - (void)awakeFromNib 33 | { 34 | [super awakeFromNib]; 35 | 36 | CGFloat height = 1.0f / [UIScreen mainScreen].scale; 37 | 38 | // Set the separator to the physical pixel height 39 | CGRect frame = self.topSeparatorView.frame; 40 | frame.size.height = height; 41 | self.topSeparatorView.frame = frame; 42 | 43 | frame = self.bottomSeparatorView.frame; 44 | frame.size.height = height; 45 | self.bottomSeparatorView.frame = frame; 46 | 47 | // Set the toolbar height 48 | self.navbar.frame = self.bounds; 49 | 50 | // Create the preview view 51 | self.objectPreviewView = [RLMBrowserObjectListContentView objectListContentView]; 52 | self.objectPreviewView.frame = CGRectInset(self.contentView.bounds, 0.0f, 1.0f); 53 | [self.contentView addSubview:self.objectPreviewView]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /RealmBrowser/Views/FooterView/RLMBrowserSchemaPreviewView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserNavigationTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectListHeaderView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserNavigationTitleView : UIView 26 | 27 | @property (nonatomic, strong) IBOutlet UILabel *titleLabel; 28 | @property (nonatomic, strong) IBOutlet UILabel *subtitleLabel; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserNavigationTitleView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectListHeaderView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserNavigationTitleView.h" 24 | 25 | @implementation RLMBrowserNavigationTitleView 26 | 27 | - (instancetype)init 28 | { 29 | if ((self = [[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserNavigationTitleView" 30 | owner:self options:nil].firstObject)) { 31 | 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (void)setAutoresizingMask:(UIViewAutoresizing)autoresizingMask 38 | { 39 | return [super setAutoresizingMask:autoresizingMask]; 40 | } 41 | 42 | - (void)sizeToFit 43 | { 44 | CGSize titleSize = [self.titleLabel sizeThatFits:self.bounds.size]; 45 | CGSize subtitleSize = [self.subtitleLabel sizeThatFits:self.bounds.size]; 46 | CGSize newSize = (CGSize){MAX(titleSize.width, subtitleSize.width), self.bounds.size.height}; 47 | self.frame = (CGRect){CGPointZero, newSize}; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserNavigationTitleView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 25 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserRealmHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmHeaderView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserRealmHeaderView : UIView 26 | 27 | @property (nonatomic, weak) IBOutlet UIImageView *iconView; 28 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 29 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 30 | 31 | + (RLMBrowserRealmHeaderView *)headerView; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserRealmHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmHeaderView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserRealmHeaderView.h" 24 | 25 | @implementation RLMBrowserRealmHeaderView 26 | 27 | + (RLMBrowserRealmHeaderView *)headerView 28 | { 29 | return [[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserRealmHeaderView" 30 | owner:self options:nil].firstObject; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserRealmHeaderView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 25 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserRealmTableCellHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmTableCellHeaderView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserRealmTableCellHeaderView : UITableViewHeaderFooterView 26 | 27 | /** When the view is indicating that the content below it is collapsed */ 28 | @property (nonatomic, assign) BOOL collapsed; 29 | 30 | /** Indicating the view is highlighted, usually in response to a user interaction */ 31 | @property (nonatomic, assign) BOOL highlighted; 32 | 33 | /** The title label shown on the left hand side */ 34 | @property (nonatomic, readonly) UILabel *titleLabel; 35 | 36 | /** A label right-aligned that can be used to indicate the number of items in this section */ 37 | @property (nonatomic, readonly) UILabel *countLabel; 38 | 39 | /** An arrow graphic used to denote if the view is collapsed or not */ 40 | @property (nonatomic, readonly) UIImageView *disclosureArrowView; 41 | 42 | /** The horizontal inset of the content to line up with the table view content */ 43 | @property (nonatomic, assign) UIEdgeInsets contentInset; 44 | 45 | /** The handler block that is called when the user taps it */ 46 | @property (nonatomic, copy) void (^collapseToggledHandler)(void); 47 | 48 | /** Animate the view transitioning between collapsed and uncollapsed states */ 49 | - (void)setCollapsed:(BOOL)collapsed animated:(BOOL)animated; 50 | 51 | /** Animate the view transitioning between highlight and non-highlighted */ 52 | - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserTableHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMTableHeaderView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | typedef NS_ENUM(NSInteger, RLMTableHeaderViewStyle) { 26 | RLMTableHeaderViewStyleDefault, // The header view scrolls as normal with the rest of the content 27 | RLMTableHeaderViewStyleFixed, // The header is locked to the top of the table view 28 | }; 29 | 30 | NS_ASSUME_NONNULL_BEGIN 31 | 32 | /** A header view that manages the presentation of the search bar at the top of table views */ 33 | @interface RLMBrowserTableHeaderView : UIView 34 | 35 | /** The visual style of this header view (for fixed / fluid table view scrolling) */ 36 | @property (nonatomic, assign) RLMTableHeaderViewStyle style; 37 | 38 | /** The search bar managed by this view */ 39 | @property (nonatomic, strong, readonly) UISearchBar *searchBar; 40 | 41 | /** A block that is called each time the search bar text changes */ 42 | @property (nonatomic, copy, nullable) void (^searchBarTextChangedHandler)(UISearchBar *searchBar, NSString *searchText); 43 | 44 | /** Init a new instance with either the default or fixed style */ 45 | - (instancetype)initWithStyle:(RLMTableHeaderViewStyle)style; 46 | 47 | /** Make the search bar resign the first responder */ 48 | - (void)dismissKeyboardForSearchBar; 49 | 50 | /** When needed to be fixed, call this method on each instance of `scrollViewDidScroll` */ 51 | - (void)adjustFrameForScrollView:(UIScrollView *)scrollView; 52 | 53 | @end 54 | 55 | NS_ASSUME_NONNULL_END 56 | -------------------------------------------------------------------------------- /RealmBrowser/Views/HeaderViews/RLMBrowserTableHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMTableHeaderView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserTableHeaderView.h" 24 | #import "RLMRealmMonochromeLogoView.h" 25 | 26 | #define RLMBROWSER_BACKGROUND_COLOR [UIColor colorWithRed:238.0f/255.0f green:239.0f/255.0f blue:244.0f/255.0f alpha:1.0f] 27 | 28 | CGFloat const kRLMRealmLogoSize = 60.0f; 29 | 30 | @interface RLMBrowserTableHeaderView () 31 | 32 | @property (nonatomic, strong, readwrite) UISearchBar *searchBar; 33 | @property (nonatomic, strong) UIView *backgroundView; 34 | @property (nonatomic, strong) RLMRealmMonochromeLogoView *logoView; 35 | 36 | - (void)setUpViews; 37 | 38 | @end 39 | 40 | @implementation RLMBrowserTableHeaderView 41 | 42 | - (instancetype)init 43 | { 44 | if (self = [self initWithStyle:RLMTableHeaderViewStyleDefault]) { 45 | 46 | } 47 | 48 | return self; 49 | } 50 | 51 | - (instancetype)initWithStyle:(RLMTableHeaderViewStyle)style 52 | { 53 | CGFloat height = 44.0f; 54 | if (@available(iOS 11.0, *)) { 55 | height = 54.0f; 56 | } 57 | 58 | if (self = [super initWithFrame:CGRectMake(0,0,320.0f,height)]) { 59 | _style = style; 60 | } 61 | 62 | return self; 63 | } 64 | 65 | #pragma mark - View Management - 66 | 67 | - (void)didMoveToSuperview 68 | { 69 | [super didMoveToSuperview]; 70 | 71 | if (self.superview != nil) { 72 | [self setUpViews]; 73 | self.clipsToBounds = NO; 74 | } 75 | } 76 | 77 | - (void)setUpViews 78 | { 79 | if (self.style == RLMTableHeaderViewStyleDefault && !self.backgroundView) { 80 | self.backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, -1024.0f, self.bounds.size.width, 1024.0f)]; 81 | self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 82 | self.backgroundView.backgroundColor = RLMBROWSER_BACKGROUND_COLOR; 83 | [self addSubview:self.backgroundView]; 84 | } 85 | 86 | if (self.style == RLMTableHeaderViewStyleDefault && !self.logoView) { 87 | CGFloat xOffset = floorf((self.bounds.size.width - kRLMRealmLogoSize) * 0.5f); 88 | self.logoView = [[RLMRealmMonochromeLogoView alloc] initWithFrame:CGRectMake(xOffset, -80.0f, kRLMRealmLogoSize, kRLMRealmLogoSize)]; 89 | self.logoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 90 | self.logoView.strokeWidth = 2.0f; 91 | [self addSubview:self.logoView]; 92 | } 93 | 94 | if (self.searchBar == nil) { 95 | self.searchBar = [[UISearchBar alloc] initWithFrame:self.bounds]; 96 | } 97 | 98 | self.searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; 99 | self.searchBar.delegate = self; 100 | self.searchBar.placeholder = @"Search"; 101 | [self addSubview:self.searchBar]; 102 | } 103 | 104 | - (void)adjustFrameForScrollView:(UIScrollView *)scrollView 105 | { 106 | // Lock the search bar to the top if we try and overscroll 107 | CGRect frame = self.searchBar.bounds; 108 | if (scrollView.contentOffset.y < -scrollView.contentInset.top) { 109 | frame.origin.y = scrollView.contentOffset.y + scrollView.contentInset.top; 110 | } 111 | self.searchBar.frame = frame; 112 | } 113 | 114 | #pragma mark - UISearchbar Delegate - 115 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText 116 | { 117 | if (self.searchBarTextChangedHandler) { 118 | self.searchBarTextChangedHandler(searchBar, searchText); 119 | } 120 | } 121 | 122 | #pragma mark - Search Bar Handling - 123 | - (void)dismissKeyboardForSearchBar 124 | { 125 | if (self.searchBar.isFirstResponder) { 126 | [self.searchBar resignFirstResponder]; 127 | } 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /RealmBrowser/Views/RealmLogoViews/RLMRealmLogoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmLogoView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMRealmLogoView : UIView 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RealmBrowser/Views/RealmLogoViews/RLMRealmMonochromeLogoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmMonochromeLogoView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMRealmMonochromeLogoView : UIView 26 | 27 | @property (nonatomic, assign) CGFloat strokeWidth; 28 | @property (nonatomic, strong) UIColor *strokeColor; 29 | 30 | @property (nonatomic, readonly) UIImage *image; 31 | 32 | - (UIImage *)imageInRect:(CGRect)rect; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/ObjectListTableViewCell/RLMBrowserObjectListContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectListTableViewCell.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import "RLMBrowserConstants.h" 25 | #import 26 | 27 | @interface RLMBrowserObjectListContentView : UIView 28 | 29 | @property (nonatomic, weak) IBOutlet UILabel *nilLabel; 30 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 31 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 32 | @property (nonatomic, weak) IBOutlet UILabel *indexLabel; 33 | 34 | @property (nonatomic, strong) RLMObject *object; 35 | @property (nonatomic, strong) NSString *titleProperty; 36 | @property (nonatomic, strong) NSArray *secondaryProperties; 37 | 38 | + (instancetype)objectListContentView; 39 | 40 | - (void)configureCellWithRealmObject:(RLMObject *)object 41 | titleProperty:(NSString *)titleProperty 42 | secondaryProperties:(NSArray *)secondaryProperties; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/ObjectListTableViewCell/RLMBrowserObjectListContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectListTableViewCell.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserObjectListContentView.h" 24 | 25 | @implementation RLMBrowserObjectListContentView 26 | 27 | + (instancetype)objectListContentView 28 | { 29 | return [[[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserObjectListContentView" owner:nil options:nil] firstObject]; 30 | } 31 | 32 | - (void)configureCellWithRealmObject:(RLMObject *)object 33 | titleProperty:(NSString *)titleProperty 34 | secondaryProperties:(NSArray *)secondaryProperties; 35 | { 36 | self.object = object; 37 | self.titleProperty = titleProperty; 38 | self.secondaryProperties = secondaryProperties; 39 | 40 | id value = RLM_OBJECT_VALUE_DESCRIPTION(object, titleProperty); 41 | 42 | if ([value description].length) { 43 | self.titleLabel.hidden = NO; 44 | self.nilLabel.hidden = YES; 45 | self.titleLabel.text = [NSString stringWithFormat:@"%@", value]; 46 | } 47 | else { 48 | self.titleLabel.hidden = YES; 49 | self.nilLabel.hidden = NO; 50 | } 51 | 52 | NSString *subtitle = @""; 53 | if (secondaryProperties.count) { 54 | for (NSString *propertyName in secondaryProperties) { 55 | NSString *propertyValue = RLM_OBJECT_VALUE_DESCRIPTION(object, propertyName); 56 | subtitle = [subtitle stringByAppendingFormat:@"%@: %@", propertyName, propertyValue]; 57 | 58 | if (propertyName != secondaryProperties.lastObject) { 59 | subtitle = [subtitle stringByAppendingString:@" • "]; 60 | } 61 | } 62 | } 63 | else { 64 | subtitle = @"Realm Object"; 65 | } 66 | 67 | self.subtitleLabel.text = subtitle; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/ObjectTableViewCellContentView/RLMBrowserObjectContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectView.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserObjectContentView : UIView 26 | 27 | @property (nonatomic, strong) UIImage *iconImage; 28 | @property (nonatomic, strong) UIImage *quickLookIcon; 29 | @property (nonatomic, copy) NSString *propertyName; 30 | @property (nonatomic, copy) NSString *propertyStats; 31 | @property (nonatomic, copy) NSString *objectValue; 32 | @property (nonatomic, assign) BOOL nilValue; 33 | 34 | @property (nonatomic, strong) UIColor *iconColor; 35 | 36 | @property (nonatomic, readonly) UIButton *quickLookButton; 37 | 38 | + (instancetype)objectContentView; 39 | 40 | - (void)showCopyButton; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/ObjectTableViewCellContentView/RLMBrowserObjectContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserObjectView.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserObjectContentView.h" 24 | 25 | @interface RLMBrowserObjectContentView () 26 | 27 | @property (nonatomic, strong) IBOutlet UIImageView *iconView; 28 | @property (nonatomic, strong) IBOutlet UILabel *propertyNameLabel; 29 | @property (nonatomic, strong) IBOutlet UILabel *propertyStatsLabel; 30 | @property (nonatomic, strong) IBOutlet UILabel *objectValueLabel; 31 | @property (nonatomic, strong, readwrite) IBOutlet UIButton *quickLookButton; 32 | @property (nonatomic, strong) IBOutlet UILabel *nilLabel; 33 | 34 | @end 35 | 36 | @implementation RLMBrowserObjectContentView 37 | 38 | + (instancetype)objectContentView 39 | { 40 | RLMBrowserObjectContentView *contentView = [[[NSBundle bundleForClass:self.class] loadNibNamed:@"RLMBrowserObjectContentView" owner:nil options:nil] firstObject]; 41 | contentView.propertyStatsLabel.hidden = YES; 42 | contentView.propertyStats = nil; 43 | return contentView; 44 | } 45 | 46 | - (void)setUp 47 | { 48 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 49 | } 50 | 51 | - (void)layoutSubviews 52 | { 53 | [super layoutSubviews]; 54 | 55 | CGRect frame = self.propertyNameLabel.frame; 56 | frame.size.width = [self.propertyNameLabel sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width; 57 | self.propertyNameLabel.frame = frame; 58 | 59 | if (self.propertyStats.length) { 60 | frame = self.propertyStatsLabel.frame; 61 | frame.origin.x = CGRectGetMaxX(self.propertyNameLabel.frame) + 5.0f; 62 | frame.size.width = [self.propertyStatsLabel sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width; 63 | self.propertyStatsLabel.frame = frame; 64 | self.propertyStatsLabel.hidden = NO; 65 | } 66 | else { 67 | self.propertyStatsLabel.hidden = YES; 68 | } 69 | 70 | frame = self.objectValueLabel.frame; 71 | frame.size.width = CGRectGetMinX(self.quickLookButton.frame) - frame.origin.x; 72 | self.objectValueLabel.frame = frame; 73 | } 74 | 75 | #pragma mark - Accessor Overrides - 76 | 77 | - (void)setPropertyName:(NSString *)propertyName 78 | { 79 | self.propertyNameLabel.text = propertyName; 80 | [self setNeedsLayout]; 81 | } 82 | 83 | - (NSString *)propertyName 84 | { 85 | return self.propertyNameLabel.text; 86 | } 87 | 88 | - (void)setPropertyStats:(NSString *)propertyStats 89 | { 90 | self.propertyStatsLabel.text = propertyStats; 91 | [self setNeedsLayout]; 92 | } 93 | 94 | - (NSString *)propertyStats 95 | { 96 | return self.propertyStatsLabel.text; 97 | } 98 | 99 | - (void)setObjectValue:(NSString *)objectValue 100 | { 101 | self.objectValueLabel.text = objectValue; 102 | [self setNeedsLayout]; 103 | } 104 | 105 | - (NSString *)objectValue 106 | { 107 | return self.objectValueLabel.text; 108 | } 109 | 110 | - (void)setIconImage:(UIImage *)iconImage 111 | { 112 | self.iconView.image = iconImage; 113 | } 114 | 115 | - (UIImage *)iconImage 116 | { 117 | return self.iconView.image; 118 | } 119 | 120 | - (void)setIconColor:(UIColor *)iconColor 121 | { 122 | self.iconView.tintColor = iconColor; 123 | } 124 | 125 | - (UIColor *)iconColor 126 | { 127 | return self.iconView.tintColor; 128 | } 129 | 130 | - (void)setQuickLookIcon:(UIImage *)quickLookIcon 131 | { 132 | [self.quickLookButton setImage:quickLookIcon forState:UIControlStateNormal]; 133 | } 134 | 135 | - (UIImage *)quickLookIcon 136 | { 137 | return [self.quickLookButton imageForState:UIControlStateNormal]; 138 | } 139 | 140 | - (void)setNilValue:(BOOL)nilValue 141 | { 142 | self.nilLabel.hidden = !nilValue; 143 | self.objectValueLabel.hidden = nilValue; 144 | } 145 | 146 | - (BOOL)nilValue 147 | { 148 | return !self.nilLabel.hidden; 149 | } 150 | 151 | #pragma mark - UIMenuItem - 152 | - (void)showCopyButton 153 | { 154 | UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"Copy" action:@selector(copyValueToClipboard)]; 155 | UIMenuController *menuController = [UIMenuController sharedMenuController]; 156 | menuController.menuItems = @[copyItem]; 157 | [menuController update]; 158 | 159 | [self becomeFirstResponder]; 160 | 161 | [menuController setTargetRect:self.frame inView:self.superview]; 162 | [menuController setMenuVisible:YES animated:YES]; 163 | } 164 | 165 | - (BOOL)canBecomeFirstResponder 166 | { 167 | return YES; 168 | } 169 | 170 | - (BOOL)canPerformAction:(SEL)action withSender:(id)sender 171 | { 172 | return (@selector(copyValueToClipboard) == action); 173 | } 174 | 175 | - (void)copyValueToClipboard 176 | { 177 | [UIPasteboard generalPasteboard].string = self.objectValue; 178 | } 179 | 180 | @end 181 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/PropertyTableViewCell/RLMBrowserPropertyTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserPropertyTableViewCell.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | #import "RLMBrowserTableViewCell.h" 26 | 27 | @interface RLMBrowserPropertyTableViewCell : RLMBrowserTableViewCell 28 | 29 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 30 | 31 | @property (nonatomic, weak) IBOutlet UIView *containerView; 32 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 33 | @property (nonatomic, weak) IBOutlet UILabel *typeLabel; 34 | 35 | @property (nonatomic, weak) IBOutlet UIImageView *iconView; 36 | 37 | @property (nonatomic, assign) CGFloat rightInset; 38 | 39 | - (void)configureCellWithProperty:(RLMProperty *)property; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/PropertyTableViewCell/RLMBrowserPropertyTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserPropertyTableViewCell.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserPropertyTableViewCell.h" 24 | #import "RLMProperty+BrowserDescription.h" 25 | 26 | @implementation RLMBrowserPropertyTableViewCell 27 | 28 | - (void)configureCellWithProperty:(RLMProperty *)property 29 | { 30 | self.titleLabel.text = property.name; 31 | self.subtitleLabel.text = property.RLMBrowser_configurationDescription; 32 | self.typeLabel.text = property.RLMBrowser_typeDescription; 33 | } 34 | 35 | - (void)setRightInset:(CGFloat)rightInset 36 | { 37 | if (_rightInset == rightInset) { return; } 38 | _rightInset = rightInset; 39 | 40 | CGSize viewSize = self.frame.size; 41 | 42 | CGRect frame = self.containerView.frame; 43 | frame.origin.x = viewSize.width - (frame.size.width + 11 + _rightInset); 44 | self.containerView.frame = frame; 45 | 46 | frame = self.titleLabel.frame; 47 | frame.size.width = CGRectGetMinX(self.titleLabel.frame) - frame.origin.x; 48 | self.titleLabel.frame = frame; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/PropertyTableViewCell/RLMBrowserPropertyTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 44 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RLMBrowserTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserTableViewCell.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | 25 | @interface RLMBrowserTableViewCell : UITableViewCell 26 | 27 | @property (nonatomic, strong) UIColor *selectedBackgroundColor; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RLMBrowserTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserTableViewCell.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserTableViewCell.h" 24 | 25 | @interface RLMBrowserTableViewCell () 26 | 27 | @property (nonatomic, strong) UIView *browserCellSelectedBackgroundView; 28 | 29 | @end 30 | 31 | @implementation RLMBrowserTableViewCell 32 | 33 | - (void)setSelectedBackgroundColor:(UIColor *)selectedBackgroundColor 34 | { 35 | if (selectedBackgroundColor == _selectedBackgroundColor) { 36 | return; 37 | } 38 | 39 | _selectedBackgroundColor = selectedBackgroundColor; 40 | 41 | if (self.browserCellSelectedBackgroundView == nil) { 42 | self.browserCellSelectedBackgroundView = [[UIView alloc] initWithFrame:CGRectZero]; 43 | self.selectedBackgroundView = self.browserCellSelectedBackgroundView; 44 | } 45 | 46 | self.browserCellSelectedBackgroundView.backgroundColor = _selectedBackgroundColor; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmSchemaTableViewCell/RLMBrowserSchemaTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmSchemaTableViewCell.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import "RLMBrowserTableViewCell.h" 25 | 26 | @interface RLMBrowserSchemaTableViewCell : RLMBrowserTableViewCell 27 | 28 | @property (nonatomic, weak) IBOutlet UIImageView *imageView; 29 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 30 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmSchemaTableViewCell/RLMBrowserSchemaTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMRealmSchemaTableViewCell.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserSchemaTableViewCell.h" 24 | 25 | @implementation RLMBrowserSchemaTableViewCell 26 | 27 | @synthesize imageView = __imageView; 28 | 29 | - (void)awakeFromNib { 30 | [super awakeFromNib]; 31 | // Initialization code 32 | } 33 | 34 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 35 | [super setSelected:selected animated:animated]; 36 | 37 | // Configure the view for the selected state 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmSchemaTableViewCell/RLMBrowserSchemaTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmTableViewCell/RLMBrowserRealmTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmTableViewCell.h 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import 24 | #import "RLMBrowserTableViewCell.h" 25 | 26 | @interface RLMBrowserRealmTableViewCell : RLMBrowserTableViewCell 27 | 28 | @property (nonatomic, weak) IBOutlet UIImageView *imageView; 29 | @property (nonatomic, weak) IBOutlet UILabel *titleLabel; 30 | @property (nonatomic, weak) IBOutlet UILabel *subtitleLabel; 31 | @property (nonatomic, weak) IBOutlet UIImageView *lockIconView; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmTableViewCell/RLMBrowserRealmTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // RLMBrowserRealmTableViewCell.m 3 | // 4 | // Copyright 2016-2017 Timothy Oliver. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to 8 | // deal in the Software without restriction, including without limitation the 9 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | // sell copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 21 | // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | #import "RLMBrowserRealmTableViewCell.h" 24 | 25 | @implementation RLMBrowserRealmTableViewCell 26 | 27 | @synthesize imageView = __imageView; 28 | 29 | - (void)awakeFromNib { 30 | [super awakeFromNib]; 31 | // Initialization code 32 | } 33 | 34 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 35 | [super setSelected:selected animated:animated]; 36 | 37 | // Configure the view for the selected state 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /RealmBrowser/Views/TableViewCells/RealmTableViewCell/RLMBrowserRealmTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 36 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /RealmBrowserExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // realm-browser-ios 4 | // 5 | // Created by Tim Oliver on 23/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /RealmBrowserExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // realm-browser-ios 4 | // 5 | // Created by Tim Oliver on 23/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | #import "Person.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 16 | 17 | RLMRealm *realm = [RLMRealm defaultRealm]; 18 | if (realm.isEmpty) { 19 | [realm transactionWithBlock:^{ 20 | [realm addObjects:[Person generateTestData]]; 21 | }]; 22 | } 23 | 24 | return YES; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RealmBrowserExample/Controllers/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // realm-browser-ios 4 | // 5 | // Created by Tim Oliver on 23/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /RealmBrowserExample/Controllers/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // realm-browser-ios 4 | // 5 | // Created by Tim Oliver on 23/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "RLMRealmLogoView.h" 11 | #import "RLMBrowserViewController.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.navigationItem.titleView = [[RLMRealmLogoView alloc] init]; 23 | self.navigationItem.titleView.frame = CGRectMake(0,0,31,31); 24 | } 25 | 26 | 27 | - (IBAction)showButtonTapped:(id)sender 28 | { 29 | RLMBrowserViewController *controller = [[RLMBrowserViewController alloc] init]; 30 | [controller show]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RealmBrowserExample/Models/Person.h: -------------------------------------------------------------------------------- 1 | // 2 | // Person.h 3 | // RealmBrowser 4 | // 5 | // Created by Tim Oliver on 24/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface Person : RLMObject 13 | 14 | @property NSInteger userID; 15 | @property NSString *name; 16 | @property NSString *email; 17 | @property NSInteger age; 18 | @property CGFloat height; 19 | @property CGFloat weight; 20 | @property NSString *gender; 21 | @property NSString *website; 22 | 23 | + (NSArray *)generateTestData; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /RealmBrowserExample/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /RealmBrowserExample/Resources/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RealmBrowserExample/Resources/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /RealmBrowserExample/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /RealmBrowserExample/Supporting Files/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // realm-browser-ios 4 | // 5 | // Created by Tim Oliver on 23/11/16. 6 | // Copyright © 2016 Tim Oliver. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /RealmBrowserKit.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'RealmBrowserKit' 3 | s.version = '0.0.1' 4 | s.license = { :type => 'MIT', :file => 'LICENSE' } 5 | s.summary = 'An embeddable version of the Realm Browser that can be used to debug Realm databases in an on-device app' 6 | s.homepage = 'https://timoliver.blog' 7 | s.author = { 'Tim Oliver' => 'info@timoliver.com.au' } 8 | s.source = { :git => 'https://github.com/timoliver/RealmBrowser-iOS.git', :tag => s.version.to_s } 9 | s.requires_arc = true 10 | s.source_files = 'RealmBrowser/**/*.{h,m}' 11 | s.resources = "RealmBrowser/**/*.{xib}" 12 | s.platform = :ios, '8.0' 13 | s.dependency 'Realm' 14 | s.dependency 'TORoundedTableView' 15 | s.dependency 'TOSplitViewController' 16 | s.dependency 'TODocumentPickerViewController' 17 | end -------------------------------------------------------------------------------- /screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/RealmBrowser-iOS/a4c4603f0fd7e3bff698fc4f4412208629f5ae5c/screenshot.jpg --------------------------------------------------------------------------------