{"id":22050212,"url":"https://github.com/icapps/example-populate-coredata","last_synced_at":"2026-04-28T01:32:02.829Z","repository":{"id":87416552,"uuid":"44393294","full_name":"icapps/example-populate-coredata","owner":"icapps","description":"An example Xcode project to populate your Core Data database.","archived":false,"fork":false,"pushed_at":"2015-11-23T10:27:16.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T10:38:09.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-16T15:16:11.000Z","updated_at":"2021-02-16T04:28:17.000Z","dependencies_parsed_at":"2023-03-14T01:30:37.606Z","dependency_job_id":null,"html_url":"https://github.com/icapps/example-populate-coredata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/icapps/example-populate-coredata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fexample-populate-coredata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fexample-populate-coredata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fexample-populate-coredata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fexample-populate-coredata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icapps","download_url":"https://codeload.github.com/icapps/example-populate-coredata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fexample-populate-coredata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32362781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T14:18:18.446Z","updated_at":"2026-04-28T01:32:02.808Z","avatar_url":"https://github.com/icapps.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Populate Core Data Example\n\nThis is an example Xcode project on how you can populate your Core Data database in your iOS or OS X application.\n\n## The case\n\nSometimes you have a big amount of data that you want fill your Core Data database with data from a webservice or an Excel file.\n\nIn order to do this I have setup a small example Xcode project. This project contains two targets:\n\n- The iOS application target\n- The Command Line Tool target\n\n### Command Line Tool\n\nTarget name: **Populator**\n\nThe _Command Line Tool_ target is responsible for generating the prepopulated database. This tool will generate the sqlite file an move it to the correct location so your it will be added to your iOS target.\n\nIn this case the generated data is hardcoded. But you will be able to fetch from an external service or file. Whatever fits your needs.\n\n### iOS application\n\nTarget name: **Glider Application**\n\nIn the _Preloaded Database_ target the populated sqlite file will be copied to the correct location and prepares the Core Data setup with the help of MagicalRecord.\n\n**MagicalRecord** is used because we want to reduce the amount of code in order to initialize and use Core Data.\n\n## Files.\n\nHere is some more information about some of the files.\n\n### MagicalRecord+Seed.h\n\nImport this category in your AppDelegate. Your prepopulated database will be copied to the correct location. And you will be able to set a version for future updates. When you want to release a new version of the app with new preseed data, you just have to run the Command Line Tool and increase the `kCurrentSeedVersion` integer value. The rest will be handled for you.\n\nHere is how to use it from your `AppDelegate`:\n\n```\n[MagicalRecord setupSeededStackWithName:@\"Store.sqlite\"];\n```\n\n### MagicalRecord+WAL.h\n\nSince iOS 7 and OS X Mavericks, Core Data uses a Write-Ahead Logging journalling mechanism. This has the disavantage that when you create an sqlite preseeded database, that the data transations are saved to some _wal-files_. So when you copy the sqlite file, no data resides inside it (everything is stored in the cached wal files). Therefore we disabled the WAL journalling with this category.\n\nMore info on the WAL journalling mechanism can be found in the [Mac documentation](https://developer.apple.com/library/mac/qa/qa1809/_index.html).\n\n### DatabaseSeed.h\n\nThe DatabaseSeed object will create the sqlite instance that will be used as the prepopulated database. It provides a save block so you to handle the saving for you.\n\n```\nDatabaseSeed *seed = [DatabaseSeed new];\n[seed save:^(NSManagedObjectContext *localContext) {\n  ...\n}];\n[seed clean];\n```\n\nYou just have to perform the importing (creation of your Core Data objects) inside the save block.\n\n## LICENSE\n\nCopyright (c) 2015 iCapps\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fexample-populate-coredata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficapps%2Fexample-populate-coredata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fexample-populate-coredata/lists"}