├── .gitignore ├── .travis.yml ├── Cartfile ├── Example ├── Podfile ├── Podfile.lock ├── RealmDefaults.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── RealmDefaults-Example.xcscheme ├── RealmDefaults.xcworkspace │ └── contents.xcworkspacedata ├── RealmDefaults_Demo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift └── Tests │ ├── Archives.swift │ ├── Info.plist │ ├── MyAccount.swift │ ├── TestsArchives.swift │ └── TestsMyAccount.swift ├── LICENSE ├── Package.swift ├── Pod ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ └── RealmDefaults.swift ├── README.md ├── RealmDefaults.podspec └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | language: objective-c 6 | # cache: cocoapods 7 | # podfile: Example/Podfile 8 | # before_install: 9 | # - gem install cocoapods # Since Travis is not always on latest version 10 | # - pod install --project-directory=Example 11 | script: 12 | - set -o pipefail && xcodebuild test -workspace Example/RealmDefaults.xcworkspace -scheme RealmDefaults-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty 13 | - pod lib lint 14 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "realm/realm-cocoa" ~> 0.98.6 2 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | 5 | target 'RealmDefaults_Tests' do 6 | pod 'RealmDefaults', :path => '../' 7 | 8 | 9 | end 10 | 11 | target 'RealmDefaults_Demo' do 12 | pod 'RealmDefaults', :path => '../' 13 | 14 | 15 | end 16 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Realm (0.103.2): 3 | - Realm/Headers (= 0.103.2) 4 | - Realm/Headers (0.103.2) 5 | - RealmDefaults (0.4.1): 6 | - RealmSwift (~> 0.100) 7 | - RealmSwift (0.103.2): 8 | - Realm (= 0.103.2) 9 | 10 | DEPENDENCIES: 11 | - RealmDefaults (from `../`) 12 | 13 | EXTERNAL SOURCES: 14 | RealmDefaults: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | Realm: 448f0416079fe5b0ed947e7d86f3c4e1c75826cb 19 | RealmDefaults: 7ce789ab815251b78718792c4fbbb0f3db13effa 20 | RealmSwift: 8a45cc8f02dfac093b72a3b5a01d567e27e15891 21 | 22 | PODFILE CHECKSUM: 22976847bea97a5d5eca7892f308c24bb82f91a2 23 | 24 | COCOAPODS: 1.0.0 25 | -------------------------------------------------------------------------------- /Example/RealmDefaults.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 22FE43A5404221846FA219C3 /* Pods_RealmDefaults_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86B3745AE0DD001648783212 /* Pods_RealmDefaults_Tests.framework */; }; 11 | 4BCB3B181C7E031000BC1A4D /* MyAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B171C7E031000BC1A4D /* MyAccount.swift */; }; 12 | 4BCB3B1A1C7E03A400BC1A4D /* Archives.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B191C7E03A400BC1A4D /* Archives.swift */; }; 13 | 4BCB3B221C7E058C00BC1A4D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B211C7E058C00BC1A4D /* AppDelegate.swift */; }; 14 | 4BCB3B241C7E058C00BC1A4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B231C7E058C00BC1A4D /* ViewController.swift */; }; 15 | 4BCB3B271C7E058C00BC1A4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BCB3B251C7E058C00BC1A4D /* Main.storyboard */; }; 16 | 4BCB3B291C7E058C00BC1A4D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4BCB3B281C7E058C00BC1A4D /* Assets.xcassets */; }; 17 | 4BCB3B2C1C7E058C00BC1A4D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BCB3B2A1C7E058C00BC1A4D /* LaunchScreen.storyboard */; }; 18 | 4BCB3B311C7E05A100BC1A4D /* MyAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B171C7E031000BC1A4D /* MyAccount.swift */; }; 19 | 4BCB3B321C7E05A100BC1A4D /* Archives.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B191C7E03A400BC1A4D /* Archives.swift */; }; 20 | 4BCB3B341C7E126A00BC1A4D /* TestsArchives.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCB3B331C7E126A00BC1A4D /* TestsArchives.swift */; }; 21 | 607FACEC1AFB9204008FA782 /* TestsMyAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* TestsMyAccount.swift */; }; 22 | F355AC49E0F67EAAE62F33DF /* Pods_RealmDefaults_Demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79C2F17CAC3D38AB60EAF2E6 /* Pods_RealmDefaults_Demo.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 15AD098E8098E0CA13593884 /* Pods-RealmDefaults_Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDefaults_Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDefaults_Demo/Pods-RealmDefaults_Demo.release.xcconfig"; sourceTree = ""; }; 27 | 231AE30FA2CFCCB82C787248 /* RealmDefaults.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = RealmDefaults.podspec; path = ../RealmDefaults.podspec; sourceTree = ""; }; 28 | 39B52A7353368371B510AC16 /* Pods-RealmDefaults_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDefaults_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDefaults_Tests/Pods-RealmDefaults_Tests.release.xcconfig"; sourceTree = ""; }; 29 | 4BCB3B171C7E031000BC1A4D /* MyAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyAccount.swift; sourceTree = ""; }; 30 | 4BCB3B191C7E03A400BC1A4D /* Archives.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Archives.swift; sourceTree = ""; }; 31 | 4BCB3B1F1C7E058C00BC1A4D /* RealmDefaults_Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RealmDefaults_Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 4BCB3B211C7E058C00BC1A4D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 4BCB3B231C7E058C00BC1A4D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | 4BCB3B261C7E058C00BC1A4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 4BCB3B281C7E058C00BC1A4D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 36 | 4BCB3B2B1C7E058C00BC1A4D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 37 | 4BCB3B2D1C7E058C00BC1A4D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 4BCB3B331C7E126A00BC1A4D /* TestsArchives.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsArchives.swift; sourceTree = ""; }; 39 | 607FACE51AFB9204008FA782 /* RealmDefaults_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RealmDefaults_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 607FACEB1AFB9204008FA782 /* TestsMyAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestsMyAccount.swift; sourceTree = ""; }; 42 | 66AF42F2FEFC48DE7B99C57F /* Pods-RealmDefaults_Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDefaults_Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDefaults_Demo/Pods-RealmDefaults_Demo.debug.xcconfig"; sourceTree = ""; }; 43 | 6F219FAA91709E3578F3D002 /* Pods-RealmDefaults_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDefaults_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDefaults_Tests/Pods-RealmDefaults_Tests.debug.xcconfig"; sourceTree = ""; }; 44 | 79C2F17CAC3D38AB60EAF2E6 /* Pods_RealmDefaults_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmDefaults_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 86B3745AE0DD001648783212 /* Pods_RealmDefaults_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmDefaults_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | A087DF3B774144E3CF302683 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 47 | DF773FAB3272DE9C68FCE81B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 4BCB3B1C1C7E058C00BC1A4D /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | F355AC49E0F67EAAE62F33DF /* Pods_RealmDefaults_Demo.framework in Frameworks */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 22FE43A5404221846FA219C3 /* Pods_RealmDefaults_Tests.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 4BCB3B201C7E058C00BC1A4D /* RealmDefaults_Demo */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 4BCB3B211C7E058C00BC1A4D /* AppDelegate.swift */, 74 | 4BCB3B231C7E058C00BC1A4D /* ViewController.swift */, 75 | 4BCB3B251C7E058C00BC1A4D /* Main.storyboard */, 76 | 4BCB3B281C7E058C00BC1A4D /* Assets.xcassets */, 77 | 4BCB3B2A1C7E058C00BC1A4D /* LaunchScreen.storyboard */, 78 | 4BCB3B2D1C7E058C00BC1A4D /* Info.plist */, 79 | ); 80 | path = RealmDefaults_Demo; 81 | sourceTree = ""; 82 | }; 83 | 58DBD4EB06DB9512ACB4664B /* Frameworks */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 79C2F17CAC3D38AB60EAF2E6 /* Pods_RealmDefaults_Demo.framework */, 87 | 86B3745AE0DD001648783212 /* Pods_RealmDefaults_Tests.framework */, 88 | ); 89 | name = Frameworks; 90 | sourceTree = ""; 91 | }; 92 | 607FACC71AFB9204008FA782 = { 93 | isa = PBXGroup; 94 | children = ( 95 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 96 | 607FACE81AFB9204008FA782 /* Tests */, 97 | 4BCB3B201C7E058C00BC1A4D /* RealmDefaults_Demo */, 98 | 607FACD11AFB9204008FA782 /* Products */, 99 | B87EB472BBDBB9439CF23DCF /* Pods */, 100 | 58DBD4EB06DB9512ACB4664B /* Frameworks */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 607FACD11AFB9204008FA782 /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 607FACE51AFB9204008FA782 /* RealmDefaults_Tests.xctest */, 108 | 4BCB3B1F1C7E058C00BC1A4D /* RealmDefaults_Demo.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 607FACE81AFB9204008FA782 /* Tests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 607FACEB1AFB9204008FA782 /* TestsMyAccount.swift */, 117 | 4BCB3B171C7E031000BC1A4D /* MyAccount.swift */, 118 | 4BCB3B331C7E126A00BC1A4D /* TestsArchives.swift */, 119 | 4BCB3B191C7E03A400BC1A4D /* Archives.swift */, 120 | 607FACE91AFB9204008FA782 /* Supporting Files */, 121 | ); 122 | path = Tests; 123 | sourceTree = ""; 124 | }; 125 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 607FACEA1AFB9204008FA782 /* Info.plist */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 231AE30FA2CFCCB82C787248 /* RealmDefaults.podspec */, 137 | A087DF3B774144E3CF302683 /* README.md */, 138 | DF773FAB3272DE9C68FCE81B /* LICENSE */, 139 | ); 140 | name = "Podspec Metadata"; 141 | sourceTree = ""; 142 | }; 143 | B87EB472BBDBB9439CF23DCF /* Pods */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 66AF42F2FEFC48DE7B99C57F /* Pods-RealmDefaults_Demo.debug.xcconfig */, 147 | 15AD098E8098E0CA13593884 /* Pods-RealmDefaults_Demo.release.xcconfig */, 148 | 6F219FAA91709E3578F3D002 /* Pods-RealmDefaults_Tests.debug.xcconfig */, 149 | 39B52A7353368371B510AC16 /* Pods-RealmDefaults_Tests.release.xcconfig */, 150 | ); 151 | name = Pods; 152 | sourceTree = ""; 153 | }; 154 | /* End PBXGroup section */ 155 | 156 | /* Begin PBXNativeTarget section */ 157 | 4BCB3B1E1C7E058C00BC1A4D /* RealmDefaults_Demo */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 4BCB3B2E1C7E058C00BC1A4D /* Build configuration list for PBXNativeTarget "RealmDefaults_Demo" */; 160 | buildPhases = ( 161 | 488F101D6AAD321964CD5C50 /* 📦 Check Pods Manifest.lock */, 162 | 4BCB3B1B1C7E058C00BC1A4D /* Sources */, 163 | 4BCB3B1C1C7E058C00BC1A4D /* Frameworks */, 164 | 4BCB3B1D1C7E058C00BC1A4D /* Resources */, 165 | 60534FE3DAB7069C2ADB842C /* 📦 Embed Pods Frameworks */, 166 | 39C7ED355A6194FB062A953B /* 📦 Copy Pods Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = RealmDefaults_Demo; 173 | productName = RealmDefaults_Demo; 174 | productReference = 4BCB3B1F1C7E058C00BC1A4D /* RealmDefaults_Demo.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | 607FACE41AFB9204008FA782 /* RealmDefaults_Tests */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "RealmDefaults_Tests" */; 180 | buildPhases = ( 181 | 922D2149B22FE471DD9B5319 /* 📦 Check Pods Manifest.lock */, 182 | 607FACE11AFB9204008FA782 /* Sources */, 183 | 607FACE21AFB9204008FA782 /* Frameworks */, 184 | 607FACE31AFB9204008FA782 /* Resources */, 185 | 8BF14B3E3E055675E56A43B7 /* 📦 Embed Pods Frameworks */, 186 | 43F4B62E738D3CA5DEAAD1A9 /* 📦 Copy Pods Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | ); 192 | name = RealmDefaults_Tests; 193 | productName = Tests; 194 | productReference = 607FACE51AFB9204008FA782 /* RealmDefaults_Tests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | 607FACC81AFB9204008FA782 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastSwiftUpdateCheck = 0720; 204 | LastUpgradeCheck = 0720; 205 | ORGANIZATIONNAME = CocoaPods; 206 | TargetAttributes = { 207 | 4BCB3B1E1C7E058C00BC1A4D = { 208 | CreatedOnToolsVersion = 7.2.1; 209 | }; 210 | 607FACE41AFB9204008FA782 = { 211 | CreatedOnToolsVersion = 6.3.1; 212 | TestTargetID = 607FACCF1AFB9204008FA782; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "RealmDefaults" */; 217 | compatibilityVersion = "Xcode 3.2"; 218 | developmentRegion = English; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = 607FACC71AFB9204008FA782; 225 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 607FACE41AFB9204008FA782 /* RealmDefaults_Tests */, 230 | 4BCB3B1E1C7E058C00BC1A4D /* RealmDefaults_Demo */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXResourcesBuildPhase section */ 236 | 4BCB3B1D1C7E058C00BC1A4D /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 4BCB3B2C1C7E058C00BC1A4D /* LaunchScreen.storyboard in Resources */, 241 | 4BCB3B291C7E058C00BC1A4D /* Assets.xcassets in Resources */, 242 | 4BCB3B271C7E058C00BC1A4D /* Main.storyboard in Resources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | 607FACE31AFB9204008FA782 /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXResourcesBuildPhase section */ 254 | 255 | /* Begin PBXShellScriptBuildPhase section */ 256 | 39C7ED355A6194FB062A953B /* 📦 Copy Pods Resources */ = { 257 | isa = PBXShellScriptBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | ); 261 | inputPaths = ( 262 | ); 263 | name = "📦 Copy Pods Resources"; 264 | outputPaths = ( 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | shellPath = /bin/sh; 268 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmDefaults_Demo/Pods-RealmDefaults_Demo-resources.sh\"\n"; 269 | showEnvVarsInLog = 0; 270 | }; 271 | 43F4B62E738D3CA5DEAAD1A9 /* 📦 Copy Pods Resources */ = { 272 | isa = PBXShellScriptBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | inputPaths = ( 277 | ); 278 | name = "📦 Copy Pods Resources"; 279 | outputPaths = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | shellPath = /bin/sh; 283 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmDefaults_Tests/Pods-RealmDefaults_Tests-resources.sh\"\n"; 284 | showEnvVarsInLog = 0; 285 | }; 286 | 488F101D6AAD321964CD5C50 /* 📦 Check Pods Manifest.lock */ = { 287 | isa = PBXShellScriptBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | ); 291 | inputPaths = ( 292 | ); 293 | name = "📦 Check Pods Manifest.lock"; 294 | outputPaths = ( 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | shellPath = /bin/sh; 298 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 299 | showEnvVarsInLog = 0; 300 | }; 301 | 60534FE3DAB7069C2ADB842C /* 📦 Embed Pods Frameworks */ = { 302 | isa = PBXShellScriptBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | ); 306 | inputPaths = ( 307 | ); 308 | name = "📦 Embed Pods Frameworks"; 309 | outputPaths = ( 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | shellPath = /bin/sh; 313 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmDefaults_Demo/Pods-RealmDefaults_Demo-frameworks.sh\"\n"; 314 | showEnvVarsInLog = 0; 315 | }; 316 | 8BF14B3E3E055675E56A43B7 /* 📦 Embed Pods Frameworks */ = { 317 | isa = PBXShellScriptBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | ); 321 | inputPaths = ( 322 | ); 323 | name = "📦 Embed Pods Frameworks"; 324 | outputPaths = ( 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | shellPath = /bin/sh; 328 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmDefaults_Tests/Pods-RealmDefaults_Tests-frameworks.sh\"\n"; 329 | showEnvVarsInLog = 0; 330 | }; 331 | 922D2149B22FE471DD9B5319 /* 📦 Check Pods Manifest.lock */ = { 332 | isa = PBXShellScriptBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | ); 336 | inputPaths = ( 337 | ); 338 | name = "📦 Check Pods Manifest.lock"; 339 | outputPaths = ( 340 | ); 341 | runOnlyForDeploymentPostprocessing = 0; 342 | shellPath = /bin/sh; 343 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 344 | showEnvVarsInLog = 0; 345 | }; 346 | /* End PBXShellScriptBuildPhase section */ 347 | 348 | /* Begin PBXSourcesBuildPhase section */ 349 | 4BCB3B1B1C7E058C00BC1A4D /* Sources */ = { 350 | isa = PBXSourcesBuildPhase; 351 | buildActionMask = 2147483647; 352 | files = ( 353 | 4BCB3B311C7E05A100BC1A4D /* MyAccount.swift in Sources */, 354 | 4BCB3B241C7E058C00BC1A4D /* ViewController.swift in Sources */, 355 | 4BCB3B321C7E05A100BC1A4D /* Archives.swift in Sources */, 356 | 4BCB3B221C7E058C00BC1A4D /* AppDelegate.swift in Sources */, 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | }; 360 | 607FACE11AFB9204008FA782 /* Sources */ = { 361 | isa = PBXSourcesBuildPhase; 362 | buildActionMask = 2147483647; 363 | files = ( 364 | 607FACEC1AFB9204008FA782 /* TestsMyAccount.swift in Sources */, 365 | 4BCB3B181C7E031000BC1A4D /* MyAccount.swift in Sources */, 366 | 4BCB3B341C7E126A00BC1A4D /* TestsArchives.swift in Sources */, 367 | 4BCB3B1A1C7E03A400BC1A4D /* Archives.swift in Sources */, 368 | ); 369 | runOnlyForDeploymentPostprocessing = 0; 370 | }; 371 | /* End PBXSourcesBuildPhase section */ 372 | 373 | /* Begin PBXVariantGroup section */ 374 | 4BCB3B251C7E058C00BC1A4D /* Main.storyboard */ = { 375 | isa = PBXVariantGroup; 376 | children = ( 377 | 4BCB3B261C7E058C00BC1A4D /* Base */, 378 | ); 379 | name = Main.storyboard; 380 | sourceTree = ""; 381 | }; 382 | 4BCB3B2A1C7E058C00BC1A4D /* LaunchScreen.storyboard */ = { 383 | isa = PBXVariantGroup; 384 | children = ( 385 | 4BCB3B2B1C7E058C00BC1A4D /* Base */, 386 | ); 387 | name = LaunchScreen.storyboard; 388 | sourceTree = ""; 389 | }; 390 | /* End PBXVariantGroup section */ 391 | 392 | /* Begin XCBuildConfiguration section */ 393 | 4BCB3B2F1C7E058C00BC1A4D /* Debug */ = { 394 | isa = XCBuildConfiguration; 395 | baseConfigurationReference = 66AF42F2FEFC48DE7B99C57F /* Pods-RealmDefaults_Demo.debug.xcconfig */; 396 | buildSettings = { 397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 398 | DEBUG_INFORMATION_FORMAT = dwarf; 399 | INFOPLIST_FILE = RealmDefaults_Demo/Info.plist; 400 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 401 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 402 | PRODUCT_BUNDLE_IDENTIFIER = "me.muukii.RealmDefaults-Demo"; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | }; 405 | name = Debug; 406 | }; 407 | 4BCB3B301C7E058C00BC1A4D /* Release */ = { 408 | isa = XCBuildConfiguration; 409 | baseConfigurationReference = 15AD098E8098E0CA13593884 /* Pods-RealmDefaults_Demo.release.xcconfig */; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | INFOPLIST_FILE = RealmDefaults_Demo/Info.plist; 413 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 415 | PRODUCT_BUNDLE_IDENTIFIER = "me.muukii.RealmDefaults-Demo"; 416 | PRODUCT_NAME = "$(TARGET_NAME)"; 417 | }; 418 | name = Release; 419 | }; 420 | 607FACED1AFB9204008FA782 /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ALWAYS_SEARCH_USER_PATHS = NO; 424 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 425 | CLANG_CXX_LIBRARY = "libc++"; 426 | CLANG_ENABLE_MODULES = YES; 427 | CLANG_ENABLE_OBJC_ARC = YES; 428 | CLANG_WARN_BOOL_CONVERSION = YES; 429 | CLANG_WARN_CONSTANT_CONVERSION = YES; 430 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 431 | CLANG_WARN_EMPTY_BODY = YES; 432 | CLANG_WARN_ENUM_CONVERSION = YES; 433 | CLANG_WARN_INT_CONVERSION = YES; 434 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 435 | CLANG_WARN_UNREACHABLE_CODE = YES; 436 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 437 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 438 | COPY_PHASE_STRIP = NO; 439 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 440 | ENABLE_STRICT_OBJC_MSGSEND = YES; 441 | ENABLE_TESTABILITY = YES; 442 | GCC_C_LANGUAGE_STANDARD = gnu99; 443 | GCC_DYNAMIC_NO_PIC = NO; 444 | GCC_NO_COMMON_BLOCKS = YES; 445 | GCC_OPTIMIZATION_LEVEL = 0; 446 | GCC_PREPROCESSOR_DEFINITIONS = ( 447 | "DEBUG=1", 448 | "$(inherited)", 449 | ); 450 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 451 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 452 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 453 | GCC_WARN_UNDECLARED_SELECTOR = YES; 454 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 455 | GCC_WARN_UNUSED_FUNCTION = YES; 456 | GCC_WARN_UNUSED_VARIABLE = YES; 457 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 458 | MTL_ENABLE_DEBUG_INFO = YES; 459 | ONLY_ACTIVE_ARCH = YES; 460 | SDKROOT = iphoneos; 461 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 462 | }; 463 | name = Debug; 464 | }; 465 | 607FACEE1AFB9204008FA782 /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ALWAYS_SEARCH_USER_PATHS = NO; 469 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 470 | CLANG_CXX_LIBRARY = "libc++"; 471 | CLANG_ENABLE_MODULES = YES; 472 | CLANG_ENABLE_OBJC_ARC = YES; 473 | CLANG_WARN_BOOL_CONVERSION = YES; 474 | CLANG_WARN_CONSTANT_CONVERSION = YES; 475 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 476 | CLANG_WARN_EMPTY_BODY = YES; 477 | CLANG_WARN_ENUM_CONVERSION = YES; 478 | CLANG_WARN_INT_CONVERSION = YES; 479 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 480 | CLANG_WARN_UNREACHABLE_CODE = YES; 481 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 482 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 483 | COPY_PHASE_STRIP = NO; 484 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 485 | ENABLE_NS_ASSERTIONS = NO; 486 | ENABLE_STRICT_OBJC_MSGSEND = YES; 487 | GCC_C_LANGUAGE_STANDARD = gnu99; 488 | GCC_NO_COMMON_BLOCKS = YES; 489 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 490 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 491 | GCC_WARN_UNDECLARED_SELECTOR = YES; 492 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 493 | GCC_WARN_UNUSED_FUNCTION = YES; 494 | GCC_WARN_UNUSED_VARIABLE = YES; 495 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 496 | MTL_ENABLE_DEBUG_INFO = NO; 497 | SDKROOT = iphoneos; 498 | VALIDATE_PRODUCT = YES; 499 | }; 500 | name = Release; 501 | }; 502 | 607FACF31AFB9204008FA782 /* Debug */ = { 503 | isa = XCBuildConfiguration; 504 | baseConfigurationReference = 6F219FAA91709E3578F3D002 /* Pods-RealmDefaults_Tests.debug.xcconfig */; 505 | buildSettings = { 506 | FRAMEWORK_SEARCH_PATHS = ( 507 | "$(SDKROOT)/Developer/Library/Frameworks", 508 | "$(inherited)", 509 | ); 510 | GCC_PREPROCESSOR_DEFINITIONS = ( 511 | "DEBUG=1", 512 | "$(inherited)", 513 | ); 514 | INFOPLIST_FILE = Tests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RealmDefaults_Example.app/RealmDefaults_Example"; 519 | }; 520 | name = Debug; 521 | }; 522 | 607FACF41AFB9204008FA782 /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | baseConfigurationReference = 39B52A7353368371B510AC16 /* Pods-RealmDefaults_Tests.release.xcconfig */; 525 | buildSettings = { 526 | FRAMEWORK_SEARCH_PATHS = ( 527 | "$(SDKROOT)/Developer/Library/Frameworks", 528 | "$(inherited)", 529 | ); 530 | INFOPLIST_FILE = Tests/Info.plist; 531 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 532 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RealmDefaults_Example.app/RealmDefaults_Example"; 535 | }; 536 | name = Release; 537 | }; 538 | /* End XCBuildConfiguration section */ 539 | 540 | /* Begin XCConfigurationList section */ 541 | 4BCB3B2E1C7E058C00BC1A4D /* Build configuration list for PBXNativeTarget "RealmDefaults_Demo" */ = { 542 | isa = XCConfigurationList; 543 | buildConfigurations = ( 544 | 4BCB3B2F1C7E058C00BC1A4D /* Debug */, 545 | 4BCB3B301C7E058C00BC1A4D /* Release */, 546 | ); 547 | defaultConfigurationIsVisible = 0; 548 | defaultConfigurationName = Release; 549 | }; 550 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "RealmDefaults" */ = { 551 | isa = XCConfigurationList; 552 | buildConfigurations = ( 553 | 607FACED1AFB9204008FA782 /* Debug */, 554 | 607FACEE1AFB9204008FA782 /* Release */, 555 | ); 556 | defaultConfigurationIsVisible = 0; 557 | defaultConfigurationName = Release; 558 | }; 559 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "RealmDefaults_Tests" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 607FACF31AFB9204008FA782 /* Debug */, 563 | 607FACF41AFB9204008FA782 /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | /* End XCConfigurationList section */ 569 | }; 570 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 571 | } 572 | -------------------------------------------------------------------------------- /Example/RealmDefaults.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/RealmDefaults.xcodeproj/xcshareddata/xcschemes/RealmDefaults-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Example/RealmDefaults.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RealmDefaults_Demo 4 | // 5 | // Created by Hiroshi Kimura on 2/25/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/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 | -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/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 | -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/RealmDefaults_Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // RealmDefaults_Demo 4 | // 5 | // Created by Hiroshi Kimura on 2/25/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RealmSwift 11 | import RealmDefaults 12 | 13 | class ViewController: UIViewController { 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do any additional setup after loading the view, typically from a nib. 18 | 19 | MyAccount.instance.wri 20 | } 21 | 22 | override func didReceiveMemoryWarning() { 23 | super.didReceiveMemoryWarning() 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Example/Tests/Archives.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Archives.swift 3 | // RealmDefaults 4 | // 5 | // Created by Hiroshi Kimura on 2/25/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import RealmDefaults 11 | 12 | final class Archives: RealmDefaults { 13 | 14 | dynamic var clearStage0: Bool = false 15 | dynamic var clearStage1: Bool = false 16 | dynamic var clearStage2: Bool = false 17 | dynamic var clearStage3: Bool = false 18 | dynamic var clearStage4: Bool = false 19 | 20 | override class func schemaVersion() -> UInt64 { 21 | return 3 22 | } 23 | } -------------------------------------------------------------------------------- /Example/Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/MyAccount.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MyAccount.swift 3 | // RealmDefaults 4 | // 5 | // Created by Hiroshi Kimura on 2/25/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import RealmDefaults 11 | 12 | class MyAccount: RealmDefaults { 13 | 14 | dynamic var name: String? 15 | dynamic var age: Int = 0 16 | dynamic var phoneNumber: String? 17 | 18 | override class func schemaVersion() -> UInt64 { 19 | return 3 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Tests/TestsArchives.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsArchives.swift 3 | // RealmDefaults 4 | // 5 | // Created by Hiroshi Kimura on 2/25/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestsArchives: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | Archives.purge() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testSave() { 25 | 26 | Archives.write { archives in 27 | archives.clearStage0 = true 28 | } 29 | } 30 | 31 | func testPerformanceExample() { 32 | // This is an example of a performance test case. 33 | self.measureBlock { 34 | // Put the code you want to measure the time of here. 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Example/Tests/TestsMyAccount.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import XCTest 3 | import RealmDefaults 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | MyAccount.purge() 10 | } 11 | 12 | override func tearDown() { 13 | 14 | super.tearDown() 15 | } 16 | 17 | func testFirstAccess() { 18 | 19 | XCTAssert(MyAccount.instance.name == nil, "") 20 | XCTAssert(MyAccount.instance.age == 0, "") 21 | XCTAssert(MyAccount.instance.phoneNumber == nil, "") 22 | } 23 | 24 | func testWrite() { 25 | 26 | MyAccount.write { account in 27 | account.name = "muukii" 28 | account.age = 25 29 | account.phoneNumber = "080-0000-0000" 30 | } 31 | XCTAssert(MyAccount.instance.name == "muukii", "") 32 | XCTAssert(MyAccount.instance.age == 25, "") 33 | XCTAssert(MyAccount.instance.phoneNumber == "080-0000-0000", "") 34 | 35 | } 36 | 37 | func testPerformanceExample() { 38 | // This is an example of a performance test case. 39 | self.measureBlock() { 40 | // Put the code you want to measure the time of here. 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 muukii 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "RealmDefaults" 6 | ) 7 | -------------------------------------------------------------------------------- /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muukii-archive/RealmDefaults/a8fe6c4a8d40b74ad051c45b75e97fd3c54c5e2d/Pod/Assets/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muukii-archive/RealmDefaults/a8fe6c4a8d40b74ad051c45b75e97fd3c54c5e2d/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/RealmDefaults.swift: -------------------------------------------------------------------------------- 1 | // RealmDefaults.swift 2 | // 3 | // Copyright (c) 2015 muukii 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 13 | // all 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 21 | // THE SOFTWARE. 22 | 23 | import Foundation 24 | import RealmSwift 25 | 26 | #if os(iOS) 27 | private let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] 28 | #elseif os(OSX) 29 | private let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] 30 | #endif 31 | 32 | public protocol RealmDefaultsType: class { 33 | 34 | static func write(@noescape block: (Self) throws -> Void) throws 35 | static func configuration() -> RealmSwift.Realm.Configuration 36 | } 37 | 38 | extension RealmDefaultsType where Self: RealmDefaults { 39 | 40 | public static func replace(object: Self) throws { 41 | let realm = try Realm(configuration: self.configuration()) 42 | try realm.write { 43 | realm.add(object, update: true) 44 | } 45 | } 46 | 47 | public static func write(@noescape block: (Self) throws -> Void) throws { 48 | self.init() 49 | 50 | self.willWrite() 51 | 52 | defer { 53 | self.didWrite() 54 | } 55 | 56 | let realm = try Realm(configuration: self.configuration()) 57 | if let object = realm.objectForPrimaryKey(self, key: primaryKeyValue) { 58 | 59 | realm.beginWrite() 60 | 61 | do { 62 | try block(object) 63 | } catch { 64 | realm.cancelWrite() 65 | throw error 66 | } 67 | 68 | try realm.commitWrite() 69 | 70 | } else { 71 | 72 | let object = try self.create(realm) 73 | 74 | realm.beginWrite() 75 | 76 | do { 77 | try block(object) 78 | } catch { 79 | realm.cancelWrite() 80 | throw error 81 | } 82 | 83 | try realm.commitWrite() 84 | } 85 | } 86 | 87 | public static var instance: Self { 88 | 89 | let create: () throws -> Self = { 90 | let realm = try Realm(configuration: self.configuration()) 91 | if let object = realm.objectForPrimaryKey(self, key: primaryKeyValue) { 92 | return object 93 | } 94 | return try self.create(realm) 95 | } 96 | 97 | do { 98 | return try create() 99 | } catch { 100 | 101 | let error = error as NSError 102 | if error.code == 10 { 103 | 104 | do { 105 | try NSFileManager.defaultManager().removeItemAtURL(NSURL(fileURLWithPath: self.filePath())) 106 | return try create() 107 | } catch { 108 | fatalError("RealmDefaults Fatal Error: Failed to re-create Realm \(error)") 109 | } 110 | 111 | } else { 112 | 113 | fatalError("RealmDefaults Fatal Error: Failed to create Realm \(error)") 114 | } 115 | } 116 | } 117 | 118 | private static func create(realm: Realm) throws -> Self { 119 | let object = self.init() 120 | try realm.write { 121 | realm.add(object, update: true) 122 | } 123 | return object 124 | } 125 | } 126 | 127 | private let primaryKeyValue = "RealmDefaults" 128 | 129 | public class RealmDefaults: RealmSwift.Object, RealmDefaultsType { 130 | 131 | public class func purge() { 132 | self.willPurge() 133 | defer { 134 | self.didPurge() 135 | } 136 | 137 | do { 138 | let realm = try Realm(configuration: self.configuration()) 139 | try realm.write { 140 | realm.deleteAll() 141 | } 142 | } catch { 143 | // TODO: 144 | } 145 | } 146 | 147 | public class func schemaVersion() -> UInt64 { 148 | 149 | preconditionFailure("Required override this method.") 150 | } 151 | 152 | public class func defaultsName() -> String { 153 | 154 | return NSStringFromClass(self) 155 | } 156 | 157 | public class func filePath() -> String { 158 | 159 | return documentsPath + "/RealmDefaults_\(self.defaultsName()).realm" 160 | } 161 | 162 | public class func configuration() -> RealmSwift.Realm.Configuration { 163 | 164 | return RealmSwift.Realm.Configuration( 165 | fileURL: NSURL(fileURLWithPath: self.filePath()), 166 | inMemoryIdentifier: nil, 167 | encryptionKey: nil, 168 | readOnly: false, 169 | schemaVersion: self.schemaVersion(), 170 | migrationBlock: { (migration, oldSchemaVersion) -> Void in 171 | self.migration(migration, oldSchemaVersion: oldSchemaVersion) 172 | }, 173 | objectTypes: [self]) 174 | } 175 | 176 | 177 | // MARK: Object 178 | public final override class func primaryKey() -> String? { 179 | return "__identifier" 180 | } 181 | 182 | public class func willWrite() { 183 | 184 | } 185 | 186 | public class func didWrite() { 187 | 188 | } 189 | 190 | public class func willPurge() { 191 | 192 | } 193 | 194 | public class func didPurge() { 195 | 196 | } 197 | 198 | public class func migration(migration: Migration, oldSchemaVersion: UInt64) { 199 | 200 | } 201 | 202 | // MARK: Internal 203 | internal dynamic var __identifier: String = primaryKeyValue 204 | 205 | } 206 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RealmDefaults 2 | 3 | [![CI Status](http://img.shields.io/travis/muukii/RealmDefaults.svg?style=flat)](https://travis-ci.org/muukii/RealmDefaults) 4 | [![Version](https://img.shields.io/cocoapods/v/RealmDefaults.svg?style=flat)](http://cocoapods.org/pods/RealmDefaults) 5 | [![License](https://img.shields.io/cocoapods/l/RealmDefaults.svg?style=flat)](http://cocoapods.org/pods/RealmDefaults) 6 | [![Platform](https://img.shields.io/cocoapods/p/RealmDefaults.svg?style=flat)](http://cocoapods.org/pods/RealmDefaults) 7 | 8 | ## Usage 9 | 10 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 11 | 12 | ## Requirements 13 | 14 | ## Installation 15 | 16 | RealmDefaults is available through [CocoaPods](http://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod "RealmDefaults" 21 | ``` 22 | 23 | ## Usage 24 | 25 | ```swift 26 | public class RealmDefaults : RealmSwift.Object { 27 | 28 | public class func purge() 29 | 30 | public static func write(@noescape block: (Self) -> Void) 31 | 32 | public class func schemaVersion() -> UInt64 33 | 34 | public class func defaultsName() -> String 35 | 36 | public class func filePath() -> String 37 | 38 | public class func configuration() -> RealmSwift.Realm.Configuration 39 | } 40 | ``` 41 | 42 | ### Create subclass of RealmDefaults. 43 | 44 | ```swift 45 | import RealmDefaults 46 | 47 | class MyAccount: RealmDefaults { 48 | 49 | dynamic var name: String? 50 | dynamic var age: Int = 0 51 | dynamic var phoneNumber: String? 52 | 53 | override class func schemaVersion() -> UInt64 { 54 | return 3 55 | } 56 | } 57 | ``` 58 | 59 | ### Read & Write 60 | 61 | ```swift 62 | MyAccount.write { account in 63 | account.name = "muukii" 64 | account.age = 25 65 | account.phoneNumber = "080-0000-0000" 66 | } 67 | 68 | print(MyAccount.instance.name) // -> muukii 69 | print(MyAccount.instance.age) // 25 70 | print(MyAccount.instance.phoneNumber) // 080-0000-0000 71 | ``` 72 | 73 | ## Author 74 | 75 | muukii, m@muukii.me 76 | 77 | ## License 78 | 79 | RealmDefaults is available under the MIT license. See the LICENSE file for more info. 80 | -------------------------------------------------------------------------------- /RealmDefaults.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint RealmDefaults.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "RealmDefaults" 11 | s.version = "0.4.3" 12 | s.summary = "RealmDefaults is a Simple value store." 13 | 14 | s.description = <<-DESC 15 | RealmDefaults is a Simple value store. Replacement for NSUserDefaults 16 | DESC 17 | 18 | s.homepage = "https://github.com/muukii/RealmDefaults" 19 | s.license = 'MIT' 20 | s.author = { "muukii" => "m@muukii.me" } 21 | s.source = { :git => "https://github.com/muukii/RealmDefaults.git", :tag => s.version.to_s } 22 | s.social_media_url = 'https://twitter.com/muukii0803' 23 | 24 | s.platform = :ios, '8.0' 25 | s.requires_arc = true 26 | 27 | s.source_files = 'Pod/Classes/**/*' 28 | 29 | s.dependency 'RealmSwift', '~> 1.0' 30 | end 31 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------