My project structure/dependencies are:
AppDelegate --> Imports "FirstRunViewController" and "MainViewController"
- If the user is logged in, it sets the rootViewController to MainViewController
- If the user is not logged in, it sets the rootViewController to FirstRunViewController
FirstRunViewController --> Imports "MainViewController"
- After login/sign up, it sets the viewController as MainViewController
MainViewController --> Imports "SettingsViewController"
- Presents SettingsViewController when needed
SettingsViewController --> Imports "FirstRunViewController"
- If the user chooses to log out, it sets the viewController as FirstRunViewController
My Issue
Importing "FirstRunViewController" in "SettingsViewController" (to handle logging out) causes Xcode to not be able to find a valid delegate in another, unrelated ViewController. The specific error code is "No type or protocol named ABCDelegate".
Deleting that "#import" statement will allow the code to run and compile, but disables logging out.
My Question
Why does this happen?
How can I stop this from happening?