Xcode Not Immediately Recognizing New Classes (iOS)

前端 未结 5 1022
陌清茗
陌清茗 2021-02-12 19:23

I\'ve been working with Xcode for about 5 months now and I just recently ran across a problem when I add a new class. If I add a new class, say for example \"CustomCell\" and I

相关标签:
5条回答
  • 2021-02-12 19:33

    Close all your projects, open the organizer (from the window menu), make sure the correct project is selected, then opposite 'derived data' click delete.

    After that, close xcode, re-open it, open your project, clean it, and everything should work okay.

    0 讨论(0)
  • 2021-02-12 19:36

    Fixed, in my case when creating new methods for my class, the other class called test did not see these methods because the target was missing. Thank you

    0 讨论(0)
  • 2021-02-12 19:46

    I had the same issue with Xcode not seeing any new class I created for a Watch OS2 app I am working on.

    Eventually I figured out that it saw the new classes I created in the "extension" directory, but that every class I created in the "app" directory of my project would not show.

    What worked for me was creating a new .swift file in the extension, then moving both the reference in the project and the actual file manually to the proper location. After that, I was able to instantiate these classes in my view controller.

    Hope that helps any other struggling watch app makers.

    0 讨论(0)
  • 2021-02-12 19:55

    Multiple Targets: Make sure your file belongs to the necessary targets!


    For a new file, make sure the appropriate targets are checked.


    For an existing file, check the file inspector to verify target membership.

    0 讨论(0)
  • 2021-02-12 19:55

    For those dealing with the same issue and the above solution failed to solve it, make sure you don't have the

    circular import

    issue like i had. It happened with me as i had complex code and i failed to realize my mistake.

    0 讨论(0)
提交回复
热议问题