- Manage object graphs and object lifecycle, including persistence.
- By default, Core Data uses a SQLite database as the persistent store
- import 해야 사용가능
- A container that encapsulates the Core Data stack in your application.
- app delegate 에서 접근 가능
- entity : class
- attribute : property
- relationship : class 간 관계
- managed object : instance
- core data 에 저장되어 있는 인스턴스로 타입을 아직 알 수 없다
- A generic class that implements all the basic behavior required of a Core Data model object.
- NSObject를 상속하므로 key, value 형태로 값을 읽을 수 있다
- NSEntityDescription : A description of an entity in Core Data. 런타임에 타입을 유추 가능
- entity(forEntityName:in:) : create a new managed object and insert it into the managed object context.
- NSManagedObjectContext 에 접근하기
- entity(forEntityName:in:) 를 이용해 코어 데이터에 삽입
- save 메소드를 사용해서 커밋하기
- NSManagedObjectContext 에 접근
- NSFetchRequest 생성
- fetch 메소드를 사용해 가져오기
- 프로젝트 생성시 use core data 선택하면 생성된다
- NSPersistentContainer의 프로퍼티로 존재
- an in-memory “scratchpad” for working with managed objects.
- An object representing a single object space or scratch pad that you use to fetch, create, and save managed objects.