NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

How and best way to store data from an external API into my iOS App

Forums > iOS


I am fairly new to iOS programming and want to make my first App for the Apple Store and my portfolio. I could use some tips perhaps :) I thought I could create an App which will list the items currently on sale on an external web shop. I know the people working there and they are based in my area. This shop is offering a limited amount of items for sale (around 10-20) so I could make a collection view. It will be a simple app and a nice addition to their business!

I already made a webscraping script in python (using libraries like Beautiful Soup etc) and got a JSON file out of it. I wanted to host this file on AWS cloud and create an API endpoint to use for my iOS app, so I can use the data from the JSON and import it using Codable. But is this the best way? So far it could be working like this but it is the best solution?

Any tips from you guys? Should I use Core Data or CloudKit instead?

I did not yet do much with Core Data or CloudKit and I am just starting with some tutorials about this. I cannot see clearly yet if I should use them for my small project or not. How would an experienced iOS programmer approach this ? Should I use Core Data or it is overkill? Did not use it yet Using iCloud I get free storage but I cannot use python right? Should I do the webscraper in Swift? It would be nice to store an archive of past items too so the database could get larger.. 🤔



the best solution would be if the shop could give you an API with items on sale.

I think the custom scrapper with Python is fine but there is always a risk that the shop will modify something and depending on how robust your solution is it could stop working. Maybe check something like this

I would definitely use Core Data to store those downloaded items, unless you plan storing large images, you will be fine with the database size and you can always implement some sort of maintenance tasks to maybe delete 6 month old items on sale.. Or maybe remove their images.


Thanks for the reply! It is encouraging to know I am in the right direction!

All tutorials I have seen with codable are using existing API but I want to create mine! ;)

I know, if the shop had their API it would be better. Maybe it could be a solution in the future. I will do it with scraping for now. And I will check Apify too. (They have a free tier which is good)

I am just starting doing a couple of tutorials on core data right now...


Yeah I totally get wanting to create your own api :-)

Also another kind of hacky solution would be to load the deals page in webview (without showing the webview to the user) and use JavaScript to query the data because it is especially made for it and then send data to your app, save it and display in native view.


Oh yes, this sounds very hacky ;) It would be similar to use SwiftSoup directly in the App to get the data.

The problem is that if the website structure changes I will need to push an update to the App Store to fix it. And this is super risky.

Instead having my API on a server somewhere I just need to update my API and I think I can sleep better that way


Yeah that is a good point


One last thing. I have a bit of free time nowadays so if you want additional help or just "consult" approach for this feel free to ask here or find me on HWS slack and write a DM :-)


This is super cool! Thank you very much!


Hacking with Swift is sponsored by RevenueCat

SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.

Try it for free

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

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.