Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree but I think the issue here is complexity. This app is built with Swift, probably because most developers prefer high-level languages like that over system-level languages like ObjectiveC. Unfortunately, OS vendors typically don’t provide interfaces for high-level languages in their OS machinery unless strictly necessary. Can you actually write a Preferences panel in Swift? I wouldn’t be surprised if the answer were “nope, Obj-C only”.

It’s not even an Apple thing, Windows has been the same for a very long time - remember how browser extensions “exploded” when Mozilla made it possible to write them in JS? IE forced you to C++, dramatically restricting the number of developers.



I wouldn't characterize Swift as "high-level" and Objective-C as "system-level." One of Swift's stated design goals is to work at all levels of the technology stack, including system programming where you need a lot of control over struct layouts and so on.

I'd agree that most of the focus has been on app development, but I just found this toy kernel written in Swift the other day: http://si.org/projects/project1/

On the Objective-C side, sure you have access to all of the low level stuff of C, but Objective-C's message passing is probably a poor choice for very low-level system programming (in the kernel, for example). Apple uses C and C++ in the xnu kernel.

Swift was also designed to interoperate with C and Objective-C APIs, so you could certainly write a preference pane in it. It even automatically generates Swiftier interfaces for APIs that follow conventions. Here's the NSPreferencePane API: https://developer.apple.com/documentation/preferencepanes/ns...


I don't know much about macOS development, 72 hours ago I had never done any at all! But as far as I can tell anything you could do in Objective C you can also do in Swift. I would have made a preference pane and would prefer it myself but I explained why I didn't in another comment. Apple kind of discourages preference panes unfortunately.


Swift is largely compatible with Objective-C; for your preference pane question the answer will certainly be yes now due to ABI stability and preference panes running out-of-process. I would expect dealing with the Accessibility API to be the more annoying part, and that only because it's a C API working with function pointers, which means you can't use blocks (which is true with Objective-C as well, but generally par for the course when working with interfaces that Apple doesn't care much for).


Can’t you interface natively with objective-c objects from swift? It’s a much smaller ABI to target than the C++ one and most languages I know have some decent bindings.


> Can you actually write a Preferences panel in Swift? I wouldn’t be surprised if the answer were “nope, Obj-C only”.

If that was the case (I don't believe it is), it would only be because modern Apple doesn't care enough about Preference Panes to add easy support. A third party Preference Pane is not any more "OS machinery" that a third party screen saver.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: