nalexn / clean-architecture-swiftui

SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
MIT License
5.56k stars 671 forks source link

Cannot connect to REST API #67

Closed stef-t closed 2 years ago

stef-t commented 2 years ago

Hey,

fist off thanks for this insightful repository and article!

When cloning the repository and trying to run it, the application can not connect to the REST API restcountries.eu. Trying to access it via a browser redirects to countrylayer.com. I'm not sure what happened with the API or if it is something that just temporarily happened to me.

Kind regards

nalexn commented 2 years ago

Hey @stef-t thanks for the heads up!

Sadly restcountries.eu is now shut down and replaced with a paid countrylayer.com. Their free tier is just 100 searches a month, which means it won't be able to serve everyone interested in this sample project.

I'm not sure there are other free REST APIs for countries search, so the simplest solution for right now is to migrate to their new APIs with key-based access and have everyone who hit the limit register a free account and substitute the new access key in the source code. That's a bummer.

stef-t commented 2 years ago

That is really unfortunate to hear!

Another approach might be to load some local json that is already part of the app. I'm not sure if the data, provided by the json I linked, matches the data that the REST API provides though. It might be a nice extension to showcase the flexibility of your clean architecture approach.

okiookio commented 2 years ago

change to restcountries.com/v2 please

nalexn commented 2 years ago

@okiookio thank you for finding this mirror, you made my day! I've pushed the fix