Coder Social home page Coder Social logo

karambirov / githubsearch Goto Github PK

View Code? Open in Web Editor NEW
41.0 0.0 8.0 458 KB

GitHub iOS client with minimum third-party dependencies.

License: MIT License

Swift 100.00%
swift networking persistence rest-api ios github-api swiftlint router githubsearch clean-architecture

githubsearch's People

Contributors

5smnoonms5 avatar karambirov avatar yaoxp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

githubsearch's Issues

Create Tab Bar Controller

For navigation the app uses Tab Bar with Navigation Controller inside of it.

What needs to be done:

  • Create Tab Bar that holds 2 tabs (Search and Favorites)
  • Each tab must have Navigation Controller

Create networking layer

The networking layer should be able to request search queries.

What needs to be done:

  • Should be built on top of Moya
  • It must be used in Services, not in View Controllers directly

Favorites' table stays empty after fetching

If a user taps "Favorite" in Details, the repository saves to the Realm file (it works correctly, the entry appears in Realm Browser). However, fetching in Favorites doesn't work โ€“ the table stays empty.

  • Fix Favorites fetching

Fix SearchViewController's table view

When a cell is reused its labels are not replaced with the new ones. Instead, they just appear on top of the old labels.

  • Cells should be reused correctly.

If you try to search something you'll get a list of results. But if you try to do a new search, the table won't be updated with the new results.

  • Update the table after a new search.

If a user taps the clear button in the search field, the table should become empty.

  • Clears the table if there's no any query in the search bar.

Encapsulate view logic from RepositoryCell

The views inside of a cell should be joined in one content view. Thus there should be another view that contains all of the UI elements. In RepositoryCell should be used only instance of that view.

Black screen after switching tabs

Just after search's table view has been populated with data from a network everything works as expected. But if you decide to switch tab to Favorites and back, Search will be black (maybe it's been deallocated).

  • Figure out what's wrong

Create Favorites Controller

The second screen of the app is Favorites. A user should have the ability to see all favorite repositories without an Internet connection.

What needs to be done:

  • Table View with all favorite repositories
  • Should work without an Internet connection
  • Should be possible to delete repo from favorites

Crash caused by delete operation of Realm

Open a 'About repository' interface.

  1. Click the 'Favorite' button,
  2. then click the 'Unfavorite' button
  3. finally click the 'Favorite' button.
    The APP crashed.

Reason:
When you click the 'Unfavorite' button, the repository is delete from Realm

    func delete(_ object: Object) {
        // Deletes an object from the Realm. Once the object is deleted it is considered invalidated.
        write { $0.delete(object) }
    }

Now, the repository is considered invalidated and can no longer be accessed.

When finally click the 'Favorite' button, you access the deleted repository, so that APP crashed.

    @objc func favoriteButtonTapped() {
        if !viewModel.repository.isFavorite {  // crash
        ...

Handle states of UI

UI must be user-friendly, so a user should be aware of loading, errors, absence of results.

  • Handle error state. Show a message that something went wrong.
  • Handle loading state. Show a spinner when trying to get results from a server.
  • Handle empty state. Show a label in the middle of the screen that there are no results.

image

Add infinite scrolling

When a user reached the end of the search results a new request should be sent.

  • Show 25 results at a time (twice of what iPhone screen can show).
  • Send a new request when a user reached the end of the list. Or send the request after the first half of the results have been shown.

Wrong navigation bar button title in Details

If you try to open from Search a repository that already has been saved, navigation bar button title in Details will be "Favorite".

  • While opening Details, check if the repository already saved.

Refactor RealmService

  • Method create(_:completion:) won't be used. So it needs to be deleted.
  • Method fetch(_:predicate:sorted:completion:) should't be generic.

Add Readme screen with Markdown rendering

From Details screen user should be able to open Readme screen.

  • Should be opened from Details.
  • Should be available without an Internet connection.
  • Markdown should be rendered like in a browser.

Create Detail Controller

The Detail shows information about a repository such as an owner's full name, login, profile image, repo's name and description.

What needs to be done:

  • Show information about the repository (full name, login, profile image)
  • Show information about the owner (name, description)
  • Ability to save the repository in Favorites

Create navigation

To open Details there should be some kind of navigation service. Because ViewController shouldn't be aware of how to open other screens.

  • Create navigation

Create Search Controller

The first screen of the app is Search. A user should have the ability to search GitHub repositories.

What needs to be done:

  • Search field to write queries
  • Table View with results of a search

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.