Hi everyone,
I've been struggling for a few weeks to integrate my Core ML Image Classifier model into my .swiftpm project, and I’m hoping someone can help.
Here’s what I’ve done so far:
I converted my .mlmodel file to .mlmodelc manually via the terminal.
In my Package.swift file, I tried both "copy" and "process" options for the resource.
The issues I’m facing:
When using "process", Xcode gives me the error:
"multiple resources named 'coremldata.bin' in target 'AppModule'."
When using "copy", the app runs, but the model doesn’t work, and the terminal shows:
"A valid manifest does not exist at path: .../Manifest.json."
I even tried creating a Manifest.json manually to test, but this led to more errors, such as:
"File format version must be in the form of major.minor.patch."
"Failed to look up root model."
To check if the problem was specific to my model, I tested other Core ML models in the same setup, but none of them worked either.
I feel stuck and unsure of how to resolve these issues. Any guidance or suggestions would be greatly appreciated. Thanks in advance! :)
Swift Student Challenge
RSS for tagAsk questions and connect with other challenge applicants.
Posts under Swift Student Challenge tag
56 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I really want to participate in the upcoming Swift Student Challenge, but I'm using a MacBook that cannot update past MacOS Big Sur. Would submissions compiled from it still be eligible for SSC?
Thank you! :D
This is my code in ContentView:
import SwiftUI
import SceneKit
import PlaygroundSupport
struct ContentView: View {
var body: some View {
VStack {
Text("SceneKit with SwiftUI")
.font(.headline)
.padding()
SceneView(
scene: loadScene(),
options: [.autoenablesDefaultLighting, .allowsCameraControl]
)
.frame(width: 400, height: 400)
.border(Color.gray, width: 1)
}
}
}
func loadScene() -> SCNScene? {
if let fileURL = Bundle.main.url(forResource: "a", withExtension: "dae") {
do {
let scene = try SCNScene(url: fileURL, options: [
SCNSceneSource.LoadingOption.checkConsistency: true
])
print("Scene loaded successfully.")
return scene
} catch {
print("Error loading scene: \(error.localizedDescription)")
}
} else {
print("Error: Unable to locate a.dae in Resources.")
}
return nil
}
a.dae file exists in the Resources section of macOS Playground app. And a.dae can be viewed in Xcode.
Console shows: Error loading scene: The operation couldn’t be completed. (Foundation._GenericObjCError error 0.)
Any input is appreciated.
I am currently developing my submission for the SSC and I noticed that the swift playgrounds app for iOS does not have support for the new swift ui features in iOS 18. Are we allowed to submit apps that use these iOS 18 only features?
As predictive code completion is natively included in Xcode, are we allowed to use it for the Swift Student Challenge?
I can't seem to access preview for any of my views in any of my swift projects at all (using Mac to code and using iPhone 16 pro as preview and simulation, simulation can work), even after restarting Mac and Xcode itself.
The preview section has a popup saying "Cannot preview in this file, unexpected error occured" (for every file), please tell me what is wrong and help me solve it to see the preview, thank you!
details
Hey,
If I were a PhD student enrolled at an accredited academic institution, would I still be eligible to participate in the Swift Student Challenge?
Thank you!
Desarrolle una app en xcode 16 para version minima de ios 16, todo funcionaba bien hasta la version 17 de ios, pero para ios 18 empezaron los problemas, los botones no responden a un toque, se deben sostener con un toque largo para que funcionen, ahora de un momento a otro ya no funciona para ninguna version de ios, los eventos tactiles deben ser prolongados para que se activen, en los botones o elementos que usan el tapgesture, he probado de todo versiones de xcode, versiones de swiftui, dispostivos reales, emuladores de todo y nada funciona, algun consejo o solucion gracias
I am getting issue on my application that my device is jailbroken security message I updated my device 18.2 what the solution
When making a new Swift Playground via Xcode > New > Project > iOS > App Playground, as a .swiftpm package, the settings are very limited, including setting the minimum OS version.
This is incredibly irritating because I can't keep make @available blocks because that would double the size of my code, and I can't use SwiftData (for example) because my app needs to also support iOS 16.
Is there a way to set the minimum OS or some other upload type accepted for Apple so that I can change this simple setting?
Thank you
I want to use Swift language to write code for drawing multiple polygons. I would like to find some examples as references. Can anyone provide example code or tell me where I can see such examples? Thank you!
Following the examples from the official documentation: https://developer.apple.com/documentation/swiftui/adding-a-search-interface-to-your-app
When the user types in the text in the search field, the list is updated with filtered results. How do I cause these changes to be animated?
I tired to put .animated() after the .searchable modifier, the result was what I am looking for, however it also broke the animation of the search field getting/releasing focus.
Hello,
Although the Swift Student Challenge for 2025 has not yet been announced and is not officially taking place, I have a question regarding last year’s rules in the Swift Student Challenge. This is, of course, assuming the rules will be similar if the challenge runs again next year.
I am interested in utilizing CreateML to design a text classifier model. Given the substantial amount of data required for machine learning, am I allowed to outsource data from open-source libraries and/or social media platforms, provided that these resources abide by their terms of service? My primary concern is if I must create my own data as that will be time-consuming and more biased.
Thank you,
Jesse
I have an app which have an Immersive Space view and it needs the user to have a button in the bottom which have a fixed place in front of the user head like a dashboard in game or so but when the user get too close to any3d object in the view it could cover the button and make it inaccessible and it mainly would prevent the app for being approved like that in appstoreconnect I was working before on SceneKit and there was something like camera view Znear and Zfar which decide when to hide the 3d model if it comes too close or gets too far and I wonder if there is something like that in realityView / RealityKit 4.
Here is My Code and the screenshots follows
import SwiftUI
import RealityKit
struct ContentView: View {
@State var myHead: Entity = {
let headAnchor = AnchorEntity(.head)
headAnchor.position = [-0.02, -0.023, -0.24]
return headAnchor
}()
@State var clicked = false
var body: some View {
RealityView { content, attachments in
// create a 3d box
let mainBox = ModelEntity(mesh: .generateBox(size: [0.1, 0.1, 0.1]))
mainBox.position = [0, 1.6, -0.3]
content.add(mainBox)
content.add(myHead)
guard let attachmentEntity = attachments.entity(for: "Dashboard") else {return}
myHead.addChild(attachmentEntity)
}
attachments: {
// SwiftUI Inside Immersivre View
Attachment(id: "Dashboard") {
VStack {
Spacer()
.frame(height: 300)
Button(action: {
goClicked()
}) {
Text(clicked ? "⏸️" : "▶️")
.frame(maxWidth: 48, maxHeight: 48, alignment: .center)
.font(.extraLargeTitle)
}
.buttonStyle(.plain)
}
}
}
}
func goClicked() {
clicked.toggle()
}
}
Hi everyone,
We have a user experiencing a display issue. Here's a screenshot they shared with us. Unlike in the simulator, where we see three icons, their display shows two buttons abbreviated with ellipses. The device is iPhone 12 mini with iOS 17.6.1.
The user isn't using any accessibility settings or large text size. Does anyone know what setting might be causing this? Any advice would be appreciated!
Thanks!
All errors in TranslationError return the same error code, making it difficult to differentiate between them. How can this issue be resolved?
Say you have a SwiftData object that doesn't allow optionals:
@Model
class MySet: Identifiable {
var id: UUID
var weight: Int
var reps: Int
var isCompleted: Bool
var exercise: Exercise
Then you get from your MySet data a list of these MySets and append them into a State:
@State var sets: [MySet]
if let newSets = exercise.sets { //unwrapping the passed exercises sets
if (!newSets.isEmpty) { //we passed actual sets in so set them to our set
sets = newSets
}
And you use that State array in a ForEach and bind the Textfield directly to the data like so:
ForEach($sets){ $set in
TextField("\(set.weight)", value: $set.weight, formatter: NumberFormatter())
.keyboardType(.decimalPad)
TextField("\(set.reps)", value: $set.reps,formatter: NumberFormatter())
.keyboardType(.decimalPad)
}
This will bind whatever is written into the TextField directly to the SwiftData object which is a problem because say you have 50 written and you want to change it to 60 you need to be able to clear the 50 to write the 60 and since the SwiftData object doesn't allow nil it will allow you to remove the 0 but not the 5. Is there anyway to remedy this without having the swiftData object allow optionals for example catching the clearing of the TextField and making it 0 instead of nil when its cleared?
hi
im fairly new to coding.. about a month, just so u know.. 😇
I am going through the tasks in (Swift Playgrounds) and I am currently in (Learning to code 2) the chapter is (Random gems everywhere) and I tried every possible solution to complete it, but to no avail!
any suggestions, comments, or corrections or tips, would be greatly appreciated!
I will attach some screenshots for a reference of what I'm trying to accomplish..
when ios app will get crashed at that time delegate method applicationWillTerminate(_:) is not calling. So which delegate method get call when app is crashed
Hello, Developer team! Does anyone have an idea about the problem I'm facing with the simulator ? I'm learning how to code in SwiftUI and my simulator was working just fine but yesterday I close my laptop the other day and open today and see the code :
import SwiftUI
import SwiftData
@main
struct first_projectApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Item.self,
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(sharedModelContainer)
}
}
I don't know where it comes from . I used IOS 17.5 I try to upgrade to IOS 18 but that didn't fix the problem. Currently I'm seeing 3 errors :
Showing Recent Errors Only
Build target first project of project first project with configuration Debug
Ld /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Products/Debug-iphonesimulator/first\ project.app/first\ project.debug.dylib normal (in target 'first project' from project 'first project')
cd /Users/amedekatamatode/Desktop/calculator/first\ project
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-ios17.5-simulator -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk -O0 -L/Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -L/Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Products/Debug-iphonesimulator -F/Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphonesimulator -F/Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Products/Debug-iphonesimulator -filelist /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/first\ project.build/Debug-iphonesimulator/first\ project.build/Objects-normal/arm64/first\ project.LinkFileList -install_name @rpath/first\ project.debug.dylib -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/first\ project.build/Debug-iphonesimulator/first\ project.build/Objects-normal/arm64/first\ project_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -debug_variant -fobjc-link-runtime -fprofile-instr-generate -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/first\ project.build/Debug-iphonesimulator/first\ project.build/Objects-normal/arm64/first_project.swiftmodule -Xlinker -alias -Xlinker _main -Xlinker ___debug_main_executable_dylib_entry_point -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Intermediates.noindex/first\ project.build/Debug-iphonesimulator/first\ project.build/Objects-normal/arm64/first\ project_dependency_info.dat -o /Users/amedekatamatode/Library/Developer/Xcode/DerivedData/first_project-ebsglpjmgwtgzpflkvloohzydjuf/Build/Products/Debug-iphonesimulator/first\ project.app/first\ project.debug.dylib
ld: warning: Could not parse or use implicit file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it
Undefined symbols for architecture arm64:
"_main", referenced from:
___debug_main_executable_dylib_entry_point in command-line-aliases-file
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: _main
Linker command failed with exit code 1 (use -v to see invocation)
I hope someone helps me how to figure it out. Thank you!