Star Wars

The Star Wars logo is a UIImageView subview in a big black View superview that fills the screen. We saw an UIImageView in Puzzle, and a stretching/shrinking animation in exercise 8 of Animate.

Source code in

  1. Class AppDelegate.swift
  2. Class ViewController.swift. Added the AVAudioPlayer property and initialized it in the viewDidLoad method. Also added the method supportedInterfaceOrientations to launch the app in lanscape orientation.
  3. Class View.swift
  4. Images.xcassets, an Xcode asset catalog file.
    1. Star_Wars_Logo.imageset
      1. Contents.json: a JSON file listing the files belonging to the Star_Wars_Logo image set.
      2. Star_Wars_Logo.png: one of the files belonging to the Star_Wars_Logo image set. Apple prefers .png format. 1000 × 604 pixels.
  5. fanfare.mp3
  6. Info.plist: added the “Initial interface orientation” property to launch the app in landscape orientation.

Create the project

I got the sound from, and converted it to an mp3 file with

For background music and landscape orientation, see Gone. Make sure the Mac’s sound is on before you run the project.