Assignment 3

GitHub Issues

Due Dates

Resources

Create Your Repository

Assignment

In this assignment, you will create a application that allows users to view open and closed GitHub Issues posted in an open source repo. We will use URLSession to fetch data from the GitHub REST API, and UITabBarController, UINavigationController, UITableView to display it on screen.

You may choose any open source project on GitHub that has at least 20 open issues. (Note that GitHub considers pull requests to be a type of issue.) Visit GitHub’s Explore section to browse repositories.

Project Setup

Start with either the “Tabbed App” template or the “Single View App” template. Update the storyboard so that you have a UITabBarController with two tabs. Each tab should contain a UITableViewController embedded in a UINavigationController.

When you’re done, your storyboard should look similar to the image below.

View Controllers

Tab Bar Controller

Issue View Controllers

TIP: Remember to set the reuse identifier of each prototype cell.

Issue Detail View Controller

TIP: The date string returned from the GitHub API will be in the format: yyyy-MM-dd’T’HH:mm:ssZ. You should display a date string in the format: November 23, 1937.

Fetching Data

When each issue view controller loads, fetch this repo’s open or closed issues from the GitHub API using the networking code discussed in class.

The GitHubIssue struct should contain the following properties:

    let title: String?
    let createdAt: String
    let body: String?
    let state: String
    let user: GitHubUser

The GitHubUser struct should contain this property:

    let login: String

Create a class called GitHubClient and add a function called fetchIssues. Use the code from the playground discussed in class to implement this function. The URL to fetch issues is:

https://api.github.com/repos/<OWNER>/<REPO>/issues?state=<STATE>

In viewDidLoad(), invoke this function using the appropriate issue state (“open” or “closed”). Once the data is available, trigger a reload of your table by calling the table view’s reloadData() method.

Refactoring (Optional)

App Icon

Grading