scaffold_coredata_model
Generate a Core Data model (.xcdatamodeld) file with a named entity and optionally pre-defined attributes. This tool creates the data model file that Core Data uses to define your persistent object graph, saving you from manually configuring entities in the Xcode model editor.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | — | The name of the Core Data entity (e.g., "Workout") |
outputPath | string | Yes | — | Absolute path to the directory where the .xcdatamodeld package will be created |
attributes | array | No | — | List of attribute objects, each with name (string) and type (enum) |
Attribute Types
Section titled “Attribute Types”The type field in each attribute object accepts one of the following values:
String, Integer16, Integer32, Integer64, Double, Float, Boolean, Date, Binary, UUID, URI
Usage Examples
Section titled “Usage Examples”Create an entity with typed attributes
Section titled “Create an entity with typed attributes”“Create a Core Data model for a Workout entity with name, duration, calories, and date”
{ "name": "Workout", "outputPath": "/Users/dev/Projects/FitnessTracker/FitnessTracker/Models", "attributes": [ { "name": "name", "type": "String" }, { "name": "duration", "type": "Double" }, { "name": "caloriesBurned", "type": "Integer32" }, { "name": "completedAt", "type": "Date" }, { "name": "id", "type": "UUID" } ]}Create a simple entity without attributes
Section titled “Create a simple entity without attributes”“Scaffold a Core Data model called MealEntry that I’ll configure later”
{ "name": "MealEntry", "outputPath": "/Users/dev/Projects/FitnessTracker/FitnessTracker/Models"}Create an entity with binary data for images
Section titled “Create an entity with binary data for images”“Create a Core Data model for UserProfile that stores an avatar image”
{ "name": "UserProfile", "outputPath": "/Users/dev/Projects/FitnessTracker/FitnessTracker/Models", "attributes": [ { "name": "id", "type": "UUID" }, { "name": "displayName", "type": "String" }, { "name": "email", "type": "String" }, { "name": "avatarData", "type": "Binary" }, { "name": "joinedAt", "type": "Date" }, { "name": "isPremium", "type": "Boolean" } ]}Example Output
Section titled “Example Output”Created Core Data model: /Users/dev/Projects/FitnessTracker/FitnessTracker/Models/Workout.xcdatamodeld
Entity: WorkoutAttributes: name String duration Double caloriesBurned Integer32 completedAt Date id UUIDRelated Tools
Section titled “Related Tools”scaffold_viewmodel— Create a view model that fetches and manages Core Data objectsscaffold_view— Generate a SwiftUI view to display Core Data entitiesproject_create— Create a new project that can include Core Data support