Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find TestView in scope

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

like image 726
jwknz Avatar asked Aug 03 '20 04:08

jwknz


People also ask

Can not find in scope?

In general, it's safe to assume that the “Cannot find '…' in scope” refers to a variable, function, type or other symbol that doesn't exist. If you want to solve this error, and fix the bug, start with what doesn't exist and work your way from there (i.e., text).

What is a scope in Swift?

SWIFT Scope is a powerful end-to-end business intelligence solution deployed on your premises that is lightweight and easy to implement. SWIFT Scope covers the whole spectrum from data gathering, data transformation, storage and visualisation.


4 Answers

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

like image 73
Kacy Avatar answered Oct 08 '22 01:10

Kacy


Don't forget to add it to your Target Membership

enter image description here

like image 24
Tai Le Avatar answered Oct 08 '22 00:10

Tai Le


  • Clean the project
  • Close and relaunch the Xcode

This will solve the problem.

like image 3
Rajan Twanabashu Avatar answered Oct 08 '22 01:10

Rajan Twanabashu


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

like image 1
Hashim Akhtar Avatar answered Oct 07 '22 23:10

Hashim Akhtar