Basics for App development (macOS)

Hey everyone,

I have knowledge of Python from data science background and a friend of mine wrote an app based on Python. This app was converted to binaries for windows, which works fine, and also to a macOS binary that runs fine from the command line, but I fail to make it double clickable. I now want to dive a little into app development for macOS to make this a real one click app with all these features like signing and notarizing (I am aware this requires an Apple developer account) and stuff.

What I want to learn is some Xcode basics (GUI and command line) especially for building Python projects for arm64 and x86_64 and notarizing. Building C++ projects for arm64 and x86_64. Maybe some basic understanding of Object-C and Swift (no complete coding stuff, since I want to stick to Python). Is there a good course someone can recommend (doesn’t have to be free) that covers these topics so I don’t have to browse through a lot of online resources (which I will of course still have to do later)?

Thanks everyone :).

Replies

I doubt you are going to find a course that teaches you how to build Mac apps with Python using Xcode.

If you all you want to do is add a GUI to an existing command-line app, take a look at the Process class. This class lets a Mac app run command-line apps as subprocesses. Create a Swift app project and use Process to run the Python app. The Process class used to be named NSTask, which may provide better search results as Process is a generic name.

If you are looking for resources to learn Mac app development, take a look at the following article:

https://www.swiftdevjournal.com/resources-for-learning-mac-development/

Hey, thanks for the reply. No, I don't want to add a GUI. The App already has a tkinter GUI and works (at least on Apple SIlicon). It's completely compiled (by PyInstaller) and I can run it by going to the folder in the terminal an running ./name_of_the binary. However, if I just double-click it (or right-click it and select open) a terminal window will open raising some file or directory not found errors due to this issue. That's the one issue that could by solved by using the AppKit (or better pyobjc).

The other one is, that I would need to notarize a lot of binaries after compiling. If I send complied project to someone via Internet (or even AIrDrop) I get Gatekeeper warnings for the binary itself and most of the compiled Python modules. I stopped allowing them after the around eights warning. If I just transfer via external storage, I can run the app without any of these warnings. So, that's the other isse and I want to get a better understanding on developing macOS apps in general. AFAIU I can only solve this by notarzing every of the binaries that are created by PyInstaller and I am not sure, if PyInstaller can do this by itself. I guess, I would have to do this with Xcode (or it's command-line tools).

You see, these are all quite Apple specific requirements which to my understanding are quite global for macOS app design (and I guess my understanding of these is not 100% correct). So I just want to get a better understanding on the general structure of macOS apps and their distribution. And Xcode in general since it seems like this is a pivotal tool for App development and distribution (see https://haim.dev/posts/2020-08-08-python-macos-app).

A bonus would be to build a C++ project (that I use inside the app) for arm64 and x86_64, which I already did by make and make in an àrch -x86_64 zshenvironment.liposhows the correct architecture, but thex86_64binary does not work for some reason. Also, it would be great to make and combinedarm64/x86_64` binary, which I only found solutions on the Xcode GUI, but not command line tools.

You see, there is a lot of new understanding. wording and knowledge to acquire for me and that's why I would like a nice tutorial to have a good point, where to start :). I'll give your link a look and check how much it's gonna help me with my specific issues. Thanks for that.