-2

I'm trying to display data in SwiftUI from a .xcdatamodeld file If I make the class I've got an error "Invalid redeclaration of ..."
And if I delete the class and I use only the extension I've got the error "Use of undeclared type ...
(Links lead to images)

What can I do ? Thank you

keke
  • 1
  • 1

1 Answers1

0

Assuming ListeVetements is an entity defined in your model and you have left the code generation option in your model for this entity to Class:

Your second approach (define a static func in an extension) should actually work.

But as you have played around with creating the classes yourself, try clean cmd+shift+k.

These code generation errors sometimes be very sticky. closing Xcode and deleting derived data sometimes helps rm -rf ~/Library/Developer/Xcode/DerivedData

nine stones
  • 3,264
  • 1
  • 24
  • 36
  • I already tried to clean the project... But @CranialDev solution is working thanks ! – keke Feb 02 '20 at 07:33