Skip to content

Native Swift iOS application that utilizes Open Library's search API to browse available books.

Notifications You must be signed in to change notification settings

everuribe/openlibrarysearch-ios

Repository files navigation

OpenLibrarySearch-ios

Native Swift iOS application that utilizes Open Library's search API to browse available books. RealmSwift is used for local persistence of wishlist data.

Getting Started

Prerequisites

You will need to have XCode updated to at least version 10.2.1 to prevent compatibility issues. Note that iOS deployment target is iOS 12.2.

Installing

Download the source code and open OpenLibrarySearch.xcodeproj. No other installations are required as this should include the required RealmSwift framework.

Using application

The application has two tabs: search and wishlist.

In search tab, user taps search bar to begin typing a query. Results should populate automatically in the table view below, updating with the users input. User has the option of adding a filter to populate only books that have cover images. This can be done by tapping the settings icon and then tapping the switch to toggle this filter. A search cell with a star icon indicates that the item is already on the wishlist.

In wishlist tab, user can see a table of wishlisted books. This data is presented via locally persisted objects using RealmSwift. The only exception is the book cover images as the Realm team doesn't recommend using RealmSwift for image storage. Therefore, NSCache is used to store wishlisted book cover images for simplicity and Apple-tailored handling of memory. Books can be un-wishlisted by swiping the cell left.

In both tabs, the user may select a cell to open a detailed view of the book. This is the main interface used to add/delete books from wishlist. Here you can also view publisher, language, full text availability, and goodReads availability. These extra details are added via a UIStackView which can be easily adjusted to add more information in the future. If information surpasses view bounds, the user may scroll down. To exit this view, the user may tap the 'x' button or tap in the surrounding grayed out area.

Architectural Pattern

The MVVM (model-view-viewmodel) architecture is used to facilitate separation of business logic and user interface. Files are separated as such:

  • ViewModel - Contains view models for the Search view controller, Wishlist view controller, and the DetailedBookViewPresenter. Also contains BookObject which is a view model for BookListingCell as well as the main object model for books.
  • Model - Contains BookDTO the main model used as a data transfer object for the view model. Also contains SearchObject which simply defines the search object result obtained from the JSON.
  • Controller - Contains the customized TabBarController, associated view controllers, and the DetailedBookViewPresenter.
  • View - Contains BookListingCell, DetailedBookView, and corresponding view components.
  • Extensions - UIView class extensions
  • GlobalVariables - Defines main colors and NSCache object.

Built With

  • Realm - Local data persistence

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

About

Native Swift iOS application that utilizes Open Library's search API to browse available books.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages