Sample app: Wiki-Countries

by Marcelo Sarquis
July 10, 2019

Hi there. On this post, I have created a sample iOS app where a user wants to see which country he/she is currently in from the app and in the today widget. Additionally he/she should be able to search for a country using free text, capital city or language code sorted closest/furthest to the user’s current location. Here are the detailed task instructions:


Technical Details

API specification for search: ​ For flag image Flagpedia can be used in this format:{{country​ code}}.png e.g. for Germany: ​

Acceptance Criteria

  • As the user opens the app a list of countries should be shown from closest to furthest depending on my current location;
  • The user should be able to search for a country by: name | capital city | language;
  • The user should get the result in a list, which shows me the name of the country, picture of the flag (if present), population and area size;
  • The user should have access to the current country information from anywhere in the app;
  • The user should be able to see the current country information in the today widget;
  • Current country information I need to see: Name & Flag & Population & Capital & Region & Regional blocks & Language & Currency.

Rest Countries

Get information about countries via a RESTful API:

"name": "Germany",
"topLevelDomain": [
"alpha2Code": "DE",
"alpha3Code": "DEU",
"callingCodes": [
"capital": "Berlin",
"altSpellings": [
"Federal Republic of Germany",
"Bundesrepublik Deutschland"
"region": "Europe",
"subregion": "Western Europe",
"population": 81770900,
"latlng": [
"demonym": "German",
"area": 357114,
"gini": 28.3,
"timezones": [
"borders": [
"nativeName": "Deutschland",
"numericCode": "276",
"currencies": [
"code": "EUR",
"name": "Euro",
"symbol": "€"
"languages": [
"iso639_1": "de",
"iso639_2": "deu",
"name": "German",
"nativeName": "Deutsch"
"translations": {
"de": "Deutschland",
"es": "Alemania",
"fr": "Allemagne",
"ja": "ドイツ",
"it": "Germania",
"br": "Alemanha",
"pt": "Alemanha",
"nl": "Duitsland",
"hr": "Njemačka",
"fa": "آلمان"
"flag": "",
"regionalBlocs": [
"acronym": "EU",
"name": "European Union",
"otherAcronyms": [],
"otherNames": []
"cioc": "GER"


The application is developed using MVC (model-view-controller) architecture. The app has basically one main Controller: MainTableViewController.swift.

The country search results is the SearchResultsTableViewController.swift and both are subclass of BaseTableViewController.swift. When the user opens the app, a list of countries is shown from closest to furthest, depending on the current location of that user.

If the user has not enabled location services, the list is sorted by country name (a>z). Using the UISearchController, the user can search for a country by typing/pasting the country name or capital or the language code.

The result is then shown a list, showing the name of the country, the picture of the flag when present, population and area size. When the location services is enabled, the user has the current country information from anywhere in the app.

The same information is shown in the today widget: Name, Flag, Population, Capital, Region, Regional blocks, Language, Currency

I have developed the apps using Storyboard.

Tools in place

  • MVC (Model-View-Controller) architecture
  • Storyboard implementation
  • Delegate (one-to-one relationship)
  • Notifications (one-to-many relationship)
  • HTTPS GET requests to the server
  • API handler
  • Custom classes and objects
  • Layout constraint
  • Gesture recognizer
  • Completion blocks

Points to pay attention to

  • Increment Bundle Version (Build Phases -> Run script)
  • Localizable string to multiple languages
  • Extension helpers


Source Code

You can download the source code of that project here:

If you would have any idea of an app and don’t know how to start, send us a msg or stop by for a cup of coffee so we can go through the steps of developing your app.

Thank you for the time and see you in the next post!


Recent posts