WWDC23 SALE: Save 50% on all my Swift books and bundles! >>

How to connect Python scripts to SwiftUI

Forums > iOS

Hello all,

I'm trying to create my own news reader app, like Pocket or Instapaper, and I have used the Python library, Beautiful Soup, to scrape the data after a URL is provided. How do I embed this functionality into my app?

I found this somewhat related discussion but it's not exactly what I'm seeking.

I know there is SwiftSoup, but I'm trying to learn how to use Python libraries because they offer a lot more functionality and most APIs have Python docs which I plan to use in the future.

Could anyone point me in the right direction?

Thank you!



well, as a first step I would research how to run Python code inside iOS app. This should be possible since there is popular app Pythonista which is Python IDE for iOS. After that is done, you need a way to send data between Python and Swift.

Maybe try this - https://github.com/pvieito/PythonKit?


Thank you! I'm looking into PythonKit.

Would you know/guess how Pocket or Instapaper implement scraping + parsing in their their iOS apps? Instapaper used to have an API, but this has since been deprecated.


I think these are mainly "client" apps meaning all the logic is somewhere on the server where it can be used for iOS, Android and web versions. When you add article to Pocket iOS app it most likely sends the link to the server, servers does the parsing and sends back parsed article.

If you are interested you can check out the app Charles and monitor, how apps on your phone "talk" to the servers


Oh right! Do you mean this is accomplished using a server-side component like those available via AWS EC-2 or Google's app engine?



I don't know, maybe, maybe something custom which is more likely. That being said you can totally do this locally on iOS device, there is no technical limitation.. Especially if you don't plan Android or web version, then server loses these benefits.


Cool cool. After some research, Alamofire, Perfect-CURL, and Vapor will help a lot when with dealing APIs, and server side apps. Thank you, Filip!


Save 50% in my WWDC23 sale.

SAVE 50% To celebrate WWDC23, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.