All Projects → apiaryio → polls-app

apiaryio / polls-app

Licence: MIT license
Swift iPhone and iPad Client for Polls API, using Hyperdrive API client

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
API Blueprint
66 projects
ruby
36898 projects - #4 most used programming language

Polls Client

Build Status

This is a Swift iPhone and iPad client for the Polls API - a simple application allowing users to view polls and vote in them.

Polls is an example application utilising the Hyperdrive API client. Hyperdrive will communicate to the Polls API without any hard-coded knowledge about how the API is implemented, just an understanding of the semantics the API is using.

The application does this by learning how the API works at run-time. This can be achived in one of two ways:

  • By downloading the API specification in API Blueprint format.
  • Talking directly to an API that exposes it's features and transitions in the API, such as with the Siren hypermedia content type.

Both the API and the application support both of these ways, you can switch between these modes in the application settings.

Screenshot of Polls iOS Application

Quick Start

You will need to install CocoaPods and then run the following steps to checkout the project and install the dependencies.

$ git clone https://github.com/apiaryio/polls-app
$ cd polls-app
$ pod install
$ open Polls.xcworkspace

Architecture

This application uses the MVVM (Model View View-Model) software architecture. Where each view controller has an appropriate view model which contains all of the model logic. The view model in this case will encapsulate the logic required to communicate to the API.

The Polls application is constructed from three view controllers and view models:

  • Question List - Shows a list of questions and may allow the user to create a new question or view the detail of a question.
  • Question Detail - Shows a specific question, and may allow a user to vote on the choices available on a question.
  • Create Question - Allows the user to create a new question in the API.

API Root

The Polls iOS client can be configured to use any API root, or switch between connecting to a Hypermedia API or the JSON Polls API described via an API Blueprint. You can switch between these modes by entering the applications settings.

Defaults:

  • Hypermedia: https://polls.apiblueprint.org/ - A hosted version of a Hypermedia Polls API.
  • API Blueprint: https://raw.githubusercontent.com/apiaryio/polls-app/master/apiary.apib - An API Blueprint found at this URL (hosted on GitHub in this repository).
  • Apiary: pollsapp - An API Blueprint hosted on Apiary.

License

Polls is released under the MIT license. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].