I am planning to build a GUI application for Mac and Windows. I've been doing some research in the technology choices, as in the language, libraries, and build tools, so that I can share as much code as possible between the two platforms.
The main requirements are:
The length of my post has gotten out of control, so I moved my questions to the top as a summary, while the context is further below.
For Mac, I ruled out using cross-platform GUI libraries (like QT) since it doesn't seem like they are able to provide a native look and feel on Mac (look out of place and/or difficult to write apps that follow Apple's Human Interface Guidelines). wxWidgets says it uses native libraries, but this post mentions that wxPython may use private Objective-C calls and is unlikely to be approved for the Mac App Store. Finally, even if the look is right, layouts would probably still need to vary for the two platforms.
Therefore I plan to use native Cocoa GUI libraries for the Mac interface, though still considering using wxWidgets for the Windows GUI.
It seems my best choices for language for the main application logic be either C++ or Python. Obviously it's much easier to write cross-platform code with Python than C++, but there are always tradeoffs.
Python
Pros: Much quicker to write and easier maintain. Robust cross-platform libraries that can shorten development time drastically.
Cons: Using Python means using PyObjC, which hasn't been updated in over a year (as seen from svn), and it's unclear to me whether it will still work with future versions of Xcode and OSX. Also, to set up any sane build configuration with PyObjc and py2app and use xibs for GUI, outside of Xcode, is a nightmare.
C++
Pros: Easier to set up the build configuration and dependencies on both Mac and Windows. Runs much faster than Python, though performance isn't a large concern in my case.
Cons: I don't know C++. I'm pretty good with C, but it doesn't look like that will help me much at writing good C++. I have a general impression that it's much harder to write cross-platform C++, but I might be wrong. There are lots of posts about obscure bugs. Boost looks promising though.
Setting things up if using C++ as the main language seems simple enough on both platforms. If I use Python, it also seems simple to set up on Windows since I would use wxWidgets for the GUI and py2exe to deploy.
As for Mac and Python, the standard choice seems to be pyobjc and py2app. Unfortunately, I haven't been find any examples of a build configuration with py2app that uses XIBs and Cocoa libraries rather than QT or wxWidgets. I don't want Xcode to manage the build since I would prefer the Python files and application resources be placed outside of the Xcode project directory. This would greatly simplify the setup for Windows and make the file tree cleaner.
Edit regarding QT: I took another look at QT, spending a couple of hours playing with QT designer. The basic UI elements (button, textfield, label) look the same as Cocoa elements. I put together a QWindow and a QTabView with some elements easily, and it looks like a Cocoa app. However, there were a few negatives:
I know I'm being picky but need to be picky to make a good UI. Overall QT seems to be a good solution for Windows, but I think I will stick to Cocoa for Mac. I did some additional research into existing programs and found that VLC, Chrome, and Transmission all make native GUIs for Mac, while VLC uses QT for Windows, Chrome uses a custom framework, and Transmission uses GTK+ and QT for Linux.
I think I've decided on using Cocoa GUI for Mac and Qt or wxWidgets for Windows, but still split between C++ and Python for the shared logic.
In order to create Windows apps, you will need to install Windows 10 and Visual Studio on your Mac. However, installing them directly on the hardware is not something I'd recommend. It's better to use a desktop virtualization program because it makes switching between macOS and Windows as simple as a swipe right.
First, grab the URL of the website you want to turn into a Mac app and paste it into Fluid. Next, type in a name for your new desktop app. If you want to throw in a custom icon for the app, you can add that too (by default, Fluid uses the source website's favicon). Now hit the Create button to set up the app.
Run Windows on your Mac and use Visual Studio That's okay — you can use your Mac! With popular third-party solutions like Apple Boot Camp, Oracle VirtualBox, VMware Fusion, and Parallels Desktop, you can install Windows 10 and Microsoft Visual Studio on your Apple computer.
Click File > New, then select Dialog System Screenset on the New dialog box, and click OK. Click Yes on the message asking if you want to create a project. Select Windows GUI Project. Enter Welcome as the name of the project.
I think you might be ruling out Qt too quickly. This guy has reported that he publishd a Qt-based app on the Mac App Store.
According to this related answer, you can specify the Qt build target to use Cocoa instead of the deprecated Carbon API.
This Qt bug where some plist file would be written a location not approved by Apple has been resolved in version 4.8.
This Qt article discusses special features introduced to support Mac's native look and feel.
With regards to C++, there are generally no cross-platform issues if you use libraries such as Qt or Boost to abstract out the platform-dependent bits (Boost.Asio, Boost.Filesystem, and Boost.Thread come to mind, Qt has similar abstractions for networking, files, and threading).
C++ is definitely an "expert friendly" language. If it's possible to use Python and PySide bindings for Qt, while still being able to publish to the App Store, then I'm guessing that might be your best bet.
If you end up using C++, then I strongly suggest that you learn to use all the facilities at your disposal which will minimize manual memory management and raw pointers. Learn about container classes, string class, and smart (reference-counting) pointers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With