Post

Replies

Boosts

Views

Activity

Xcode can't find prepareCustomLanguageModel
I have Xcode 16 and am setting everything to a minimum target deployment to 17.5, and am using import Speech Never the less, Xcode doesn't can't find it. At ChatGPT's urging I tried going back to Xcode 15.3, but that won't work with Sequoia Am I misunderstanding something? Here's how I am trying to use it: if templateItems.isEmpty { templateItems = dbControl?.getAllItems(templateName: templateName) ?? [] items = templateItems.compactMap { $0.itemName?.components(separatedBy: " ") }.flatMap { $0 } let phrases = extractContextualWords(from: templateItems) Task { do { // 1. Get your items and extract words templateItems = dbControl?.getAllItems(templateName: templateName) ?? [] let phrases = extractContextualWords(from: templateItems) // 2. Build the custom model and export it let modelURL = try await buildCustomLanguageModel(from: phrases) // 3. Prepare the model (STATIC method) try await SFSpeechRecognizer.prepareCustomLanguageModel(at: modelURL) // ✅ Ready to use in recognition request print("✅ Model prepared at: \(modelURL)") // Save modelURL to use in Step 5 (speech recognition) // e.g., self.savedModelURL = modelURL } catch { print("❌ Error preparing model: \(error)") } } }
1
0
92
Jul ’25
Is there anywhere to get precompiled WhisperKit models for Swift?
If try to dynamically load WhipserKit's models, as in below, the download never occurs. No error or anything. And at the same time I can still get to the huggingface.co hosting site without any headaches, so it's not a blocking issue. let config = WhisperKitConfig( model: "openai_whisper-large-v3", modelRepo: "argmaxinc/whisperkit-coreml" ) So I have to default to the tiny model as seen below. I have tried so many ways, using ChatGPT and others, to build the models on my Mac, but too many failures, because I have never dealt with builds like that before. Are there any hosting sites that have the models (small, medium, large) already built where I can download them and just bundle them into my project? Wasted quite a large amount of time trying to get this done. import Foundation import WhisperKit @MainActor class WhisperLoader: ObservableObject { var pipe: WhisperKit? init() { Task { await self.initializeWhisper() } } private func initializeWhisper() async { do { Logging.shared.logLevel = .debug Logging.shared.loggingCallback = { message in print("[WhisperKit] \(message)") } let pipe = try await WhisperKit() // defaults to "tiny" self.pipe = pipe print("initialized. Model state: \(pipe.modelState)") guard let audioURL = Bundle.main.url(forResource: "44pf", withExtension: "wav") else { fatalError("not in bundle") } let result = try await pipe.transcribe(audioPath: audioURL.path) print("result: \(result)") } catch { print("Error: \(error)") } } }
0
0
68
Jun ’25
Is there a global Alert View in SwiftUI?
I am writing a SwiftUI based app, and errors can occur anywhere. I've got a function that logs the error. But it would be nice to be able to call an Alert Msg, no matter where I am, then gracefully exits the app. Sure I can right the alert into every view, but that seems ridiculously unnecessary. Am I missing something?
2
0
92
Apr ’25
Latest version of Xcode has weird Preview issues
So I believe my machine JUST updated to Xcode 16.3 (16E140). But it definitely just installed the latest iOS simulator 18.4. However, now my preview will sometimes give me the error Failed to launch app ”Picker.app” in reasonable time. If I add a space in my code, or hit refresh on the Preview, then it will run on the second or third attempt. Sometimes in between the refreshes, the preview will crash, and then it will work again. Anyone else experiencing this? Any ideas? Thanks
1
1
132
Apr ’25
Any solution yet to not being able to turn off debugging via WiFI?
Debugger on Xcode 16.x is super slow and it turns out it's only this way when Xcode is connected to my iPhone via WiFi. If I disable WiFI on my iPhone everything is just fine. But that's not a solution. An engineer posted this supposed solution, https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes. Forgive me but that's not a solution, especially since we used to be able to shut off "Connect via WiFI." I've seen so many posts here and everywhere else with no one stating any clear answer. Does anyone know why has this been removed? And is anyone aware of it? I've posted in the Feedback Asst. as many others have. What gives?
0
1
206
Jan ’25
Xcode debugger seems slow
It just feels as if my debugger is running super slow when I step over each line. Each line is doing string comparison, splitting text into words, really nothing fancy. It appears that every time I hit F6, the Variables View (local variables) takes 4 seconds or more to refresh. But I don't know if that's the cause, or a symptom. Just curious if anyone can shed any light on this. Specs MacBook Pro 2019 2.6 GHz 6-Core Intel Core i7 16 GB 2667 MHz DDR4 Sequoia Version 15.1.1 (24B91) iPhone running app is 13 pro 18.1.1 Xcode Version 16.2 (16C5032a)
1
1
321
Jan ’25
Why doesn't Xcode's "Download Container" not always work?
Been using Xcode's Download Container for a short time, and at first there were no issues. But lately, it doesn't always download all the files from my iPhone to the Mac. Sometimes cleaning the build folder works, other times not. As well, the same happens whether I am connected to my iPhone via cable, or wifi. Has anyone else had this issue?
6
0
383
Nov ’24
Strange error in com.apple.speech.localspeechrecognition that doesn't affect output?
While running Swift's SpeechRecognition capabilities I get the error below. However, the app successfully transcribes the audio file. So am not sure how worried I have to be, as well, would like to know that if when that error occurred, did that mean that the app went to the internet to transcribe that file? Yes, requiresOnDeviceRecognition is set to false. Would like to know what that error meant, and how much I need to worry about it? Received an error while accessing com.apple.speech.localspeechrecognition service: Error Domain=kAFAssistantErrorDomain Code=1101 "(null)"
0
0
749
Oct ’24
Need help understanding a piece of logic in a piece of code involving ".background"
Am new enough to SwiftUI that I that are still some concepts that confuse me. Case in point: .background The code below is meant to detect when the user drags their finger over different areas, in this case three different size circles placed over each other. The code works, but I get lost trying to figure out how the logic works. .background calls a function that's a view builder, yet doesn't an actual view? Unless Color.clear is the view it's returning? I have more questions, but might as well start with .background since it comes first? I think? Thanks import SwiftUI struct ContentView: View { @State private var dragLocation = CGPoint.zero @State private var dragInfo = " " @State private var secondText = "..." private func dragDetector(for name: String) -> some View { GeometryReader { proxy in let frame = proxy.frame(in: .global) let isDragLocationInsideFrame = frame.contains(dragLocation) let isDragLocationInsideCircle = isDragLocationInsideFrame && Circle().path(in: frame).contains(dragLocation) Color.clear .onChange(of: isDragLocationInsideCircle) { oldVal, newVal in if dragLocation != .zero { dragInfo = "\(newVal ? "entering" : "leaving") \(name)..." } } } } var body: some View { ZStack { Color(white: 0.2) VStack(spacing: 50) { Text(dragInfo) .padding(.top, 60) .foregroundStyle(.white) Text(secondText) .foregroundStyle(.white) Spacer() ZStack { Circle() .fill(.red) .frame(width: 200, height: 200) .background { dragDetector(for: "red") } Circle() .fill(.white) .frame(width: 120, height: 120) .background { dragDetector(for: "white") } Circle() .fill(.blue) .frame(width: 50, height: 50) .background { dragDetector(for: "blue") } } .padding(.bottom, 30) } } .ignoresSafeArea() .gesture( DragGesture(coordinateSpace: .global) .onChanged { val in dragLocation = val.location secondText = "\(Int(dragLocation.x)) ... \(Int(dragLocation.y))" } .onEnded { val in dragLocation = .zero dragInfo = " " } ) } } #Preview { ContentView() }
1
0
519
Aug ’24
Is there a simple way to adding files to iPhone simulator, for use with Xcode?
Correct me if I'm wrong, but with the latest version of Xcode (15.x) you can no longer add files to the iPhone simulator by dragging them into the the Files app. I also tried to share the files from my Mac desktop to the simulator. But after selecting the simulator, absolutely nothing happened. So I had to do it the long way: Add a folder to the simulator with a unique name, in the Files app Get the document path, print(URL.documentsDirectory.path()) Back track into the folder structure till I find that folder cp the files to that folder Please tell me that there is a way that I haven't found on Google, or that I somehow was doing what the Apple dox suggested, but missed a step.
3
3
2.8k
Jun ’24
How can I enable HTTP exceptions in Xcode 15?
Before Xcode 15, when I could access the info.plist file, I was able to add exceptions to the App Transport Security Settings so I could connect with my home server, which has no HTTPS, just HTTP. But in Xcode 15 I have no idea, not can I buy a clue with google, on how to do this. Please help! Thanks p.s. I should probably add that one site mentioned going to the Target section of your project allows easy access to info.plist. Yet for some strange reason, there is no item in Targets, which is odd, as I can debug my. project.
0
0
759
Jun ’24
How can I enable HTTP exceptions in Xcode 15?
Before Xcode 15, when I could access the info.plist file, I was able to add exceptions to the App Transport Security Settings so I could connect with my home server, which has no HTTPS, just HTTP. But in Xcode 15 I have no idea, not can I buy a clue with google, on how to do this. Please help! Thanks p.s. I should probably add that one site mentioned going to the Target section of your project allows easy access to info.plist. Yet for some strange reason, there is no item in Targets, which is odd, as I can debug my. project.
1
0
375
May ’24