TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

BetterRest autogenerated model class doesn't work after rename (edit: answered)

Forums > SwiftUI

I'm on Project 4 BetterRest of SwiftUI. I changed the name of BetterRest 1.mlmodel to SleepCalculator as shown. I am able to see the class as shown. However, the app won't run as I'm getting a "Use of unresolved identifier 'SleepCalculator' error. I know from past attempts to learning code that renaming classes generally leads to finding where that class was "auto-generated" and changing the code there, since Rename really does not rename everywhere.

I have retyped the code, built the app, etc. Nothing's working... And now changing back to BetterRest_1.mlmodel also doesn't work.

Any ideas?

EDIT: Will leave this up, in case it happens to anyone else. I had to close the project and reopen it. Somehow that made the class "take." XCode shenanigans...

5      

I had the same issue. I closed and re-opened the project as you suggested and now it sees the SleepCalculator() class. Thanks!

2      

My thanks to both of you. Hit the same problem, and the solution works for me too.

2      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.