22

I am seeing the following error in iOS14, I am not sure if it is a bug or a user error :-) I appreciate it is still in beta, so I will post this in the developer forums as well.

I am seeing the following error come up when I make a macOS app in SwiftUI - when I create the same as an iOS app, the error does not appear.

Do I need to do something special for macOS apps when it comes to importing SwiftUI modules?

enter image description here

enter image description here

jwknz
  • 6,598
  • 16
  • 72
  • 115

6 Answers6

11

Had this issue today because I renamed the file that contained the class. The solution was to delete the file and recreate it.

Kacy
  • 3,330
  • 4
  • 29
  • 57
9

Don't forget to add it to your Target Membership

enter image description here

Tai Le
  • 8,530
  • 5
  • 41
  • 34
3
  • Clean the project
  • Close and relaunch the Xcode

This will solve the problem.

Rajan Twanabashu
  • 4,586
  • 5
  • 43
  • 55
2

In my case the reason was that the protocol I was inheriting in the class, needed to be made public.

Hashim Akhtar
  • 813
  • 2
  • 11
  • 16
0

When you rename a swift View from Project navigator or refactor the name within a struct, check that the struct and preview name were updated accordingly.

Debra
  • 1
0

You need to make sure that you've selected "Create folder references" when adding a new file to the project.

enter image description here

PHANTOM-X
  • 502
  • 6
  • 16