I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The approach used here is adopted from the following source: | |
# http://nsscreencast.com/episodes/12-importing-into-core-data | |
# | |
# Since version 1.27, mogenerator automatically uses the current version of the data model | |
MODELS_DIR="MyModels" | |
DATA_MODEL="${MODELS_DIR}/MOPIncrementalStoreModel.xcdatamodeld" | |
# Homebrew stores mogenerator in /usr/local/bin | |
PATH=/usr/local/bin:${PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add this as a 'Run Script' step in your Xcode Project prior to the compile step | |
mogen=`which mogenerator` | |
if [[ -x $mogen ]]; then | |
echo "Updating data objects using $mogen" | |
cd "$PROJECT_DIR/Model" && $mogen -m MyProject.xcdatamodeld/MyProject.xcdatamodel -M ./generated -H ./entities | |
fi |