Post

Replies

Boosts

Views

Activity

USB driver for MIDI keyboard
Greetings. I'm trying to build an Apple Silicon driver for a Roland keyboard which is no longer supported by the manufacturer. The most recent official driver is from 2010. From my limited understanding of the Apple documentation, it seems to be telling me that I need to build a codeless dext which overrides some sort of base class. The keyboard uses bog standard USB 1.0 to communicate with the host. Total newb in the driver area so if anyone could point me in the right direction on where to start I would be totally grateful.
0
0
542
Mar ’24
SwiftData: Accessing a context outside of a view not possible.
Getting a warning from the Xcode compiler about accessing a context outside of a view. It popped up in white text on a purple background, not the usual white on yellow warning color. The actual warning text is: Accessing Environment's value outside of being installed on a View. This will always read the default value and will not update. This seems to mean that any datastore access must be done within a view, and isn't possible from the model or some sort of DataManager class. Am I reading this correctly? I'm trying to keep the business logic out of the views. I can do it with everything except the datastore code because of this context issue. Doesn't seem to make sense. Suggestions greatly appreciated.
4
2
3.3k
Sep ’23
Failing to insert @Model class into managed object context
Greetings. I'm trying to insert objects into the managed context but I'm getting a runtime error "Thread 1: Cannot insert 'MyClass' in this managed object context because it is not found in the associated managed object model.". The code to set things up is pretty much straight from Apple - var sharedModelContainer: ModelContainer = { let schema = Schema([ MyClass.self, MyOtherClass.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() The context is being accessed through the environment like so - public final class MyAppLogic { @Environment(\.modelContext) private var context ... ... myClasses.forEach { myClass in context.insert(myClass) } Any suggestions greatly appreciated.
4
2
1.6k
Sep ’23