Skip to content
ahmetbostancikliogluPublic

About

Minimal SwiftUI + Core Data demo: local CRUD persistence of text items with an MVVM structure.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

🗄️ Core Data for Swift

A minimal SwiftUI + Core Data demo showing local CRUD persistence with MVVM

Platform Swift SwiftUI Core Data Xcode Stars Last Commit

📖 Overview

Core Data for Swift is a compact iOS sample app that demonstrates how to persist data locally with Apple's Core Data framework in a SwiftUI app. It stores simple text items on device, lists them, and lets you delete them — all wired together with a clean MVVM structure. The project is a focused reference for the essential Core Data building blocks: a persistent container stack, a managed object model, @FetchRequest, and saving/deleting through a ViewModel.

✨ Features

  • Persist text items to disk via an NSPersistentContainer-backed CoreDataStack singleton.
  • Live-updating list of saved entities using SwiftUI's @FetchRequest with a sort descriptor and animation.
  • Add on submit — type into a text field and press return to save a new ModelEntity (with a generated UUID).
  • Swipe to delete items, with the delete persisted back to the managed object context.
  • MVVM separation — the ViewModel owns save logic (including rollback() on failure), keeping the view declarative.
  • Safe optionals — an Optional<String> extension unwraps Core Data's optional text attribute to a non-optional String.

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/Core-Data.git
cd Core-Data
open "Core Data for Swift.xcodeproj"

Then open the project in Xcode and press ⌘R to build and run on a simulator or device.

📋 Requirements

  • iOS 18.0 or later
  • Xcode 16 or later
  • Swift 5.0

🧑‍💻 Author

Ahmet Bostancıklıoğlu — @ahmetbostanciklioglu · ahmetbostancikli@gmail.com


⭐ If this helped you, consider giving the repo a star!

About

Minimal SwiftUI + Core Data demo: local CRUD persistence of text items with an MVVM structure.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages