GithubHelp home page GithubHelp logo

hacker-news-client's Introduction

Hacker News Client

This project is a hacker news client using their official api defined here: https://github.com/HackerNews/API

Why this project?

This is a project that we had asked in our onsite interviews to our candidates and collaborated with them to solve while working at Mirror.

I am intentionally not using the optimized Firebase mobile clients for this project to showcase how I am overcoming the challenges while building this app. The API itself is extremely fast however requiring the client to make many api calls and maintain the app state internally.

If you are using charles or any network sniffer, you'd be seeing tens of api calls are being made when you are opening a screen. Again, that's intentional.

Architecture

The project is using SwiftUI to build the UI declaratively, and leverages MVVM as base architecture. Aside from that, it has a repository layer that is responsible of fetching and maintaining the data.

The application has a single local package dependency called Networking which is providing the base functionality to make asynchronous calls.

The project also uses Combine under the hood for the UI but for the rest of the areas leverages Swift Concurrency.

Improvements

Functional

  • Leverage AsyncStreams or Combine to stream the comments in the Story detail page from the ItemRepository instead of waiting all comments to be fetched partially requested by the user.
  • Implement infinite scrolling instead of on-demand pagination.
  • Implement pull to refresh
  • In-Memory cache needs to be invalidated when needed.
  • Optimize HTMLText view so that it doesn't throw warnings.
  • Error handling is not properly done in this project.

Architectural

  • Use a proper DI package such as Swinject or needle.
  • Extract the high level pagination logic from view models.

Testing

  • While the code is written testability in mind, there are currently no tests.

How to run?

Make sure to use XCode 15.3 and open HackerNews.xcodeproj. Deployment target is currently set to 17.4 but the project should be able to run for 17.0+.

hacker-news-client's People

Contributors

yapiskan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.