0

I have an existing UIKit based project. I would like to incorporate views based on SwiftUI. When creating a first view the compiler raises the following error:

struct ChartCore: View { //Inheritance from non-protocol type 'View'
    var body: some View {
        Text("Hello, World!")
    }
}

This issue has already been discussed here. In my case the problem is that I have a CoreData class which is defined as View

public class View: NSManagedObject, Decodable {
}

How do I avoid changing my CoreData model ?

Mansour
  • 515
  • 3
  • 7
  • 20
  • 1
    You have use SwiftUI.View but it is likely best to rename your model. You will be compensating for this all the time and your code will be “hard” to read for other programmers checking out your code. You can minimize these issues by calling things what they are such as “ViewEntity” – lorem ipsum Oct 14 '22 at 15:38

0 Answers0