Day 12: Movie Database app with Tuples

October 7, 2015 Will Lam

Okay, while it doesn’t hook into IMDB, Flixster, APIs or anything cool like that (yet), today I went through Bitfountain’s foundations course and completed something using tuples to draw the data from. It does only one thing and has data for a movie, but gives me an introductory idea of how to pull data from a tuple and display it in a view.

Check it out:

movieDatabase app using tuples

import UIKit

class ViewController: UIViewController {

  @IBOutlet weak var titleLabel: UILabel!
  @IBOutlet weak var directorLabel: UILabel!
  @IBOutlet weak var writerLabel: UILabel!
  @IBOutlet weak var studioLabel: UILabel!
  @IBOutlet weak var ratedLabel: UILabel!
  @IBOutlet weak var posterImageView: UIImageView!
  
  let dataRecord = (title: "Midnight Run", director: "MartinBrest", writer: "George Gallo", studio: "Universal Studios", rated: "R", year: "1988")
  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    
    titleLabel.text = ""
    directorLabel.text = ""
    writerLabel.text = ""
    studioLabel.text = ""
    ratedLabel.text = ""
    
    posterImageView.hidden = true
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }

  @IBAction func retrieveDataButtonTapped(sender: UIButton) {
    
    posterImageView.hidden = false
    titleLabel.text = "\(dataRecord.title) \(dataRecord.year)"
    directorLabel.text = dataRecord.director
    writerLabel.text = dataRecord.writer
    studioLabel.text = dataRecord.studio
    ratedLabel.text = dataRecord.rated
  }

}

Here’s today’s bonus nerdWOD:

Inspired by my alma gym mater’s WOD from this past Sunday:

AMRAP 9 mins:

15 kettlebell swings @ 24 kg

12 kettlebell lunges @ 24 kg

15 kettlebell swings

9 kettlebell goblet squats

… I finished 2 rounds + 2 kettlebell swings.

Previous Article
Day 13: Lucky number 13.. not really an app but more an update

So today was a bit of a slog because I had to get some stuff back for a review I was writing for Staples. Y...

Next Article
Day 11: Struggling to find new app ideas, but some UIPickerView fun
Day 11: Struggling to find new app ideas, but some UIPickerView fun

Okay, to be honest, I’m kind of limited to the stuff I can really build so I’m reaching out to see what oth...

Example Tagline

Learn More
×

Sign up for our email list!

!
Thanks!
Error - something went wrong!