CitiesSearch

Building And Running The Project (Requirements)

  • Swift 5.0+
  • Xcode 11.5+
  • iOS 11.0+

Getting Started

  • If this is your first time encountering swift/ios development, please follow the instructions to setup Xcode and Swift on your Mac.

Setup Configs

  • Checkout master branch to run latest version
  • Open the project by double clicking the CitiesSearch.xcodeproj file
  • Select the build scheme which can be found right after the stop button on the top left of the IDE
  • [Command(cmd)] + R - Run app
// App Settings
APP_NAME = CitiesSearch
PRODUCT_BUNDLE_IDENTIFIER = abozaid.CitiesSearch

#targets:
* CitiesSearch
* CitiesSearchTests

Build and or run application by doing:

  • Select the build scheme which can be found right after the stop button on the top left of the IDE
  • [Command(cmd)] + B - Build app
  • [Command(cmd)] + R - Run app

Architecture

This application uses the Model-View-ViewModel (refered to as MVVM) UI architecture,

Structure

SupportingFiles

  • Group app shared fils, like app delegate, assets, Info.plist, ...etc

Modules

  • Include seperate modules, components, extensions, ...etc.

Scenes

  • Group of app scenes.

Points to improve

  • Improve code coverage
  • Use swiftlint

Solution details,

  • decode data from json file and save it in array

  • used Trie data structre to save all cities Using Trie will need time proportional to M * log N, where M is maximum string length and N is number of keys in tree. so we can search the key in O(M) time.

  • https://en.wikipedia.org/wiki/Trie

screen shots:

Search (dark) scene Results (dark) scene Map (dark) scene

Search scene Map scene Results scene