I am using core data in my child app. Used podspec file to link my child app with parent app as development pods.
Child app is working file with core data. Here Child is an entity in core data.
But while building parent getting below errors as Cannot find 'Child' in scope
import CoreData
import Foundation
import SwiftUI
class CoreDataService {
static let shared = CoreDataService()
lazy var stack: CoreDataStackType = CoreDataStack()
private init() {
// private init
}
func insertChildItem(name: String) {
guard let context = stack.context else { return }
let child = Child(context: context) // ==> Cannot find 'Child' in scope
child.id = UUID().uuidString
child.name = name
save()
}
func fetchChildList() -> [Child]? { // ==> Cannot find type 'Child' in scope
let request = NSFetchRequest<Child>(entityName: "Child") // ==> Cannot find type 'Child' in scope
guard let context = stack.context else { return nil}
do {
let items: [Child] = try context.fetch(request)
return items // ==> Cannot find type 'Child' in scope
} catch let error {
print("Error fetching. \(error)")
return nil
}
}
private func save() {
switch stack.save() {
case .saved: print("Saved")
case .rolledBack: print("RolledBack")
case .hasNoChanges: print("HasNoChanges")
}
}
}
am I missing any configuration in Child/Parent app?
Solution Found reference:

