├── CarRepos.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── priyankapote.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── priyankapote.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── CarRepos ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CarRepos.xcdatamodeld │ ├── .xccurrentversion │ └── CarRepos.xcdatamodel │ │ └── contents ├── CoreDataStack.swift ├── HomeViewController.swift ├── Images │ └── carImage.jpg ├── Info.plist ├── MyVehicleViewController.swift ├── Service │ └── CarService.swift └── cars.json └── README.md /CarRepos.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 19773EA81FB320A200E9BE0D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19773EA71FB320A200E9BE0D /* AppDelegate.swift */; }; 11 | 19773EAD1FB320A200E9BE0D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 19773EAB1FB320A200E9BE0D /* Main.storyboard */; }; 12 | 19773EB01FB320A200E9BE0D /* CarRepos.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 19773EAE1FB320A200E9BE0D /* CarRepos.xcdatamodeld */; }; 13 | 19773EB21FB320A200E9BE0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 19773EB11FB320A200E9BE0D /* Assets.xcassets */; }; 14 | 19773EB51FB320A200E9BE0D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 19773EB31FB320A200E9BE0D /* LaunchScreen.storyboard */; }; 15 | 19773EBE1FB324A200E9BE0D /* carImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 19773EBD1FB324A100E9BE0D /* carImage.jpg */; }; 16 | 19773EC11FB324BE00E9BE0D /* CarService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19773EC01FB324BE00E9BE0D /* CarService.swift */; }; 17 | 19773EC31FB3251D00E9BE0D /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19773EC21FB3251D00E9BE0D /* HomeViewController.swift */; }; 18 | 19773EC51FB3253000E9BE0D /* MyVehicleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19773EC41FB3253000E9BE0D /* MyVehicleViewController.swift */; }; 19 | 19773EC71FB3255900E9BE0D /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19773EC61FB3255900E9BE0D /* CoreDataStack.swift */; }; 20 | 19773ECB1FB32E8300E9BE0D /* cars.json in Resources */ = {isa = PBXBuildFile; fileRef = 19773ECA1FB32E8300E9BE0D /* cars.json */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 19773EA41FB320A200E9BE0D /* CarRepos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CarRepos.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 19773EA71FB320A200E9BE0D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 19773EAC1FB320A200E9BE0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 19773EAF1FB320A200E9BE0D /* CarRepos.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = CarRepos.xcdatamodel; sourceTree = ""; }; 28 | 19773EB11FB320A200E9BE0D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 19773EB41FB320A200E9BE0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 19773EB61FB320A200E9BE0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 19773EBD1FB324A100E9BE0D /* carImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = carImage.jpg; sourceTree = ""; }; 32 | 19773EC01FB324BE00E9BE0D /* CarService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarService.swift; sourceTree = ""; }; 33 | 19773EC21FB3251D00E9BE0D /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; 34 | 19773EC41FB3253000E9BE0D /* MyVehicleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyVehicleViewController.swift; sourceTree = ""; }; 35 | 19773EC61FB3255900E9BE0D /* CoreDataStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = ""; }; 36 | 19773ECA1FB32E8300E9BE0D /* cars.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = cars.json; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 19773EA11FB320A200E9BE0D /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 19773E9B1FB320A200E9BE0D = { 51 | isa = PBXGroup; 52 | children = ( 53 | 19773EA61FB320A200E9BE0D /* CarRepos */, 54 | 19773EA51FB320A200E9BE0D /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | 19773EA51FB320A200E9BE0D /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 19773EA41FB320A200E9BE0D /* CarRepos.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | 19773EA61FB320A200E9BE0D /* CarRepos */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 19773EA71FB320A200E9BE0D /* AppDelegate.swift */, 70 | 19773EC21FB3251D00E9BE0D /* HomeViewController.swift */, 71 | 19773EC61FB3255900E9BE0D /* CoreDataStack.swift */, 72 | 19773ECA1FB32E8300E9BE0D /* cars.json */, 73 | 19773EC41FB3253000E9BE0D /* MyVehicleViewController.swift */, 74 | 19773EBF1FB324AC00E9BE0D /* Service */, 75 | 19773EBC1FB3248A00E9BE0D /* Images */, 76 | 19773EAB1FB320A200E9BE0D /* Main.storyboard */, 77 | 19773EB11FB320A200E9BE0D /* Assets.xcassets */, 78 | 19773EB31FB320A200E9BE0D /* LaunchScreen.storyboard */, 79 | 19773EB61FB320A200E9BE0D /* Info.plist */, 80 | 19773EAE1FB320A200E9BE0D /* CarRepos.xcdatamodeld */, 81 | ); 82 | path = CarRepos; 83 | sourceTree = ""; 84 | }; 85 | 19773EBC1FB3248A00E9BE0D /* Images */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 19773EBD1FB324A100E9BE0D /* carImage.jpg */, 89 | ); 90 | path = Images; 91 | sourceTree = ""; 92 | }; 93 | 19773EBF1FB324AC00E9BE0D /* Service */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 19773EC01FB324BE00E9BE0D /* CarService.swift */, 97 | ); 98 | path = Service; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 19773EA31FB320A200E9BE0D /* CarRepos */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 19773EB91FB320A200E9BE0D /* Build configuration list for PBXNativeTarget "CarRepos" */; 107 | buildPhases = ( 108 | 19773EA01FB320A200E9BE0D /* Sources */, 109 | 19773EA11FB320A200E9BE0D /* Frameworks */, 110 | 19773EA21FB320A200E9BE0D /* Resources */, 111 | ); 112 | buildRules = ( 113 | ); 114 | dependencies = ( 115 | ); 116 | name = CarRepos; 117 | productName = CarRepos; 118 | productReference = 19773EA41FB320A200E9BE0D /* CarRepos.app */; 119 | productType = "com.apple.product-type.application"; 120 | }; 121 | /* End PBXNativeTarget section */ 122 | 123 | /* Begin PBXProject section */ 124 | 19773E9C1FB320A200E9BE0D /* Project object */ = { 125 | isa = PBXProject; 126 | attributes = { 127 | LastSwiftUpdateCheck = 0910; 128 | LastUpgradeCheck = 0910; 129 | ORGANIZATIONNAME = VamshiKrishna; 130 | TargetAttributes = { 131 | 19773EA31FB320A200E9BE0D = { 132 | CreatedOnToolsVersion = 9.1; 133 | ProvisioningStyle = Automatic; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 19773E9F1FB320A200E9BE0D /* Build configuration list for PBXProject "CarRepos" */; 138 | compatibilityVersion = "Xcode 8.0"; 139 | developmentRegion = en; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 19773E9B1FB320A200E9BE0D; 146 | productRefGroup = 19773EA51FB320A200E9BE0D /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 19773EA31FB320A200E9BE0D /* CarRepos */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | 19773EA21FB320A200E9BE0D /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 19773EBE1FB324A200E9BE0D /* carImage.jpg in Resources */, 161 | 19773EB51FB320A200E9BE0D /* LaunchScreen.storyboard in Resources */, 162 | 19773ECB1FB32E8300E9BE0D /* cars.json in Resources */, 163 | 19773EB21FB320A200E9BE0D /* Assets.xcassets in Resources */, 164 | 19773EAD1FB320A200E9BE0D /* Main.storyboard in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | 19773EA01FB320A200E9BE0D /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 19773EA81FB320A200E9BE0D /* AppDelegate.swift in Sources */, 176 | 19773EC11FB324BE00E9BE0D /* CarService.swift in Sources */, 177 | 19773EC51FB3253000E9BE0D /* MyVehicleViewController.swift in Sources */, 178 | 19773EC71FB3255900E9BE0D /* CoreDataStack.swift in Sources */, 179 | 19773EB01FB320A200E9BE0D /* CarRepos.xcdatamodeld in Sources */, 180 | 19773EC31FB3251D00E9BE0D /* HomeViewController.swift in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | 19773EAB1FB320A200E9BE0D /* Main.storyboard */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | 19773EAC1FB320A200E9BE0D /* Base */, 191 | ); 192 | name = Main.storyboard; 193 | sourceTree = ""; 194 | }; 195 | 19773EB31FB320A200E9BE0D /* LaunchScreen.storyboard */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | 19773EB41FB320A200E9BE0D /* Base */, 199 | ); 200 | name = LaunchScreen.storyboard; 201 | sourceTree = ""; 202 | }; 203 | /* End PBXVariantGroup section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | 19773EB71FB320A200E9BE0D /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_ANALYZER_NONNULL = YES; 211 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 212 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 213 | CLANG_CXX_LIBRARY = "libc++"; 214 | CLANG_ENABLE_MODULES = YES; 215 | CLANG_ENABLE_OBJC_ARC = YES; 216 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 217 | CLANG_WARN_BOOL_CONVERSION = YES; 218 | CLANG_WARN_COMMA = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 222 | CLANG_WARN_EMPTY_BODY = YES; 223 | CLANG_WARN_ENUM_CONVERSION = YES; 224 | CLANG_WARN_INFINITE_RECURSION = YES; 225 | CLANG_WARN_INT_CONVERSION = YES; 226 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 227 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 230 | CLANG_WARN_STRICT_PROTOTYPES = YES; 231 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 232 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 233 | CLANG_WARN_UNREACHABLE_CODE = YES; 234 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 235 | CODE_SIGN_IDENTITY = "iPhone Developer"; 236 | COPY_PHASE_STRIP = NO; 237 | DEBUG_INFORMATION_FORMAT = dwarf; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | ENABLE_TESTABILITY = YES; 240 | GCC_C_LANGUAGE_STANDARD = gnu11; 241 | GCC_DYNAMIC_NO_PIC = NO; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_OPTIMIZATION_LEVEL = 0; 244 | GCC_PREPROCESSOR_DEFINITIONS = ( 245 | "DEBUG=1", 246 | "$(inherited)", 247 | ); 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 255 | MTL_ENABLE_DEBUG_INFO = YES; 256 | ONLY_ACTIVE_ARCH = YES; 257 | SDKROOT = iphoneos; 258 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 259 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 260 | }; 261 | name = Debug; 262 | }; 263 | 19773EB81FB320A200E9BE0D /* Release */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_ANALYZER_NONNULL = YES; 268 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 269 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 270 | CLANG_CXX_LIBRARY = "libc++"; 271 | CLANG_ENABLE_MODULES = YES; 272 | CLANG_ENABLE_OBJC_ARC = YES; 273 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 274 | CLANG_WARN_BOOL_CONVERSION = YES; 275 | CLANG_WARN_COMMA = YES; 276 | CLANG_WARN_CONSTANT_CONVERSION = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 290 | CLANG_WARN_UNREACHABLE_CODE = YES; 291 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 292 | CODE_SIGN_IDENTITY = "iPhone Developer"; 293 | COPY_PHASE_STRIP = NO; 294 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 295 | ENABLE_NS_ASSERTIONS = NO; 296 | ENABLE_STRICT_OBJC_MSGSEND = YES; 297 | GCC_C_LANGUAGE_STANDARD = gnu11; 298 | GCC_NO_COMMON_BLOCKS = YES; 299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 301 | GCC_WARN_UNDECLARED_SELECTOR = YES; 302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 303 | GCC_WARN_UNUSED_FUNCTION = YES; 304 | GCC_WARN_UNUSED_VARIABLE = YES; 305 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 306 | MTL_ENABLE_DEBUG_INFO = NO; 307 | SDKROOT = iphoneos; 308 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 309 | VALIDATE_PRODUCT = YES; 310 | }; 311 | name = Release; 312 | }; 313 | 19773EBA1FB320A200E9BE0D /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CODE_SIGN_STYLE = Automatic; 318 | DEVELOPMENT_TEAM = XJXJJVUFT9; 319 | INFOPLIST_FILE = CarRepos/Info.plist; 320 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 321 | PRODUCT_BUNDLE_IDENTIFIER = vamshi.in.CarRepos; 322 | PRODUCT_NAME = "$(TARGET_NAME)"; 323 | SWIFT_VERSION = 4.0; 324 | TARGETED_DEVICE_FAMILY = "1,2"; 325 | }; 326 | name = Debug; 327 | }; 328 | 19773EBB1FB320A200E9BE0D /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | buildSettings = { 331 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 332 | CODE_SIGN_STYLE = Automatic; 333 | DEVELOPMENT_TEAM = XJXJJVUFT9; 334 | INFOPLIST_FILE = CarRepos/Info.plist; 335 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 336 | PRODUCT_BUNDLE_IDENTIFIER = vamshi.in.CarRepos; 337 | PRODUCT_NAME = "$(TARGET_NAME)"; 338 | SWIFT_VERSION = 4.0; 339 | TARGETED_DEVICE_FAMILY = "1,2"; 340 | }; 341 | name = Release; 342 | }; 343 | /* End XCBuildConfiguration section */ 344 | 345 | /* Begin XCConfigurationList section */ 346 | 19773E9F1FB320A200E9BE0D /* Build configuration list for PBXProject "CarRepos" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | 19773EB71FB320A200E9BE0D /* Debug */, 350 | 19773EB81FB320A200E9BE0D /* Release */, 351 | ); 352 | defaultConfigurationIsVisible = 0; 353 | defaultConfigurationName = Release; 354 | }; 355 | 19773EB91FB320A200E9BE0D /* Build configuration list for PBXNativeTarget "CarRepos" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | 19773EBA1FB320A200E9BE0D /* Debug */, 359 | 19773EBB1FB320A200E9BE0D /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | /* End XCConfigurationList section */ 365 | 366 | /* Begin XCVersionGroup section */ 367 | 19773EAE1FB320A200E9BE0D /* CarRepos.xcdatamodeld */ = { 368 | isa = XCVersionGroup; 369 | children = ( 370 | 19773EAF1FB320A200E9BE0D /* CarRepos.xcdatamodel */, 371 | ); 372 | currentVersion = 19773EAF1FB320A200E9BE0D /* CarRepos.xcdatamodel */; 373 | path = CarRepos.xcdatamodeld; 374 | sourceTree = ""; 375 | versionGroupType = wrapper.xcdatamodel; 376 | }; 377 | /* End XCVersionGroup section */ 378 | }; 379 | rootObject = 19773E9C1FB320A200E9BE0D /* Project object */; 380 | } 381 | -------------------------------------------------------------------------------- /CarRepos.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CarRepos.xcodeproj/project.xcworkspace/xcuserdata/priyankapote.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VamshiIITBHU14/BackgroundCoreData/f8f0aa2158e9014877d921ada701c3e5bb501d24/CarRepos.xcodeproj/project.xcworkspace/xcuserdata/priyankapote.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CarRepos.xcodeproj/xcuserdata/priyankapote.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CarRepos.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CarRepos/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CarRepos 4 | // 5 | // Created by Vamshi Krishna on 08/11/17. 6 | // Copyright © 2017 VamshiKrishna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | var coreData = CoreDataStack() 17 | var managedObjectContext : NSManagedObjectContext! 18 | 19 | 20 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 21 | // Override point for customization after application launch. 22 | managedObjectContext = coreData.persistentContainer.viewContext 23 | let sourceController = self.window?.rootViewController as! HomeViewController 24 | sourceController.managedObjectContext = managedObjectContext 25 | 26 | let carService = CarService(managedObjectContext: managedObjectContext) 27 | carService.deleteVehicleData() 28 | carService.loadVehicleData() 29 | 30 | return true 31 | } 32 | 33 | func applicationWillResignActive(_ application: UIApplication) { 34 | // 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. 35 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 36 | } 37 | 38 | func applicationDidEnterBackground(_ application: UIApplication) { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | func applicationWillEnterForeground(_ application: UIApplication) { 44 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 45 | } 46 | 47 | func applicationDidBecomeActive(_ application: UIApplication) { 48 | // 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. 49 | } 50 | 51 | func applicationWillTerminate(_ application: UIApplication) { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | // Saves changes in the application's managed object context before the application terminates. 54 | } 55 | 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /CarRepos/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /CarRepos/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 | -------------------------------------------------------------------------------- /CarRepos/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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /CarRepos/CarRepos.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | CarRepos.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /CarRepos/CarRepos.xcdatamodeld/CarRepos.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /CarRepos/CoreDataStack.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoreDataStack.swift 3 | // CarRepos 4 | // 5 | // Created by Vamshi Krishna on 08/11/17. 6 | // Copyright © 2017 VamshiKrishna. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreData 11 | 12 | class CoreDataStack { 13 | lazy var persistentContainer: NSPersistentContainer = { 14 | /* 15 | The persistent container for the application. This implementation 16 | creates and returns a container, having loaded the store for the 17 | application to it. This property is optional since there are legitimate 18 | error conditions that could cause the creation of the store to fail. 19 | */ 20 | let container = NSPersistentContainer(name: "CarRepos") 21 | container.loadPersistentStores(completionHandler: { (storeDescription, error) in 22 | if let error = error as NSError? { 23 | // Replace this implementation with code to handle the error appropriately. 24 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 25 | 26 | /* 27 | Typical reasons for an error here include: 28 | * The parent directory does not exist, cannot be created, or disallows writing. 29 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 30 | * The device is out of space. 31 | * The store could not be migrated to the current model version. 32 | Check the error message to determine what the actual problem was. 33 | */ 34 | fatalError("Unresolved error \(error), \(error.userInfo)") 35 | } 36 | }) 37 | return container 38 | }() 39 | 40 | // MARK: - Core Data Saving support 41 | 42 | func saveContext () { 43 | let context = persistentContainer.viewContext 44 | if context.hasChanges { 45 | do { 46 | try context.save() 47 | } catch { 48 | // Replace this implementation with code to handle the error appropriately. 49 | // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 50 | let nserror = error as NSError 51 | fatalError("Unresolved error \(nserror), \(nserror.userInfo)") 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /CarRepos/HomeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.swift 3 | // CarRepos 4 | // 5 | // Created by Vamshi Krishna on 08/11/17. 6 | // Copyright © 2017 VamshiKrishna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | class HomeViewController: UIViewController { 13 | 14 | var managedObjectContext:NSManagedObjectContext! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | } 19 | 20 | @IBAction func fetchCarsClicked(_ sender: Any) { 21 | 22 | } 23 | 24 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 25 | if (segue.identifier == "segueMyVehicles"){ 26 | let controller = segue.destination as! MyVehicleViewController 27 | controller.managedObjectContext = managedObjectContext 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /CarRepos/Images/carImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VamshiIITBHU14/BackgroundCoreData/f8f0aa2158e9014877d921ada701c3e5bb501d24/CarRepos/Images/carImage.jpg -------------------------------------------------------------------------------- /CarRepos/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CarRepos/MyVehicleViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MyVehicleViewController.swift 3 | // CarRepos 4 | // 5 | // Created by Vamshi Krishna on 08/11/17. 6 | // Copyright © 2017 VamshiKrishna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | class MyVehicleViewController: UIViewController { 13 | 14 | var managedObjectContext:NSManagedObjectContext! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | let carService = CarService(managedObjectContext: managedObjectContext) 19 | carService.showVehicle() 20 | } 21 | 22 | @IBAction func backToHome(_ sender:AnyObject){ 23 | dismiss(animated: true, completion: nil) 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /CarRepos/Service/CarService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CarService.swift 3 | // CarRepos 4 | // 5 | // Created by Vamshi Krishna on 08/11/17. 6 | // Copyright © 2017 VamshiKrishna. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreData 11 | 12 | class CarService{ 13 | 14 | internal var managedObjectContext: NSManagedObjectContext! 15 | 16 | internal init(managedObjectContext: NSManagedObjectContext) { 17 | self.managedObjectContext = managedObjectContext 18 | } 19 | 20 | deinit { 21 | self.managedObjectContext = nil 22 | } 23 | 24 | internal func getMyVehicles() -> [Car] { 25 | var cars = [Car]() 26 | 27 | let request: NSFetchRequest = Car.fetchRequest() 28 | 29 | do { 30 | cars = try managedObjectContext.fetch(request) 31 | } 32 | catch { 33 | fatalError("Error loading cars") 34 | } 35 | 36 | return cars 37 | } 38 | 39 | internal func deleteVehicle(_ car: Car) { 40 | managedObjectContext.delete(car) 41 | saveState() 42 | } 43 | 44 | fileprivate func saveState() { 45 | do { 46 | try self.managedObjectContext.save() 47 | } 48 | catch { 49 | fatalError("Error inserting service record") 50 | } 51 | } 52 | 53 | func loadVehicleData() { 54 | 55 | let url = Bundle.main.url(forResource: "cars", withExtension: "json") 56 | let data = NSData(contentsOf: url!) 57 | 58 | self.managedObjectContext.perform({ 59 | do { 60 | 61 | let jsonResult = try JSONSerialization.jsonObject(with: data! as Data, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSDictionary 62 | let jsonArray = jsonResult.value(forKey: "makes") as! NSArray 63 | 64 | for json in jsonArray { 65 | let carData = json as! [String: AnyObject] 66 | 67 | guard let makeName = carData["name"] else { return } 68 | let autoMaker = AutoMaker(context: self.managedObjectContext) 69 | autoMaker.make = makeName as? String 70 | 71 | // Get the current AutoModels under the current AutoMaker 72 | let autoModels = autoMaker.autoModel!.mutableCopy() as! NSMutableSet 73 | 74 | // Get the available AutoModel in JSON object for the current AutoMaker 75 | guard let arrModelNames = carData["models"] as? NSArray else { return } 76 | for modelName in arrModelNames { 77 | let jsonModel = modelName as! [String: AnyObject] 78 | let modelName = jsonModel["name"] as? String 79 | 80 | let autoModel = AutoModel(context: self.managedObjectContext) 81 | autoModel.model = modelName 82 | 83 | let autoYears = autoModel.autoYear!.mutableCopy() as! NSMutableSet 84 | 85 | guard let arrModelYears = jsonModel["years"] as? NSArray else { return } 86 | for modelYear in arrModelYears { 87 | let jsonYear = modelYear as! [String: AnyObject] 88 | let year = jsonYear["year"] as? NSNumber 89 | 90 | let autoYear = AutoYear(context: self.managedObjectContext) 91 | autoYear.year = (year?.int16Value)! 92 | autoYears.add(autoYear) 93 | } 94 | 95 | // Set AutoYear into AutoModel for CoreData 96 | autoModel.autoYear = autoYears.copy() as? NSSet 97 | 98 | autoModels.add(autoModel) 99 | } 100 | 101 | // Set the AutoModel into AutoMaker for CoreData 102 | autoMaker.autoModel = autoModels.copy() as? NSSet 103 | } 104 | 105 | try self.managedObjectContext.save() 106 | } 107 | catch let error as NSError { 108 | print("Error in parsing JSON data: \(error.localizedDescription)") 109 | } 110 | }) 111 | self.showVehicle() 112 | } 113 | 114 | 115 | func deleteVehicleData() { 116 | let makerRequest: NSFetchRequest = AutoMaker.fetchRequest() 117 | let modelRequest: NSFetchRequest = AutoModel.fetchRequest() 118 | let yearRequest: NSFetchRequest = AutoYear.fetchRequest() 119 | 120 | do { 121 | let makerResult = try self.managedObjectContext.fetch(makerRequest) 122 | 123 | for maker in makerResult { 124 | self.managedObjectContext.delete(maker) 125 | } 126 | 127 | let modelResult = try self.managedObjectContext.fetch(modelRequest) 128 | for model in modelResult { 129 | self.managedObjectContext.delete(model) 130 | } 131 | 132 | let yearResult = try self.managedObjectContext.fetch(yearRequest) 133 | for year in yearResult { 134 | self.managedObjectContext.delete(year) 135 | } 136 | 137 | try self.managedObjectContext.save() 138 | } 139 | catch { 140 | fatalError("Error deleting objects") 141 | } 142 | } 143 | 144 | func showVehicle() { 145 | let request: NSFetchRequest = AutoMaker.fetchRequest() 146 | request.predicate = NSPredicate(format: "make = 'Acura'") 147 | 148 | do { 149 | let results = try managedObjectContext.fetch(request) 150 | let autoMaker = results.first 151 | print("Automaker: \(String(describing: autoMaker?.make))") 152 | } 153 | catch { 154 | fatalError() 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /CarRepos/cars.json: -------------------------------------------------------------------------------- 1 | {"makes":[{"id":200347864,"name":"AM General","niceName":"am-general","models":[{"id":"AM_General_Hummer","name":"Hummer","niceName":"hummer","years":[{"id":3407,"year":1998},{"id":1140,"year":1999},{"id":305,"year":2000}]}]},{"id":200002038,"name":"Acura","niceName":"acura","models":[{"id":"Acura_CL","name":"CL","niceName":"cl","years":[{"id":3265,"year":1997},{"id":3266,"year":1998},{"id":960,"year":1999},{"id":100000010,"year":2001},{"id":100000456,"year":2002},{"id":100502607,"year":2003}]},{"id":"Acura_ILX","name":"ILX","niceName":"ilx","years":[{"id":100538929,"year":2013},{"id":200471908,"year":2014},{"id":200701415,"year":2015},{"id":200713715,"year":2016},{"id":401640361,"year":2017},{"id":401738519,"year":2018}]},{"id":"Acura_ILX_Hybrid","name":"ILX Hybrid","niceName":"ilx-hybrid","years":[{"id":200493809,"year":2014}]},{"id":"Acura_Integra","name":"Integra","niceName":"integra","years":[{"id":3268,"year":1990},{"id":890,"year":1991},{"id":3269,"year":1992},{"id":3270,"year":1993},{"id":891,"year":1994},{"id":3271,"year":1995},{"id":3272,"year":1996},{"id":892,"year":1997},{"id":3273,"year":1998},{"id":3411,"year":1999},{"id":1080,"year":2000},{"id":100000008,"year":2001}]},{"id":"Acura_Legend","name":"Legend","niceName":"legend","years":[{"id":3275,"year":1990},{"id":893,"year":1991},{"id":3276,"year":1992},{"id":3277,"year":1993},{"id":894,"year":1994},{"id":3278,"year":1995}]},{"id":"Acura_MDX","name":"MDX","niceName":"mdx","years":[{"id":100000009,"year":2001},{"id":100000530,"year":2002},{"id":100502711,"year":2003},{"id":100503653,"year":2004},{"id":100504946,"year":2005},{"id":100506940,"year":2006},{"id":100507584,"year":2007},{"id":100524172,"year":2008},{"id":100525749,"year":2009},{"id":100530869,"year":2010},{"id":100533210,"year":2011},{"id":100538329,"year":2012},{"id":200434553,"year":2013},{"id":200465929,"year":2014},{"id":200698434,"year":2015},{"id":200726800,"year":2016},{"id":200781960,"year":2017},{"id":401734378,"year":2018}]},{"id":"Acura_NSX","name":"NSX","niceName":"nsx","years":[{"id":100000366,"year":1991},{"id":3279,"year":1992},{"id":3280,"year":1993},{"id":3281,"year":1994},{"id":3282,"year":1995},{"id":3283,"year":1996},{"id":3284,"year":1997},{"id":3285,"year":1998},{"id":3412,"year":1999},{"id":953,"year":2000},{"id":100000011,"year":2001},{"id":100000573,"year":2002},{"id":100502712,"year":2003},{"id":100503652,"year":2004},{"id":100504947,"year":2005},{"id":200779937,"year":2017}]},{"id":"Acura_RDX","name":"RDX","niceName":"rdx","years":[{"id":100505131,"year":2007},{"id":100523811,"year":2008},{"id":100525429,"year":2009},{"id":100528669,"year":2010},{"id":100533372,"year":2011},{"id":100537229,"year":2012},{"id":100538949,"year":2013},{"id":200467168,"year":2014},{"id":200693511,"year":2015},{"id":200727186,"year":2016},{"id":401640362,"year":2017},{"id":401720010,"year":2018}]},{"id":"Acura_RL","name":"RL","niceName":"rl","years":[{"id":3286,"year":1996},{"id":3410,"year":1997},{"id":3287,"year":1998},{"id":3413,"year":1999},{"id":397,"year":2000},{"id":100000012,"year":2001},{"id":100000322,"year":2002},{"id":100502713,"year":2003},{"id":100502994,"year":2004},{"id":100503143,"year":2005},{"id":100506663,"year":2006},{"id":100519602,"year":2007},{"id":100523569,"year":2008},{"id":100525535,"year":2009},{"id":100528489,"year":2010},{"id":100534129,"year":2011},{"id":100524991,"year":2012}]},{"id":"Acura_RLX","name":"RLX","niceName":"rlx","years":[{"id":100539511,"year":2014},{"id":200706522,"year":2015},{"id":200729233,"year":2016},{"id":401676770,"year":2017}]},{"id":"Acura_RSX","name":"RSX","niceName":"rsx","years":[{"id":100000367,"year":2002},{"id":100502714,"year":2003},{"id":100503651,"year":2004},{"id":100504943,"year":2005},{"id":100506564,"year":2006}]},{"id":"Acura_SLX","name":"SLX","niceName":"slx","years":[{"id":3288,"year":1996},{"id":3289,"year":1997},{"id":3290,"year":1998},{"id":961,"year":1999}]},{"id":"Acura_TL","name":"TL","niceName":"tl","years":[{"id":100000368,"year":1995},{"id":3291,"year":1996},{"id":3408,"year":1997},{"id":895,"year":1998},{"id":3414,"year":1999},{"id":1067,"year":2000},{"id":100000013,"year":2001},{"id":100000321,"year":2002},{"id":100502606,"year":2003},{"id":100502993,"year":2004},{"id":100504945,"year":2005},{"id":100506840,"year":2006},{"id":100519601,"year":2007},{"id":100523753,"year":2008},{"id":100524030,"year":2009},{"id":100529409,"year":2010},{"id":100532894,"year":2011},{"id":100533455,"year":2012},{"id":200433190,"year":2013},{"id":200488448,"year":2014}]},{"id":"Acura_TLX","name":"TLX","niceName":"tlx","years":[{"id":200673634,"year":2015},{"id":401583109,"year":2016},{"id":401658802,"year":2017},{"id":401715719,"year":2018}]},{"id":"Acura_TSX","name":"TSX","niceName":"tsx","years":[{"id":100503100,"year":2004},{"id":100504944,"year":2005},{"id":100507159,"year":2006},{"id":100520228,"year":2007},{"id":100523478,"year":2008},{"id":100507581,"year":2009},{"id":100527369,"year":2010},{"id":100530509,"year":2011},{"id":100537769,"year":2012},{"id":200437325,"year":2013},{"id":200490517,"year":2014}]},{"id":"Acura_TSX_Sport_Wagon","name":"TSX Sport Wagon","niceName":"tsx-sport-wagon","years":[{"id":100533969,"year":2011},{"id":100537789,"year":2012},{"id":200440520,"year":2013},{"id":200673755,"year":2014}]},{"id":"Acura_Vigor","name":"Vigor","niceName":"vigor","years":[{"id":3292,"year":1992},{"id":3293,"year":1993},{"id":896,"year":1994}]},{"id":"Acura_ZDX","name":"ZDX","niceName":"zdx","years":[{"id":100527650,"year":2010},{"id":100534109,"year":2011},{"id":100537249,"year":2012},{"id":200441835,"year":2013}]}]},{"id":200464140,"name":"Alfa Romeo","niceName":"alfa-romeo","models":[{"id":"Alfa_Romeo_4C","name":"4C","niceName":"4c","years":[{"id":200700684,"year":2015},{"id":401630278,"year":2016},{"id":401665445,"year":2017},{"id":401733574,"year":2018}]},{"id":"Alfa_Romeo_Giulia","name":"Giulia","niceName":"giulia","years":[{"id":200741082,"year":2017},{"id":401724804,"year":2018}]},{"id":"Alfa_Romeo_Stelvio","name":"Stelvio","niceName":"stelvio","years":[{"id":401717892,"year":2018}]}]},{"id":200001769,"name":"Aston Martin","niceName":"aston-martin","models":[{"id":"Aston_Martin_DB11","name":"DB11","niceName":"db11","years":[{"id":401696107,"year":2017}]},{"id":"Aston_Martin_DB7","name":"DB7","niceName":"db7","years":[{"id":100000269,"year":2001},{"id":100000548,"year":2002},{"id":100503076,"year":2003}]},{"id":"Aston_Martin_DB9","name":"DB9","niceName":"db9","years":[{"id":100503551,"year":2005},{"id":100516903,"year":2006},{"id":100516886,"year":2007},{"id":100524869,"year":2008},{"id":100526129,"year":2009},{"id":100531569,"year":2010},{"id":100532429,"year":2011},{"id":100537350,"year":2012},{"id":200473435,"year":2013},{"id":200473436,"year":2014},{"id":401632427,"year":2015}]},{"id":"Aston_Martin_DB9_GT","name":"DB9 GT","niceName":"db9-gt","years":[{"id":401630246,"year":2016}]},{"id":"Aston_Martin_DBS","name":"DBS","niceName":"dbs","years":[{"id":100519044,"year":2008},{"id":100527534,"year":2009},{"id":100524969,"year":2010},{"id":100531250,"year":2011},{"id":100532430,"year":2012}]},{"id":"Aston_Martin_Rapide","name":"Rapide","niceName":"rapide","years":[{"id":100507321,"year":2010},{"id":100533509,"year":2011},{"id":100537349,"year":2012}]},{"id":"Aston_Martin_Rapide_S","name":"Rapide S","niceName":"rapide-s","years":[{"id":200460643,"year":2014},{"id":401632296,"year":2015},{"id":401632439,"year":2016},{"id":401698011,"year":2017}]},{"id":"Aston_Martin_V12_Vanquish","name":"V12 Vanquish","niceName":"v12-vanquish","years":[{"id":100502589,"year":2002},{"id":100503077,"year":2003},{"id":100504522,"year":2004},{"id":100504682,"year":2005},{"id":100516904,"year":2006}]},{"id":"Aston_Martin_V12_Vantage","name":"V12 Vantage","niceName":"v12-vantage","years":[{"id":100531969,"year":2011},{"id":100537351,"year":2012}]},{"id":"Aston_Martin_V12_Vantage_S","name":"V12 Vantage S","niceName":"v12-vantage-s","years":[{"id":200693539,"year":2015},{"id":401633296,"year":2016},{"id":401699716,"year":2017}]},{"id":"Aston_Martin_V8_Vantage","name":"V8 Vantage","niceName":"v8-vantage","years":[{"id":100503104,"year":2006},{"id":100524569,"year":2007},{"id":100512807,"year":2008},{"id":100527609,"year":2009},{"id":100531550,"year":2010},{"id":100533549,"year":2011},{"id":100537352,"year":2012},{"id":200472001,"year":2013},{"id":200472947,"year":2014},{"id":401627346,"year":2015},{"id":401627333,"year":2016}]},{"id":"Aston_Martin_Vanquish","name":"Vanquish","niceName":"vanquish","years":[{"id":200431313,"year":2014},{"id":401631543,"year":2015},{"id":401631544,"year":2016},{"id":401696095,"year":2017}]},{"id":"Aston_Martin_Vanquish_S","name":"Vanquish S","niceName":"vanquish-s","years":[{"id":401710084,"year":2018}]},{"id":"Aston_Martin_Virage","name":"Virage","niceName":"virage","years":[{"id":100535109,"year":2011},{"id":100534789,"year":2012}]}]},{"id":200000001,"name":"Audi","niceName":"audi","models":[{"id":"Audi_100","name":"100","niceName":"100","years":[{"id":3295,"year":1990},{"id":897,"year":1991},{"id":3296,"year":1992},{"id":3297,"year":1993},{"id":3298,"year":1994}]},{"id":"Audi_200","name":"200","niceName":"200","years":[{"id":3300,"year":1990},{"id":3301,"year":1991}]},{"id":"Audi_80","name":"80","niceName":"80","years":[{"id":3303,"year":1990},{"id":3304,"year":1991},{"id":898,"year":1992}]},{"id":"Audi_90","name":"90","niceName":"90","years":[{"id":3306,"year":1990},{"id":899,"year":1991},{"id":3307,"year":1993},{"id":3308,"year":1994},{"id":900,"year":1995}]}]}],"makesCount":5} 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoreDataBGThread 2 | This Project looks like nothing in the UI but it covers an important and complex topic in CoreData , i.e, writing data to Database in background thread so that UI does not get blocked. It uses Swift4 with a lot of reduction in boilerplate code. It also implements using a single managedobjectcontext. 3 | Also implements: 4 | 1) Writing complext JSON to CoreData 5 | 2) Using OneToOne and OneToMany relationships among entities 6 | --------------------------------------------------------------------------------