[SOLVED] cse438S-Lab 4 -Movie Search App

30.00 $

Category:

Description

5/5 - (2 votes)

Mobile Application Development

Overview

In this lab, you will be implementing common iOS view structures to create something that feels like a “real app”. Navigation bars, tab bars, and collection views are built-in ways to structure your app’s content. As for the content itself, you will be hitting a remote API for JSON data to parse into your application. This is a common structure which is used by many popular apps on the App Store.

 

 

 

 

Helpful Advice and Code Snippets

The Codable protocol is a great way to parse the JSON data from TMDb.  Create two different structs that conform to this protocol.  Examples of the two structs are listed below. Feel free to modify either to include additional information from TMD’s API.

 

struct APIResults:Decodable {

let page: Int     let total_results: Int     let total_pages: Int     let results: [Movie]

}

struct Movie: Decodable {      let id: Int!     let poster_path: String?     let title: String     let release_date: String     let vote_average: Double     let overview: String      let vote_count:Int! }

Collection views can be tricky to set up and get to work as you desire. Make sure to declare the delegate and data source, implement the protocol functions, and add the collection view to the view hierarchy. Start early and add functionality incrementally! It might be smart to test your collection view with hardcoded data before proceeding to ensure it works properly.

Because this app has to keep track of lots of data, one way to keep things organized is to create a struct that holds all the movie-related data. This struct could have variables that store the movie name, poster image, description, etc. You could create an array of this new type, and when the user selects a cell, simply pass the object to the new view controller so it can be populated with the correct data.

To save the user’s favorite to their device, there are many options. The simplest way would be to save the movie data to UserDefaults. This has many limitations, and is only meant to store simple settings in an application. Alternative methods include plist files, a local SQLite database, or Core Data. These might be good options to explore if you are considering creating a data-heavy final project. Make sure to test your storage method by closing the app in simulator completely (double clicking home button and swiping it away) before reopening the application.

Also, please download and test your app on a different computer! The favorite saving functionality is a common point of failure for submissions, largely due to the new install missing the array.

app. Feel free to design the app in any way you choose that still matches the requirements.