Reputation: 152
Within SceneDelegate.swift
the following code is returning the error message "Use of unresolved identifier 'ContentView'; did you mean 'ContentMode'?".
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options
connectionOptions: UIScene.ConnectionOptions) {
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: ContentView())
self.window = window
window.makeKeyAndVisible()
}
This error creates a failure in the program build. It's surprising since when I create a new project with the exact same SceneDelegate.swift
, there is no issue with ContentView.
If I change ContentView to ContentMode it returns the error 'ContentMode' cannot be constructed because it has no accessible initializers".
Has anyone else had this issue? Just curious where I should start looking or what I have done wrong.
Upvotes: 1
Views: 3016
Reputation: 152
Figured this one out. If anyone else is curious I changed the ContentView.swift
file name but didn't update it in SceneDelegate.swift
.
So if you change the ContentView.swift
file to BetterNameView.swift
you need to update the above code in SceneDelegate.swift
from ContentView()
to BetterNameView()
Upvotes: 5