├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── Cartfile ├── LICENSE ├── ObjectMapper+Realm.podspec ├── ObjectMapper+Realm.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── ObjectMapper+Realm.xcscheme │ └── ObjectMapper_RealmTests.xcscheme ├── ObjectMapper+Realm.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── ObjectMapper+Realm ├── Info.plist ├── ListTransform.swift └── ObjectMapper_Realm.h ├── ObjectMapper+RealmTests ├── Info.plist ├── ListTransformTests.swift └── User.swift ├── Package.resolved ├── Package.swift ├── Podfile ├── Podfile.lock ├── README.md ├── circle.yml └── codecov.yml /.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 | Cartfile.resolved 27 | 28 | Pods/ 29 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "realm/realm-cocoa" 2 | github "Hearst-DD/ObjectMapper" 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This project is licensed under the MIT license. 2 | 3 | Copyright (c) 2013 - 2014 CocoaPods Dev Team 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 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'ObjectMapper+Realm' 3 | s.version = '1.2.1' 4 | s.summary = "A Realm extension that serializes arbitrary JSON into Realm's List class" 5 | 6 | s.homepage = 'https://github.com/0xjmp/ObjectMapper-Realm' 7 | s.license = "MIT" 8 | s.author = { 'Jake Peterson' => 'jake@guardtoro.com' } 9 | s.source = { :git => 'https://github.com/0xjmp/ObjectMapper-Realm.git', :tag => s.version.to_s } 10 | 11 | s.ios.deployment_target = "13.0" 12 | s.osx.deployment_target = "11.0" 13 | s.tvos.deployment_target = "13.0" 14 | 15 | s.requires_arc = true 16 | 17 | s.dependency "ObjectMapper" 18 | s.dependency "RealmSwift" 19 | 20 | s.pod_target_xcconfig = { 21 | 'SWIFT_VERSION' => '5.9', 22 | } 23 | s.source_files = "ObjectMapper+Realm/*.swift" 24 | 25 | s.swift_version = '5.9' 26 | end 27 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 234360BB2368D1110037BC92 /* ListTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = D207CD261F6A21550055B8FE /* ListTransform.swift */; }; 11 | 4C9052BC3160BD17EC8B75B8 /* Pods_ObjectMapper_RealmTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E3377D0A229F82680A2F1C2 /* Pods_ObjectMapper_RealmTests.framework */; }; 12 | CF81D24DBB3918525A74969B /* Pods_ObjectMapper_Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42EAA9A6C617CE9BF1FC5125 /* Pods_ObjectMapper_Realm.framework */; }; 13 | D207CD141F6A21200055B8FE /* ObjectMapper_Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D207CD0A1F6A21200055B8FE /* ObjectMapper_Realm.framework */; }; 14 | D207CD291F6A21550055B8FE /* ListTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = D207CD261F6A21550055B8FE /* ListTransform.swift */; }; 15 | D207CD2A1F6A21550055B8FE /* ObjectMapper_Realm.h in Headers */ = {isa = PBXBuildFile; fileRef = D207CD271F6A21550055B8FE /* ObjectMapper_Realm.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | D207CD2F1F6A22CF0055B8FE /* ListTransformTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D207CD2E1F6A22CF0055B8FE /* ListTransformTests.swift */; }; 17 | D207CD311F6A23590055B8FE /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = D207CD301F6A23590055B8FE /* User.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | D207CD151F6A21200055B8FE /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = D207CD011F6A21200055B8FE /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = D207CD091F6A21200055B8FE; 26 | remoteInfo = "ObjectMapper+Realm"; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 27EB964D8E182B6CB3B3C5F6 /* Pods-ObjectMapper_RealmTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectMapper_RealmTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectMapper_RealmTests/Pods-ObjectMapper_RealmTests.release.xcconfig"; sourceTree = ""; }; 32 | 41C55ABE3239F799AF25576B /* Pods-ObjectMapper_RealmTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectMapper_RealmTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectMapper_RealmTests/Pods-ObjectMapper_RealmTests.debug.xcconfig"; sourceTree = ""; }; 33 | 42EAA9A6C617CE9BF1FC5125 /* Pods_ObjectMapper_Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectMapper_Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 4B182705D15425E2DD32B094 /* Pods-ObjectMapper_Realm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectMapper_Realm.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectMapper_Realm/Pods-ObjectMapper_Realm.debug.xcconfig"; sourceTree = ""; }; 35 | 6E3377D0A229F82680A2F1C2 /* Pods_ObjectMapper_RealmTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectMapper_RealmTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | B79AD4FFC00F0726F9D2643D /* Pods-ObjectMapper_Realm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectMapper_Realm.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectMapper_Realm/Pods-ObjectMapper_Realm.release.xcconfig"; sourceTree = ""; }; 37 | D207CD0A1F6A21200055B8FE /* ObjectMapper_Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjectMapper_Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | D207CD131F6A21200055B8FE /* ObjectMapper_RealmTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectMapper_RealmTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | D207CD251F6A21550055B8FE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | D207CD261F6A21550055B8FE /* ListTransform.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTransform.swift; sourceTree = ""; }; 41 | D207CD271F6A21550055B8FE /* ObjectMapper_Realm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectMapper_Realm.h; sourceTree = ""; }; 42 | D207CD2C1F6A21640055B8FE /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | D207CD2E1F6A22CF0055B8FE /* ListTransformTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTransformTests.swift; sourceTree = ""; }; 44 | D207CD301F6A23590055B8FE /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | D207CD061F6A21200055B8FE /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | CF81D24DBB3918525A74969B /* Pods_ObjectMapper_Realm.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | D207CD101F6A21200055B8FE /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | D207CD141F6A21200055B8FE /* ObjectMapper_Realm.framework in Frameworks */, 61 | 4C9052BC3160BD17EC8B75B8 /* Pods_ObjectMapper_RealmTests.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 1BF374C722425F262D1EB5CF /* Frameworks */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 42EAA9A6C617CE9BF1FC5125 /* Pods_ObjectMapper_Realm.framework */, 72 | 6E3377D0A229F82680A2F1C2 /* Pods_ObjectMapper_RealmTests.framework */, 73 | ); 74 | name = Frameworks; 75 | sourceTree = ""; 76 | }; 77 | D207CD001F6A21200055B8FE = { 78 | isa = PBXGroup; 79 | children = ( 80 | D207CD241F6A21550055B8FE /* ObjectMapper+Realm */, 81 | D207CD2B1F6A21640055B8FE /* ObjectMapper+RealmTests */, 82 | D207CD0B1F6A21200055B8FE /* Products */, 83 | D45C16ABCB113C07A1F0D3BA /* Pods */, 84 | 1BF374C722425F262D1EB5CF /* Frameworks */, 85 | ); 86 | sourceTree = ""; 87 | }; 88 | D207CD0B1F6A21200055B8FE /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | D207CD0A1F6A21200055B8FE /* ObjectMapper_Realm.framework */, 92 | D207CD131F6A21200055B8FE /* ObjectMapper_RealmTests.xctest */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | D207CD241F6A21550055B8FE /* ObjectMapper+Realm */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | D207CD251F6A21550055B8FE /* Info.plist */, 101 | D207CD261F6A21550055B8FE /* ListTransform.swift */, 102 | D207CD271F6A21550055B8FE /* ObjectMapper_Realm.h */, 103 | ); 104 | path = "ObjectMapper+Realm"; 105 | sourceTree = ""; 106 | }; 107 | D207CD2B1F6A21640055B8FE /* ObjectMapper+RealmTests */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | D207CD2C1F6A21640055B8FE /* Info.plist */, 111 | D207CD2E1F6A22CF0055B8FE /* ListTransformTests.swift */, 112 | D207CD301F6A23590055B8FE /* User.swift */, 113 | ); 114 | path = "ObjectMapper+RealmTests"; 115 | sourceTree = ""; 116 | }; 117 | D45C16ABCB113C07A1F0D3BA /* Pods */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 4B182705D15425E2DD32B094 /* Pods-ObjectMapper_Realm.debug.xcconfig */, 121 | B79AD4FFC00F0726F9D2643D /* Pods-ObjectMapper_Realm.release.xcconfig */, 122 | 41C55ABE3239F799AF25576B /* Pods-ObjectMapper_RealmTests.debug.xcconfig */, 123 | 27EB964D8E182B6CB3B3C5F6 /* Pods-ObjectMapper_RealmTests.release.xcconfig */, 124 | ); 125 | name = Pods; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXHeadersBuildPhase section */ 131 | D207CD071F6A21200055B8FE /* Headers */ = { 132 | isa = PBXHeadersBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | D207CD2A1F6A21550055B8FE /* ObjectMapper_Realm.h in Headers */, 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | /* End PBXHeadersBuildPhase section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | D207CD091F6A21200055B8FE /* ObjectMapper_Realm */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = D207CD1E1F6A21200055B8FE /* Build configuration list for PBXNativeTarget "ObjectMapper_Realm" */; 145 | buildPhases = ( 146 | F7096EEA0620BF9F18C5CB88 /* [CP] Check Pods Manifest.lock */, 147 | D207CD051F6A21200055B8FE /* Sources */, 148 | D207CD061F6A21200055B8FE /* Frameworks */, 149 | D207CD071F6A21200055B8FE /* Headers */, 150 | D207CD081F6A21200055B8FE /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = ObjectMapper_Realm; 157 | productName = "ObjectMapper+Realm"; 158 | productReference = D207CD0A1F6A21200055B8FE /* ObjectMapper_Realm.framework */; 159 | productType = "com.apple.product-type.framework"; 160 | }; 161 | D207CD121F6A21200055B8FE /* ObjectMapper_RealmTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = D207CD211F6A21200055B8FE /* Build configuration list for PBXNativeTarget "ObjectMapper_RealmTests" */; 164 | buildPhases = ( 165 | FD6326D1D7D3F05AD12BCA96 /* [CP] Check Pods Manifest.lock */, 166 | D207CD0F1F6A21200055B8FE /* Sources */, 167 | D207CD101F6A21200055B8FE /* Frameworks */, 168 | D207CD111F6A21200055B8FE /* Resources */, 169 | 39D659B8D36F1BCA982DF4E9 /* [CP] Embed Pods Frameworks */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | D207CD161F6A21200055B8FE /* PBXTargetDependency */, 175 | ); 176 | name = ObjectMapper_RealmTests; 177 | productName = "ObjectMapper+RealmTests"; 178 | productReference = D207CD131F6A21200055B8FE /* ObjectMapper_RealmTests.xctest */; 179 | productType = "com.apple.product-type.bundle.unit-test"; 180 | }; 181 | /* End PBXNativeTarget section */ 182 | 183 | /* Begin PBXProject section */ 184 | D207CD011F6A21200055B8FE /* Project object */ = { 185 | isa = PBXProject; 186 | attributes = { 187 | LastSwiftUpdateCheck = 0830; 188 | LastUpgradeCheck = 1100; 189 | ORGANIZATIONNAME = "Jake Peterson"; 190 | TargetAttributes = { 191 | D207CD091F6A21200055B8FE = { 192 | CreatedOnToolsVersion = 8.3.3; 193 | ProvisioningStyle = Automatic; 194 | }; 195 | D207CD121F6A21200055B8FE = { 196 | CreatedOnToolsVersion = 8.3.3; 197 | LastSwiftMigration = 0830; 198 | ProvisioningStyle = Manual; 199 | }; 200 | }; 201 | }; 202 | buildConfigurationList = D207CD041F6A21200055B8FE /* Build configuration list for PBXProject "ObjectMapper+Realm" */; 203 | compatibilityVersion = "Xcode 3.2"; 204 | developmentRegion = English; 205 | hasScannedForEncodings = 0; 206 | knownRegions = ( 207 | English, 208 | en, 209 | ); 210 | mainGroup = D207CD001F6A21200055B8FE; 211 | productRefGroup = D207CD0B1F6A21200055B8FE /* Products */; 212 | projectDirPath = ""; 213 | projectRoot = ""; 214 | targets = ( 215 | D207CD091F6A21200055B8FE /* ObjectMapper_Realm */, 216 | D207CD121F6A21200055B8FE /* ObjectMapper_RealmTests */, 217 | ); 218 | }; 219 | /* End PBXProject section */ 220 | 221 | /* Begin PBXResourcesBuildPhase section */ 222 | D207CD081F6A21200055B8FE /* Resources */ = { 223 | isa = PBXResourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | D207CD111F6A21200055B8FE /* Resources */ = { 230 | isa = PBXResourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXResourcesBuildPhase section */ 237 | 238 | /* Begin PBXShellScriptBuildPhase section */ 239 | 39D659B8D36F1BCA982DF4E9 /* [CP] Embed Pods Frameworks */ = { 240 | isa = PBXShellScriptBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | ); 244 | inputPaths = ( 245 | "${PODS_ROOT}/Target Support Files/Pods-ObjectMapper_RealmTests/Pods-ObjectMapper_RealmTests-frameworks.sh", 246 | "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework", 247 | "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", 248 | "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", 249 | ); 250 | name = "[CP] Embed Pods Frameworks"; 251 | outputPaths = ( 252 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework", 253 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", 254 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | shellPath = /bin/sh; 258 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ObjectMapper_RealmTests/Pods-ObjectMapper_RealmTests-frameworks.sh\"\n"; 259 | showEnvVarsInLog = 0; 260 | }; 261 | F7096EEA0620BF9F18C5CB88 /* [CP] Check Pods Manifest.lock */ = { 262 | isa = PBXShellScriptBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | inputPaths = ( 267 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 268 | "${PODS_ROOT}/Manifest.lock", 269 | ); 270 | name = "[CP] Check Pods Manifest.lock"; 271 | outputPaths = ( 272 | "$(DERIVED_FILE_DIR)/Pods-ObjectMapper_Realm-checkManifestLockResult.txt", 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | shellPath = /bin/sh; 276 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 277 | showEnvVarsInLog = 0; 278 | }; 279 | FD6326D1D7D3F05AD12BCA96 /* [CP] Check Pods Manifest.lock */ = { 280 | isa = PBXShellScriptBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | ); 284 | inputPaths = ( 285 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 286 | "${PODS_ROOT}/Manifest.lock", 287 | ); 288 | name = "[CP] Check Pods Manifest.lock"; 289 | outputPaths = ( 290 | "$(DERIVED_FILE_DIR)/Pods-ObjectMapper_RealmTests-checkManifestLockResult.txt", 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | shellPath = /bin/sh; 294 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 295 | showEnvVarsInLog = 0; 296 | }; 297 | /* End PBXShellScriptBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | D207CD051F6A21200055B8FE /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | D207CD291F6A21550055B8FE /* ListTransform.swift in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | D207CD0F1F6A21200055B8FE /* Sources */ = { 309 | isa = PBXSourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | 234360BB2368D1110037BC92 /* ListTransform.swift in Sources */, 313 | D207CD311F6A23590055B8FE /* User.swift in Sources */, 314 | D207CD2F1F6A22CF0055B8FE /* ListTransformTests.swift in Sources */, 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | /* End PBXSourcesBuildPhase section */ 319 | 320 | /* Begin PBXTargetDependency section */ 321 | D207CD161F6A21200055B8FE /* PBXTargetDependency */ = { 322 | isa = PBXTargetDependency; 323 | target = D207CD091F6A21200055B8FE /* ObjectMapper_Realm */; 324 | targetProxy = D207CD151F6A21200055B8FE /* PBXContainerItemProxy */; 325 | }; 326 | /* End PBXTargetDependency section */ 327 | 328 | /* Begin XCBuildConfiguration section */ 329 | D207CD1C1F6A21200055B8FE /* Debug */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 341 | CLANG_WARN_BOOL_CONVERSION = YES; 342 | CLANG_WARN_COMMA = YES; 343 | CLANG_WARN_CONSTANT_CONVERSION = YES; 344 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 346 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | CURRENT_PROJECT_VERSION = 1; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 385 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 386 | SWIFT_VERSION = 5.0; 387 | TARGETED_DEVICE_FAMILY = "1,2"; 388 | VERSIONING_SYSTEM = "apple-generic"; 389 | VERSION_INFO_PREFIX = ""; 390 | }; 391 | name = Debug; 392 | }; 393 | D207CD1D1F6A21200055B8FE /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ALWAYS_SEARCH_USER_PATHS = NO; 397 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 398 | CLANG_ANALYZER_NONNULL = YES; 399 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_COMMA = YES; 407 | CLANG_WARN_CONSTANT_CONVERSION = YES; 408 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 410 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 411 | CLANG_WARN_EMPTY_BODY = YES; 412 | CLANG_WARN_ENUM_CONVERSION = YES; 413 | CLANG_WARN_INFINITE_RECURSION = YES; 414 | CLANG_WARN_INT_CONVERSION = YES; 415 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 416 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 417 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 419 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 420 | CLANG_WARN_STRICT_PROTOTYPES = YES; 421 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 422 | CLANG_WARN_UNREACHABLE_CODE = YES; 423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 424 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 425 | COPY_PHASE_STRIP = NO; 426 | CURRENT_PROJECT_VERSION = 1; 427 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 428 | ENABLE_NS_ASSERTIONS = NO; 429 | ENABLE_STRICT_OBJC_MSGSEND = YES; 430 | GCC_C_LANGUAGE_STANDARD = gnu99; 431 | GCC_NO_COMMON_BLOCKS = YES; 432 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 433 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 434 | GCC_WARN_UNDECLARED_SELECTOR = YES; 435 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 436 | GCC_WARN_UNUSED_FUNCTION = YES; 437 | GCC_WARN_UNUSED_VARIABLE = YES; 438 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 439 | MTL_ENABLE_DEBUG_INFO = NO; 440 | SDKROOT = iphoneos; 441 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 442 | SWIFT_VERSION = 5.0; 443 | TARGETED_DEVICE_FAMILY = "1,2"; 444 | VALIDATE_PRODUCT = YES; 445 | VERSIONING_SYSTEM = "apple-generic"; 446 | VERSION_INFO_PREFIX = ""; 447 | }; 448 | name = Release; 449 | }; 450 | D207CD1F1F6A21200055B8FE /* Debug */ = { 451 | isa = XCBuildConfiguration; 452 | baseConfigurationReference = 4B182705D15425E2DD32B094 /* Pods-ObjectMapper_Realm.debug.xcconfig */; 453 | buildSettings = { 454 | CODE_SIGN_IDENTITY = ""; 455 | DEFINES_MODULE = YES; 456 | DYLIB_COMPATIBILITY_VERSION = 1; 457 | DYLIB_CURRENT_VERSION = 1; 458 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 459 | INFOPLIST_FILE = "ObjectMapper+Realm/Info.plist"; 460 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = "com.wfio.ObjectMapper-Realm"; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | SKIP_INSTALL = YES; 465 | SWIFT_VERSION = 5.0; 466 | }; 467 | name = Debug; 468 | }; 469 | D207CD201F6A21200055B8FE /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | baseConfigurationReference = B79AD4FFC00F0726F9D2643D /* Pods-ObjectMapper_Realm.release.xcconfig */; 472 | buildSettings = { 473 | CODE_SIGN_IDENTITY = ""; 474 | DEFINES_MODULE = YES; 475 | DYLIB_COMPATIBILITY_VERSION = 1; 476 | DYLIB_CURRENT_VERSION = 1; 477 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 478 | INFOPLIST_FILE = "ObjectMapper+Realm/Info.plist"; 479 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 480 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 481 | PRODUCT_BUNDLE_IDENTIFIER = "com.wfio.ObjectMapper-Realm"; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | SKIP_INSTALL = YES; 484 | SWIFT_VERSION = 5.0; 485 | }; 486 | name = Release; 487 | }; 488 | D207CD221F6A21200055B8FE /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | baseConfigurationReference = 41C55ABE3239F799AF25576B /* Pods-ObjectMapper_RealmTests.debug.xcconfig */; 491 | buildSettings = { 492 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 493 | CLANG_ENABLE_MODULES = YES; 494 | DEVELOPMENT_TEAM = ""; 495 | INFOPLIST_FILE = "ObjectMapper+RealmTests/Info.plist"; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 497 | PRODUCT_BUNDLE_IDENTIFIER = "com.wfio.ObjectMapper-RealmTests"; 498 | PRODUCT_NAME = "$(TARGET_NAME)"; 499 | PROVISIONING_PROFILE_SPECIFIER = ""; 500 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 501 | SWIFT_VERSION = 5.0; 502 | }; 503 | name = Debug; 504 | }; 505 | D207CD231F6A21200055B8FE /* Release */ = { 506 | isa = XCBuildConfiguration; 507 | baseConfigurationReference = 27EB964D8E182B6CB3B3C5F6 /* Pods-ObjectMapper_RealmTests.release.xcconfig */; 508 | buildSettings = { 509 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 510 | CLANG_ENABLE_MODULES = YES; 511 | DEVELOPMENT_TEAM = ""; 512 | INFOPLIST_FILE = "ObjectMapper+RealmTests/Info.plist"; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = "com.wfio.ObjectMapper-RealmTests"; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | PROVISIONING_PROFILE_SPECIFIER = ""; 517 | SWIFT_VERSION = 5.0; 518 | }; 519 | name = Release; 520 | }; 521 | /* End XCBuildConfiguration section */ 522 | 523 | /* Begin XCConfigurationList section */ 524 | D207CD041F6A21200055B8FE /* Build configuration list for PBXProject "ObjectMapper+Realm" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | D207CD1C1F6A21200055B8FE /* Debug */, 528 | D207CD1D1F6A21200055B8FE /* Release */, 529 | ); 530 | defaultConfigurationIsVisible = 0; 531 | defaultConfigurationName = Release; 532 | }; 533 | D207CD1E1F6A21200055B8FE /* Build configuration list for PBXNativeTarget "ObjectMapper_Realm" */ = { 534 | isa = XCConfigurationList; 535 | buildConfigurations = ( 536 | D207CD1F1F6A21200055B8FE /* Debug */, 537 | D207CD201F6A21200055B8FE /* Release */, 538 | ); 539 | defaultConfigurationIsVisible = 0; 540 | defaultConfigurationName = Release; 541 | }; 542 | D207CD211F6A21200055B8FE /* Build configuration list for PBXNativeTarget "ObjectMapper_RealmTests" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | D207CD221F6A21200055B8FE /* Debug */, 546 | D207CD231F6A21200055B8FE /* Release */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | defaultConfigurationName = Release; 550 | }; 551 | /* End XCConfigurationList section */ 552 | }; 553 | rootObject = D207CD011F6A21200055B8FE /* Project object */; 554 | } 555 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcodeproj/xcshareddata/xcschemes/ObjectMapper+Realm.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 65 | 66 | 67 | 68 | 70 | 76 | 77 | 78 | 79 | 80 | 90 | 91 | 97 | 98 | 99 | 100 | 106 | 107 | 113 | 114 | 115 | 116 | 118 | 119 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcodeproj/xcshareddata/xcschemes/ObjectMapper_RealmTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 16 | 18 | 24 | 25 | 26 | 27 | 28 | 38 | 39 | 45 | 46 | 48 | 49 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ObjectMapper+Realm.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ObjectMapper+Realm/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ObjectMapper+Realm/ListTransform.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListTransform.swift 3 | // ObjectMapper+Realm 4 | // 5 | // Created by Jake Peterson on 8/25/16. 6 | // Copyright © 2016 jakenberg. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import ObjectMapper 11 | import RealmSwift 12 | 13 | public struct ListTransform: TransformType where T: BaseMappable { 14 | 15 | public typealias Serialize = (List) -> () 16 | private let onSerialize: Serialize 17 | 18 | public init(onSerialize: @escaping Serialize = { _ in }) { 19 | self.onSerialize = onSerialize 20 | } 21 | 22 | public typealias Object = List 23 | public typealias JSON = Array 24 | 25 | public func transformFromJSON(_ value: Any?) -> List? { 26 | let list = List() 27 | if let objects = Mapper().mapArray(JSONObject: value) { 28 | list.append(objectsIn: objects) 29 | } 30 | self.onSerialize(list) 31 | return list 32 | } 33 | 34 | public func transformToJSON(_ value: Object?) -> JSON? { 35 | return value?.compactMap { $0.toJSON() } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ObjectMapper+Realm/ObjectMapper_Realm.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectMapper+Realm.h 3 | // ObjectMapper+Realm 4 | // 5 | // Created by Jake Peterson on 8/25/16. 6 | // Copyright © 2016 jakenberg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for ObjectMapper+Realm. 12 | FOUNDATION_EXPORT double ObjectMapper_RealmVersionNumber; 13 | 14 | //! Project version string for ObjectMapper+Realm. 15 | FOUNDATION_EXPORT const unsigned char ObjectMapper_RealmVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #import 20 | -------------------------------------------------------------------------------- /ObjectMapper+RealmTests/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 | -------------------------------------------------------------------------------- /ObjectMapper+RealmTests/ListTransformTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListTransformTests.swift 3 | // ObjectMapper+Realm 4 | // 5 | // Created by Jake Peterson on 9/13/17. 6 | // Copyright 2017 Jake Peterson. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import ObjectMapper 11 | import RealmSwift 12 | 13 | class ListTransformTests: XCTestCase { 14 | 15 | let mapper = Mapper() 16 | 17 | var userJson: [String: Any] { 18 | get { 19 | return ["username": "popular", "friends": friends] 20 | } 21 | } 22 | 23 | var friends: [[String: String]] { 24 | get { 25 | return [ 26 | ["username": "jack"], 27 | ["username": "jill"] 28 | ] 29 | } 30 | } 31 | 32 | func testSerializeFromJsonFailure() { 33 | var userJsonFakeFriends = userJson 34 | userJsonFakeFriends["friends"] = ["not": "valid"] 35 | let user = mapper.map(JSONObject: userJsonFakeFriends) 36 | XCTAssertNotNil(user, "should serialize user") 37 | XCTAssertTrue(user!.friends!.isEmpty) 38 | } 39 | 40 | func testSerializeFromJson() { 41 | let user = mapper.map(JSONObject: userJson) 42 | XCTAssertNotNil(user, "should serialize user") 43 | XCTAssertEqual(user!.friends!.count, friends.count) 44 | } 45 | 46 | // func testSerializeToJson() { 47 | // let user = mapper.map(JSONObject: userJson) 48 | // XCTAssertNotNil(user, "should serialize user") 49 | // let json = mapper.toJSON(user!) 50 | // XCTAssertNotNil(json["friends"], "should deserialize friends") 51 | // } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /ObjectMapper+RealmTests/User.swift: -------------------------------------------------------------------------------- 1 | // 2 | // User.swift 3 | // ObjectMapper+Realm 4 | // 5 | // Created by Jake Peterson on 9/13/17. 6 | // Copyright 2017 Jake Peterson. All rights reserved. 7 | // 8 | 9 | import ObjectMapper 10 | import RealmSwift 11 | import ObjectMapper_Realm 12 | 13 | class Storage { 14 | static let shared = Storage() 15 | 16 | var realm: Realm { 17 | get { 18 | let config = Realm.Configuration(inMemoryIdentifier: "test") 19 | return try! Realm.init(configuration: config) 20 | } 21 | } 22 | } 23 | 24 | class User: Object, Mappable { 25 | @objc dynamic var username: NSString = "" 26 | var friends: List? 27 | 28 | required convenience init?(map: Map) { 29 | self.init() 30 | } 31 | 32 | override class func primaryKey() -> String? { 33 | return "username" 34 | } 35 | 36 | func mapping(map: Map) { 37 | username <- map["username"] 38 | friends <- (map["friends"], ListTransform(onSerialize: onSerialize)) 39 | } 40 | 41 | private func onSerialize(users: List) { 42 | let realm = Storage.shared.realm 43 | try! realm.write { 44 | realm.add(users, update: .modified) 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "ObjectMapper", 6 | "repositoryURL": "https://github.com/tristanhimmelman/ObjectMapper.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "19d499c65b8240f1220d7cf155ccd309857f8018", 10 | "version": "3.5.1" 11 | } 12 | }, 13 | { 14 | "package": "Realm", 15 | "repositoryURL": "https://github.com/realm/realm-cocoa.git", 16 | "state": { 17 | "branch": null, 18 | "revision": "9eec060b00e5dc7f00f1b06830eb78d62c44bb07", 19 | "version": "3.20.0" 20 | } 21 | }, 22 | { 23 | "package": "RealmCore", 24 | "repositoryURL": "https://github.com/realm/realm-core", 25 | "state": { 26 | "branch": null, 27 | "revision": "512dfaa4f59930e193c92e00ba1924bde69b19de", 28 | "version": "5.23.5" 29 | } 30 | } 31 | ] 32 | }, 33 | "version": 1 34 | } 35 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | import PackageDescription 4 | 5 | let realmVersionStr = "3.20.0" 6 | let objectMapperVersionStr = "3.5.1" 7 | 8 | let package = Package( 9 | name: "ObjectMapper+Realm", 10 | platforms: [ 11 | .iOS(.v8), 12 | .tvOS(.v10), 13 | .macOS(.v10_10), 14 | ], 15 | products: [ 16 | .library( 17 | name: "ObjectMapper+Realm", 18 | targets: ["ObjectMapper+Realm"] 19 | ) 20 | ], 21 | dependencies: [ 22 | .package(url: "https://github.com/realm/realm-cocoa.git", .exact(Version(realmVersionStr)!)), 23 | .package(url: "https://github.com/tristanhimmelman/ObjectMapper.git", .exact(Version(objectMapperVersionStr)!)), 24 | ], 25 | targets: [ 26 | .target( 27 | name: "ObjectMapper+Realm", 28 | dependencies: [ 29 | "RealmSwift", 30 | "ObjectMapper" 31 | ], 32 | path: "ObjectMapper+Realm", 33 | exclude: [ 34 | "ObjectMapper+RealmTest" 35 | ] 36 | ), 37 | ], 38 | swiftLanguageVersions: [.v5] 39 | ) 40 | let version = Version(0, 7, 0) 41 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '13.0' 2 | 3 | use_frameworks! 4 | 5 | def shared_pods 6 | pod 'RealmSwift', '~> 10.45.0' 7 | pod 'ObjectMapper', '~> 4.4.2' 8 | end 9 | 10 | target 'ObjectMapper_Realm' do 11 | shared_pods 12 | end 13 | 14 | target 'ObjectMapper_RealmTests' do 15 | shared_pods 16 | end 17 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ObjectMapper (4.4.2) 3 | - Realm (10.45.3): 4 | - Realm/Headers (= 10.45.3) 5 | - Realm/Headers (10.45.3) 6 | - RealmSwift (10.45.3): 7 | - Realm (= 10.45.3) 8 | 9 | DEPENDENCIES: 10 | - ObjectMapper (~> 4.4.2) 11 | - RealmSwift (~> 10.45.0) 12 | 13 | SPEC REPOS: 14 | trunk: 15 | - ObjectMapper 16 | - Realm 17 | - RealmSwift 18 | 19 | SPEC CHECKSUMS: 20 | ObjectMapper: e6e4d91ff7f2861df7aecc536c92d8363f4c9677 21 | Realm: b277b843c7505c1e30e3a70322a24a09283e62bb 22 | RealmSwift: f6690053e81733801e6619eb5b39993ab76f7050 23 | 24 | PODFILE CHECKSUM: 2e3432553e98fc6a96bd56ac27282f078cebee29 25 | 26 | COCOAPODS: 1.16.2 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ObjectMapper+Realm 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/ObjectMapper+Realm.svg?style=flat)](http://cocoapods.org/pods/ObjectMapper+Realm) 4 | ![Build Status](https://circleci.com/gh/Jakenberg/ObjectMapper-Realm.svg?style=shield) 5 | ![codecov](https://codecov.io/gh/Jakenberg/ObjectMapper-Realm/branch/master/graph/badge.svg) 6 | [![Platform](https://img.shields.io/cocoapods/p/ObjectMapper+Realm.svg?style=flat)](http://cocoapods.org/pods/ObjectMapper+Realm) 7 | [![License](https://img.shields.io/cocoapods/l/ObjectMapper+Realm.svg?style=flat)](https://github.com/Jakenberg/ObjectMapper-Realm/blob/master/LICENSE) 8 | 9 | ## Installation [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | 11 | ObjectMapper+Realm is available through [CocoaPods](http://cocoapods.org/pods/ObjectMapper+Realm). To install 12 | it, simply add the following line to your Podfile: 13 | 14 | ```ruby 15 | pod "ObjectMapper+Realm" 16 | ``` 17 | 18 | You may also install it through [Swift Package Manager](https://swift.org/package-manager/). 19 | 20 | ## Usage 21 | 22 | To use `ListTransform` just add it to the mapping of your RealmObject: 23 | ```swift 24 | import ObjectMapper 25 | import RealmSwift 26 | import ObjectMapper_Realm 27 | 28 | class User: Object, Mappable { 29 | dynamic var username: NSString? 30 | var friends: List? 31 | 32 | required convenience init?(_ map: Map) { 33 | self.init() 34 | } 35 | 36 | override class func primaryKey() -> String? { 37 | return "username" 38 | } 39 | 40 | func mapping(map: Map) { 41 | username <- map["username"] 42 | friends <- (map["friends"], ListTransform()) 43 | } 44 | } 45 | ``` 46 | 47 | If you need to have control over your newly serialized objects, you can use the `onSerialize` callback: 48 | ```swift 49 | class User: Object, Mappable { 50 | 51 | func mapping(map: Map) { 52 | username <- map["username"] 53 | friends <- (map["friends"], ListTransform(onSerialize: onSerialize)) 54 | } 55 | 56 | private func onSerialize(users: List) { 57 | let realm = Storage.shared.realm 58 | try! realm.write { 59 | realm.add(users, update: .modified) 60 | } 61 | } 62 | } 63 | ``` 64 | 65 | Have fun! 🎬 66 | 67 | ## Author 68 | 69 | [Jake Peterson](http://jakenberg.io) 70 | 71 | ## License 72 | 73 | ObjectMapper+Realm is available under the MIT license. See the [LICENSE](https://github.com/Jakenberg/ObjectMapper-Realm/blob/master/LICENSE) file for more info. 74 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | xcode: 3 | version: "8.2" 4 | dependencies: 5 | pre: 6 | - xcrun instruments -w "iPhone 6 (8.3 Simulator)" || exit 0 7 | override: 8 | - sudo gem install cocoapods xcpretty obcd -N 9 | - pod install 10 | test: 11 | override: 12 | - set -o pipefail && xcodebuild -workspace ObjectMapper+Realm.xcworkspace -scheme 13 | ObjectMapper+Realm -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6" 14 | GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES 15 | GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c 16 | --report junit --output ${CIRCLE_TEST_REPORTS}/junit.xml 17 | - pod lib lint --quick 18 | deployment: 19 | codecov: 20 | branch: /.*/ 21 | commands: 22 | - bash <(curl -s https://codecov.io/bash) 23 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | 4 | coverage: 5 | precision: 2 6 | round: down 7 | range: "70...100" 8 | 9 | status: 10 | project: yes 11 | patch: yes 12 | changes: no 13 | 14 | parsers: 15 | gcov: 16 | branch_detection: 17 | conditional: yes 18 | loop: yes 19 | method: no 20 | macro: no 21 | 22 | comment: 23 | layout: "reach,diff,flags,tree" 24 | behavior: default 25 | require_changes: no 26 | --------------------------------------------------------------------------------