Swift may be the solution, but it's built on a weak foundation. It makes cross-platform development almost impossible. The TIOBE index shows Swift declining (and Objective-C increasing). So, maybe it isn't.
I don't yet have a lot of experience with Swift, but I would already argue that Swift is not the solution. Swift is cool and has some really neat features that make for good presentations and blog posts (where the real-world issues and constraints associated with interfacing to other systems, particularly older ones that do not use HTTP, can be minimized or eliminated entirely); however, to use it to do anything other than building a desktop or IOS GUI application seems to result in code with messy syntax and what seem to me to be hacks in order to bridge between NS* and CG* code. (Lots of casts and strange machinations for massaging pointers.) I'm in the process of converting an application written in C++ using an older version of Qt because the Qt code relies on Carbon (which has been removed from Catalina). The new code is in Swift. I've written and maintained code that uses UNIX-style C sockets for many years, but finding a native approach for plain sockets in Swift was very difficult. There appears to be good support for async HTTP communication, but not much for socket-based TCP. I found some examples on the web that were built around Grand Dispatch, but that feels clunky in a command-line application. Further, the many versions of Swift complicate the examples; if the example code was written in Swift 2 or Swift 3, it may require non-trivial modification to work in Swift 5 without compiler errors and warnings. I've settled on using a library from IBM called BlueSocket with a thin wrapper around it, and that seems to be working for me for now. However, even using the command line tools (swift package) for creating and managing an XCode project with external library dependencies has been for me a challenge. XCode and the packaging framework seem to be fighting over control of the project's structure, and going back and forth between them (and regenerating the XCode project each time) is tedious. But then maybe I'm just not using the tools corre ctly. Also, as you've said Swift makes cross-platform development nearly impossible because, even though Swift itself is available on other platforms, the pre-built components that prevent the developer from having to reinvent every wheel from scratch are not. This app I am rewriting _was_ cross-platform when it was built with Qt, but it will no longer be when we rework it for Swift. (And we are motivated to use Apple's "approved" language and tools in order to be eligible for developer support in the event that we need it. Our experience has been that they will not help, even with an Apple Developer subscription, if the app is in pure C/C++ or Java or anything but Swift or Objective-C.) It could simply be that Swift is the wrong tool for my current task. However, I'm not sure what would be. This could be done in Java or Python or Javascript with Node or any number of other mature, cross-platform options, but those aren't really welcome as first-class citizens in the Mac app space (or at least result in solutions that potentially require a lot of manual intervention on the part of the user). It could also be done in pure C, but that seems like a step backwards. I'm not down on Swift; as I said, I think it has some really neat features and constructs, and I'm sure that making a desktop or IOS GUI application is its sweet spot. I just wish there was a solid option for those applications (or application components) that are outside that sweet spot. Rob Walsh _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com