Core Data Yığını
Kalıcı container ve context'i kurun.
Core Data Yığını, CoddyKit'te ücretsiz bir SwiftUI Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, SwiftUI Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. SwiftUI Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Meet Core Data
Core Data is Apple's mature framework for saving structured app data on the device, so your records survive after the app closes. 💾
What the Stack Is
The Core Data stack is the small set of objects that work together to load your data model and read or write records.
The Data Model File
Your entities live in a .xcdatamodeld file, a visual schema where you define the types and attributes Core Data will store.
The Persistent Container
The NSPersistentContainer wraps the whole stack: it loads your model and sets up the underlying storage for you.
let container = NSPersistentContainer(name: "MyApp")Loading the Stores
Call loadPersistentStores to open the database. Its closure tells you whether the store opened or failed.
container.loadPersistentStores { _, error in
if let error { fatalError("\(error)") }
}The View Context
The viewContext is your in-memory scratchpad for objects on the main thread, where you create, edit, and read records.
let context = container.viewContextA Reusable Controller
Most apps wrap the stack in one small controller class, so the rest of the app shares a single, ready-to-use context.
Injecting the Context
Pass the context into SwiftUI through the environment, so any view can reach it without manual hand-offs.
.environment(\.managedObjectContext, context)Saving Work
Changes stay in memory until you call save on the context, which writes everything to disk in one step.
try context.save()Why One Stack
Sharing a single stack keeps every view looking at the same data, so nothing falls out of sync across screens.
Set It Up Early
Build the stack once at app launch and hold onto it, so the container is ready before any screen needs data.
Quick Check
You set up the stack. One quick question about the pieces.
Recap
You met the Core Data stack: a model file, a persistent container, and a view context you inject into SwiftUI to read and save data. ✨
Sıkça Sorulan Sorular
“Core Data Yığını” dersi ücretsiz mi?
Evet — “Core Data Yığını” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve SwiftUI Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. SwiftUI Academy kursu toplamda 4 dersten oluşur.
“Core Data Yığını” dersinde ne öğreneceğim?
Kalıcı container ve context'i kurun. SwiftUI Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
SwiftUI Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te SwiftUI Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.
“Core Data Yığını” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu SwiftUI Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her SwiftUI Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Core Data Yığını
- @FetchRequest ile Veri Alma
- Varlık Oluşturma ve Kaydetme
- Predicate'ler ve Sıralama Tanımlayıcıları