Post

Replies

Boosts

Views

Activity

Reply to CGMouseMove doesn't trigger menu bar
So you're saying that when a full screen app is frontmost, if you move the mouse cursor to the top of the screen directly, the menu bar appears, but if you place the cursor programmatically using CGDisplayMoveCursorToPoint the menu bar does not appear? Are you also saying that the commented-out code which inserts a mouse-moved event doesn't work? If it doesn't, in what way does it not work - does it not move the cursor, or it does move the cursor but the menu bar doesn't appear as expected?
Jan ’24
Reply to CameraExtension and Uninstaller
your camera extension will be removed from the system when the user deletes the app from /Applications. They'll see a warning when they do so, it says something like "this app includes an extension which will be deleted if you delete this app, are you sure?". So if your app only contains a camera extension, you don't really need an uninstaller - everything goes away when the user deletes the app. Your installer can't deactivate the extension because the uninstaller's bundle ID is "com.my.app.unisntaller" and the extension you are trying to activate has a bundle ID which is not prefixed by "com.my.app.unisntaller". Two things here: did you intentionally mis-spell "uninstaller" in your bundle ID? If you have an uninstaller, it should just delete the app hosting the extension, and the OS will take care of unloading the extension
Jan ’24
Reply to SwiftUI popover not updating binding
where are you using the TestPicker (aside from in its Preview)? it works for me when used in the ContentView below. I built this for iOS and ran it in a iPhone 15 simulator. To dismiss the picker, swipe down on the horizontal grey bar near the top of the screen. struct ContentView: View { @State private var selection = 1 var body: some View { VStack { TestPicker(selection: $selection) } .padding() } } #Preview { ContentView() } Lots of SwiftUI examples on Paul Hudson't site, for example https://www.hackingwithswift.com/quick-start/swiftui
Jan ’24
Reply to iPadOS, IOKit and Sandbox/MACF
On macOS, libUSB uses the methods in IOKit/usb/IOUSBLib.h. These are unavailable on iPadOS. DriverKit is available on iPadOS on devices with M1 or later processors. DriverKit doesn't have the same APIs as IOUSBLib, you would use it to make a Driver Extension (dext) which provides the functions you require. You can read the device ID and the vendor ID without direct access to the device itself, by querying the IORegistry. In principle, you could communicate with a device using the user-space property accessors like IORegistryEntrySetCFPropert(y/ies) and IORegisteryEntryCreateCFPropert(y/ies), but in practice most drivers don't support the property setters, so you would have to write a driver extension which does. And if you go that far, you may as well support direct communication with the driver by implementing a user client and calling IOConnectCallMethod or its derivatives like IOConnectCallStructMethod. I don't think you need special entitlements to read the IORegistry, but you do need them to communicate with drivers, and you driver needs specific entitlements which are tied to one or more specific USB vendor IDs. Reportedly, you can develop a driver without the entitlements, but I could never get that to work and have since been granted the entitlements so I never revisited the topic. See https://developer.apple.com/documentation/driverkit
Jan ’24
Reply to Is there any way to tell if a file is on SSD volume?
I don't know of any API to get this kind of information directly. You might be better off using performance measurements to change your strategy on-the-fly. What differs between SSD and rotating rust that influences your strategy? You can query a volume to find out its BSD name, using statfs. The f_mntfromname field contains the BSD name, (e.g. /dev/disk1s2). You can search the IORegistry to find nodes with BSD names matching e.g. "disk1s2". Then look up the IORegistry to see if the controller is an NVMe controller or something else. The methods for iterating through the IORegistry are in IOKitLib.h, there's a tool called IORegistryExplorer which lets you inspect the registry.
Dec ’23
Reply to Simple barcode reader. Please help
The Vision framework can detect various types of barcodes (start here: https://developer.apple.com/documentation/vision/vndetectbarcodesrequest) If you need to create bar codes to work with, you can use a built-in CoreImage filter to generate a bar code. See https://developer.apple.com/documentation/coreimage/cibarcodedescriptor. The links above should give you a starting point, and some keywords to search with.
Dec ’23
Reply to Why would you use @State at the application level, or anywhere outside SwiftUI?
The answers you are looking for are linked from the documentation you provided a link to, here: https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro?language=objc The Observable macro is new and most of the Internet hasn't caught up yet. If you can use Observable, you can use @State instead of @StateObject, even for classes and structs. The library lives outside the App struct. Lexically, it appears to be inside the struct, but SwiftUI manages its lifetime because of that @State macro. You can put a breakpoint inside Library's init to see when it called.
Dec ’23
Reply to What are command line tools?
use your favorite search engine to look for "what is in mac command line tools", and you might find this link, for example, which will tell you more https://mac.install.guide/commandlinetools/index.html You ask is it safe to install the tools - yes. Is it safe to use the tools - well, it depends on what you do with them. Why are they so large - they do a lot more than set the visibility attribute of files. The SetFile tool itself is 168KB. hope this helps, good luck
Dec ’23
Reply to SwiftUI - Infinite Loop - onDisappear without "."
with the dot, you're calling a function called onDisappear on the result of the function .onAppear. without the dot, you're calling a function called onDisappear on the view enclosing the one you are applying modifiers to. The latter is probably never what you want to do, but the compiler doesn't know that. All it knows is that the code compiles. I think that the Swift compiler should take a look at what you write, and question the intent (even if the code compiles). There are rumors that Apple is doing big things with AI, maybe improved code review in Xcode could be one of those things? You can use Feedback Assistant to request such improvements.
Dec ’23
Reply to What does this error mean when using .searchable()
In a template app running on a simulated iPhone 15, I don't see the error you describe. There must be more to your code than what you show in your example Content(), or it only shows up on a real device, or it only occurs on something other than iOS? I'm using Xcode 15.1 on macOS 14.1.2, simulating iOS 17.2 Did you try setting the CG_NUMERICS_SHOW_BACKTRACE environment variable, and if so, did it give you any further insight?
Dec ’23