Post

Replies

Boosts

Views

Activity

Core ML in Swift Playground
I wanted to create an App that utilizes the Vision Framework for the 2023 Swift Student Challenge. From the few post regarding the topic I tried to create a dummy project and build it to create a mlmodelc-file that I copied into the recourses folder and copied the automatically generated swift code into the source folder. Somehow the playground crashes when trying to force-unwrap the URL, which means it cannot find the model file (I also tried the same with an mlmodel file). class var urlOfModelInThisBundle: URL { let resPath = Bundle(for: self).url(forResource: "FoodClassifier", withExtension: "mlmodel") /* Here it fails already */ return try! MLModel.compileModel(at: resPath) } The naming is accurate and the dummy app is working. Is there something that I am not seeing?
4
1
1.6k
Apr ’23