An update is requested, since this question has of course been answered for previous versions, the latest search result dated 12/16 generates irrelevant compatibility with previous iOS 9 and 10 pro...
original source : https://stackoverflow.com/questions/48723979/how-to-add-core-data-to-existing-xcode-9-swift-4-ios-11-project
프로젝트 시작시 core data 사용을 설정하지 않고 프로젝트를 진행하다가 나중에 core data를 사용하기로 결정한 경우에 대한 설명
best answer : https://stackoverflow.com/a/48724602/3151712
go to File > new file... select core Data under iOS and select Data Model you'll still need some code which xcode auto generates whenever you select core data during project creation. to get it, just create new project with core data option checked and copy all the code written under ** //Mark: - Core Data Stack** comment in AppDelegate.swift and add
import CoreData
above
OPTIONAL
and don't forget to change the name of the app after copying in the managedObjectModel function of the code you just copied











