project nameをcoredataで作ると、
coredata : cannot import module being compiled
project nameとframeworkの重複ですね。CoreDataAppに作り直します。
viewDidLodに以下のように書く。
override func viewDidLoad() {
super.viewDidLoad()
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let context = appDelegate.persistentContainer.viewContext
let entity = NSEntityDescription.entity(forEntityName: "Users", in: context)
let newUser = NSManagedObject(entity: entity!, insertInto: context)
}
最初のappDelegateとは?
→アプリをつくった段階でデフォルトでつくられるファイルのひとつ。アプリ全体のライフタイムイベントを管理する

logを取ったり(どの画面で閉じたか)、ローカルのデータベースに今の状態を保存したい時とかに使っっている。
coredataでObject Graph Management(左)とPersistance(パーシスタンス)(右)の2パートに分かれていて、その二つを繋いでいるのがNSPersistantCoordinator
NSEntityDescription
Entities are to managed objects what Class is to id, or—to use a database analogy—what tables are to rows.
https://developer.apple.com/documentation/coredata/nsentitydescription?changes=_8