Git Product home page Git Product logo

walmartproductsswift's Introduction

WalMartProducts

This demo app uses JSON and CoreData to list and display products from Walmart's server. Written in Swift.

Features

  • Written in Swift 4.

  • Uses CoreData to cache responses from the server to speed up processing.

  • Universal app: supports iPhone & iPad.

  • On the detail view, you can swipe left or right to view other items listed in the table view.

Building the Project

Some of the project files are auto-generated. If you receive build errors for missing classes, simply open the WalMartProductsSwift.xcdatamodeld file to make xCode auto-generate the relevant files. Then rebuild the project.

Class Overview

Several custom classes appear in this project in order to converse with the Walmart server. By group:

Networking

These classes handle the interaction between the app and the Walmart server.

Product.swift: This class is an extension to the Product class generated by xCode for use with CoreData. It handles the parsing of JSON data into developer-friendly objects. If there is a parsing error, the class will generate a ProductJSONParsingError error or NSError and provide feedback about what happened.

ProductPageRequest.swift: This class handles the JSON web request to the Walmart server. The requestPage method takes care of setting up the request and sending it to the server. The results of the request are processed by the caller's supplied closure. A successful response will parse the JSON data into Product objects before calling the closure. If there was an error, then it is returned in the closure in the form of a ProductRequestError or NSError. A url response status code is also returned for processing.

WalMartProductSwiftTests

These unit tests are designed to test core functionality such as correctly parsing valid JSON into a Product object, ensuring that invalid JSON generates the proper error, making sure the CoreData entry is set up properly, and ensuring that the web request is formulated correctly.

walmartproductsswift's People

Contributors

billardm 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.