nalexn / clean-architecture-swiftui

SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot connect to REST API

stef-t opened this issue · comments

commented

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

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.

commented

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.

change to restcountries.com/v2 please

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