Post

Replies

Boosts

Views

Activity

Reply to Xcode Arguments Passed On Launch won't load
I see what you're seeing, but I don't agree with your expectation. BUILT_PRODUCTS_DIR and EXECUTABLE_NAME are not environment variables, they are Xcode build settings. The environment Xcode launches your tool into is empty, aside from the variables you set in the Environment Variables section of the Scheme settings. In my Terminal, I can echo $HOMEBREW_PREFIX and the result is /opt/homebrew. However, the result of getenv("HOMEBREW_PREFIX") in my program is null, if I run it from Xcode, but it is /opt/homebrew if I run it from an interactive shell, because that shell runs its programs in a non-empty environment. If you just want to debug your application, using the environment it would have if run at the command line in a shell on your machine, you can go the Scheme's Info tab, and select "wait for the executable to be launched". Then launch it from a Terminal window - it will get whatever environment your shell gives it.
Oct ’24
Reply to iPadOS, IOKit and Sandbox/MACF
nine months too late, but here we are. For dext loading, the OS uses the IOKitPersonalities dictionary, which is in your driver's plist. The entitlement is separate. For development, Xcode will make a special entitlement with idVendor="*", so you can play around with any device you like. I don't think I've ever managed to use "sign to run locally" for a dext. Instead, I use development signing with our team ID.
Oct ’24
Reply to Accessing Events from Video Device
The Apple driver has the UVC interface open all the time when the device is streaming, but not the device interface. You can send device commands or receive status over pipe 0. You would have to poll to get the button press. What platform is this on - macOS, or iPadOS? On macOS, if your button exposes a HID interface, you can use HID manager routines to get notifications of reports on the interrupt pipe. The system will attach its own driver to a keyboard or mouse, but it will leave a vendor-specific HID device alone, so your code can talk to it.
Oct ’24
Reply to Can i use c++ in swift app project
Did you enable "C++ and Objective-C Interoperability" in the build settings (under Swift Compiler - Language)? What kind of interface does your library export? If it is C only, you won't need to do this. But if it exports any C++ symbols, or if its exposed headers include any C++ headers or data types, you're going to have to turn that interoperability on.
Oct ’24
Reply to Help Needed: Linker Warnings and Duplicate Symbols Issue in Xcode 16.0
did you look at the detailed build log to see what the duplicate symbol is, and where it is defined? If you compare the detailed build log with the log from Xcode 15.3, this might guide you to a solution. To access the detailed build log, click on the little hamburger icon on the right of the screenshot you posted. If you think this is a regression in Xcode 16, submit a bug report using Feedback Assistant - bugs reported here aren't tracked, and there isn't enough information in your post for anyone to help you.
Sep ’24
Reply to DriverKit target built as dependency, header not found
I fixed this. The problem was a header file called Driver_public_shared.h, which was included in my Driver.cpp file. It lives on disk beside Driver.cpp. By default, header files have Project membership, so they are not copied into the resulting output bundle. If I give Driver_public_shared.h either Public or Private memberships of the dext target, it appears in the dext in the Headers or PrivateHeaders directory, and I can compile the delivery app, with the driver as a dependency. Interestingly, the header appears in the build folder in the dext in Products/Debug/Debug-driverkit. But the dext which is embedded in the delivery app has no Headers directory. That's fine by me, I didn't want to deliver any headers as part of the driver, but I don't understand why there had to be a Headers folder in some circumstances and not others, nor do I understand why it is removed when embedding the dext.
Sep ’24
Reply to Can't downgrade MacBook with external ssd
I'm not sure why it isn't working for you, but I'll tell you how I manage booting various OS versions from an external disk. Shut down the computer, boot into Recovery. by holding down the power button until Options appears. Enable booting from external volumes, in Startup Security. Reboot. Connect your external disk, in Disk Utility, select the entire disk (ESD310S...) and partition it. Select APFS as the partition type. After that is done, you'll have one volume called Untitled. Rename the Untitled volume to "OS Installers". Select the Container disk above the Untitled volume and choose to add a volume to it. Make the new volume APFS, call it "Sonoma". Then, softwareupdate --list-full-installers, to get the correct name for the installer. softwareupdate --fetch-full-installer --full-installer-version 14.6.1, for example. This will download an installer called "Install macOS Sonoma" to your /Applications folder. Drag the installer from /Applications to the "OS Installers" volume (I like to keep them around). Double-click Install macOS Sonoma, wait a while until it is verified. Once it is ready, you should be able to go through the steps to install Sonoma onto your external disk (volume), called Sonoma, and boot from it.
Sep ’24
Reply to Child view does at first display when row selected in parent view
I tried your code and found the same thing. These posts talk about some similar issues. https://forums.developer.apple.com/forums/thread/661777 https://forums.developer.apple.com/forums/thread/659660 this one has a solution that worked https://forums.developer.apple.com/forums/thread/714912?answerId=728415022#728415022 here's your code, working (based on the solution in the last link above), but it doesn't look like your original implementation: @Environment(\.dismiss) var dismiss var mealName: String var body: some View { VStack { Text(mealName) Button("OK") { dismiss() } } .padding() } } struct ContentView: View { @State var meals: [Meal] = [ Meal(name: "filet steak"), Meal(name: "pepperoni pizza"), Meal(name: "pancakes"), Meal(name: "full breakfast") ] @State private var selectedMeal: Meal? var body: some View { NavigationStack { List { ForEach(meals) { meal in HStack { Button { selectedMeal = meal } label: { Text(meal.name) .font(.headline) } } } } .sheet(item: $selectedMeal) { item in SheetView(mealName: item.name) } } } } class Meal: Identifiable { var id: UUID = UUID() var name: String = "" init() {} init(id: UUID = UUID(), name: String) { self.id = id self.name = name } } that is, it has buttons not just simply lines of text. here's code that works around the issue another way, by passing a binding to the sheet and using a small delay before changing isShowingMealForm. @Environment(\.dismiss) var dismiss @Binding var mealName: String var body: some View { VStack { Text(mealName) Button("OK") { dismiss() } } .padding() } } struct ContentView: View { @State var meals: [Meal] = [ Meal(name: "filet steak"), Meal(name: "pepperoni pizza"), Meal(name: "pancakes"), Meal(name: "full breakfast") ] @State private var isShowingMealForm = false @State private var selectedMeal: Meal? @State private var mealName: String = "no meal selected" var body: some View { NavigationStack { List { ForEach(meals) { meal in HStack { Text(meal.name) .font(.headline) } .onTapGesture { if self.isShowingMealForm { self.isShowingMealForm = false DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { self.selectedMeal = meal self.mealName = meal.name self.isShowingMealForm = true } } else { self.selectedMeal = meal self.mealName = meal.name self.isShowingMealForm = true } } } } } .sheet(isPresented: $isShowingMealForm) { SheetView(mealName: $mealName) } } } class Meal: Identifiable { var id: UUID = UUID() var name: String = "" init() {} init(id: UUID = UUID(), name: String) { self.id = id self.name = name } } This works too, but I am a loss to clearly explain why. I put a breakpoint in your original onTapGesture closure, and I can clearly see self.selectedMeal obstinately staying at nil even after the line self.selectedMeal = meal. It only works as expected after you click on another meal line. I'm not at all comfortable with arbitrary delays in code, and the version with .sheet(item) has fewer lines of code than the one with .sheet( isPresented: ), so I'd go with that. I'd love it if someone who understands this stuff could chime in and tell us why the observed behavior differs from the expected though.
Aug ’24