How should I connect my Python backend with my Swift frontend for a desktop app?

0
15
Asked By CuriousCoder28 On

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

Answered By TechWhiz007 On

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.

Answered By SwiftieDev92 On

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.