Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

SwiftintermediatemobileAI generated

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

  1. 01

    Design the Core Data model

    ~1.5h

    Create 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.

  2. 02

    Build the list and detail screens

    ~2h

    Show 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.

  3. 03

    Build the add and edit form

    ~2.5h

    Create 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.

  4. 04

    Add search and favorites

    ~1.5h

    Add 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.

  5. 05

    Filter with predicates

    ~1.5h

    Make 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.

  6. 06

    Write Core Data tests

    ~1.5h

    Write 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.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~10.5h · 6 steps

Tech stack

SwiftUICoreData