January 18, 2021



Xcode – didMove never get called

didMove never get called

didMove never get called in Xcode?

didMove never get called when creating a new project with Xcode using the Game template. I selected Swift and SpriteKit. I found this issue when I was following a course on Udemy.com, and I couldn’t get a simple project to run like in the course videos. Creating a new project after deleting the one I was working on, after trying to debug the error, gave me the same result. didMove never get called. I did only one change to the project created with game template. That was to put in print(“didMove did run”). But it never was.

The only way I would get the didMove to run was calling the scene like this in the GameViewController.
let scene = MainMenuScene(size: CGSize(width: 1536, height: 2048))

Tried to google, and I found this one post on Stack Overflow with the same issue. He said it was caused by a period in his project name. Crazy, but I did use a – in my project name. Was only a test project, so calling it physics-test was not a good idea. I renamed it to PhysicsTest, and the didMove was called.

Not sure if it is a language setting issue or anything. I’m using english language and Norwegian region settings on my computer. Not sure if that got anything to do with it, but in the tutorial video I was following it worked great using – in the project name.

Anyway, if you experience didMove never get called in Xcode, it might be worth removing any non letter and number characters.

Happy coding!