I'm developing a desktop application where I'm using Python for the backend and Swift for the frontend. I have specific ideas about the backend logic, using a calculator app as a simple example. As I code my backend in arithmetic.py, I'm unsure how to structure it to properly interact with the Swift frontend. Should I make adjustments to arithmetic.py for this purpose, or can I develop it normally for command-line execution and then call the functions from Swift later?
2 Answers
You might not need to plan everything out in detail upfront, but it's a good idea to think about how your Python functions will communicate with Swift. Typically, you would use HTTP requests for this. Instead of calling arithmetic.py directly, consider creating a controller that manages these requests, which can then call the functions in your backend. Starting on your backend now is a great way to get familiar with how it all works, and Python offers plenty of options for this.
Just to clarify, even if your app doesn't directly connect to your own server, HTTP requests can still work for local apps. Your app can use a local server that communicates with Swift, so you don’t have to worry about being online to make this integration work.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically