Recipe Manager with CoreData Persistence
Build an iOS recipe manager with SwiftUI and Core Data. You save recipes with a photo, the list of ingredients (each with a quantity and unit) and the preparation steps, then find them again by searching or filtering your favorites. Recipes and ingredients are separate entities linked by a relationship, so deleting a recipe removes its ingredients too, and searching happens in the database with fetch predicates instead of loading everything into memory. You'll learn Core Data modeling and relationships, NSFetchRequest and NSPredicate, @FetchRequest in SwiftUI, saving images efficiently, and forms with editable lists.
- Estimate
- ~10.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
SwiftUI · CoreData
Project roadmap
- 01
Design the Core Data model
~1.5hCreate an app with Core Data. In the model editor, add a Recipe entity (id, title, notes, servings, prep minutes, steps text, isFavorite, createdAt, photo as Binary Data with Allows External Storage) and an Ingredient entity (name, quantity, unit, position), with a one-to-many relationship whose delete rule is Cascade. Create a PersistenceController, with an in-memory version for previews and tests. Done when: the app starts and the model loads.
- 02
Build the list and detail screens
~2hShow recipes with @FetchRequest sorted by title, each row with a small photo, the title and a heart for favorites. Tapping opens a detail screen showing the photo, servings, ingredients in order, and the steps as a numbered list. Swiping deletes a recipe. Add a few sample recipes for previews. Done when: recipes show in the list and their details open.
- 03
Build the add and edit form
~2.5hCreate one form for adding and editing: title (required), servings, prep time, steps, an editable list of ingredients (add, remove and reorder) and a photo chosen with PhotosPicker. Shrink the photo before saving it, for example to a maximum width of 1200 pixels as JPEG. Edit in a child context (or a copy of the data), so Cancel discards changes. Done when: recipes can be created and edited, and Cancel changes nothing.
- 04
Add search and favorites
~1.5hAdd a search field with .searchable and a Favorites only toggle. Toggle the heart from the list and the detail screen, saving immediately. Done when: search and the favorites filter narrow the list correctly, and favorites persist after restarting.
- 05
Filter with predicates
~1.5hMake search and filtering happen in Core Data by changing the fetch request's predicate: title CONTAINS[cd] the search text, or ANY ingredients.name CONTAINS[cd] the text, combined with isFavorite == YES when the toggle is on, using NSCompoundPredicate. Done when: searching for an ingredient finds the recipes that use it, and search ignores case and accents.
- 06
Write Core Data tests
~1.5hWrite XCTest tests with the in-memory store: creating a recipe with ingredients, deleting a recipe also deletes its ingredients, the search predicate matches by title and ingredient, and the favorites filter works. Done when: all tests pass.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack