Programming iOS - Developing Applications for iPhone and iPad

10 class meetings.
6:30pm to 10:00pm Wednesday nights.

If you are a developer who wants to write applications that run on the iPhone or iPad, you should attend this class.

In 10 evenings, Programming iOS will teach you to create iOS applications like the ones you use on your iPhone every day. The class focus is on solid iOS Programming fundamentals which will serve you well in any context.

After an introduction to the Objective-C and Swift programming languages and the Foundation framework, we look in depth at the tools and the Classes that make up the iOS UI framework. We draw on the screen using UIKit, Core Graphics and Core Animation. We cover multi-touch event handling and the setup and configuration of a server in the cloud at AWS (Amazon Web Services) to support backend components of iOS applications. Your class assignments will interact with this server in a practical and real-world manner.

Lecture 10 - Integrating audio and video into iOS Applications - 12/4/2019

In this lecture we cover integrating multimedia into an application using AVPlayerViewController.

or AVPlayer

See for an example of playing an .mp4 video file from the app bundle, from an mp4 file stored on Amazon S3, and for HLS Streaming from files we placed on S3.

If you will stream video over a certain size and over 5 minutes long to the iPhone or iPad over cellular networks, you are required to send the video in HTTP Live Streaming (HLS) format. See the HTTP Live Streaming link as a starting point.

In class we demonstrate delivering both .mp4 data and HLS data from Amazon Web Services.

Handbrake is a great free application to encode video that is ready for an iOS app.

We cover including HTML5/CSS/javascript content (including video) into iOS applications.

We will also cover OTA distribution for testing as we did not complete that topic last class.

Lecture 9 - Singletons vs. Dependency Injection, Custom URL Schemes, Storing Data and Files on the Device, Over the Air Deployment - 11/27/2019

The Singleton design pattern provides a very convenient way to create a global object accessible from anywhere at any time in your application. This design pattern has a bad reputation as it is difficult to replace the Singleton during testing. In certain situations, however, singletons can result in a much simpler code base and make more sense. In this lecture we implement an example of a singleton and contrast that with dependency injection.

We look at storing data on the device in the documents folder, in user defaults, and discuss other storage options.

In class we demonstrate a custom URL scheme, which allows your app to be opened from links on web pages or from an email.

We also cover Over The Air (OTA) deployment for delivering test builds remotely to devices for testing and QA purposes.

There will be no homework due this week. Enjoy your holiday and consider catching up on old assignments!

Lecture 8 - Documentation/Git source code control - Hardware:Screens, Accelerometer, Compass, Gyro - Core Motion - 11/20/2019

In this lecture, we cover documentation of source code. In the past, the standard was using the JDoc standard. In the current version of Swift/Xcode, Apple seems to have replaced jdoc with 'Markup':

By following a few simple conventions, your documentation will become part of the help system in XCode. Full documentation can be automatically generated from your source code with tools like Doxygen, AppleDoc or HeaderDoc.

In class we cover git source code control, and mentioned bitbucket and github as a central location to store repositories.

We also cover device hardware: Compass, Accelerometer, Gyro and the GPS with Core Motion, Core Location and including maps into your applications with MapKit.

Homework 8: GPS and MapKit
  • Create a view-based application
  • Add a UITabbarController to the screen
  • On Tab 1, display raw GPS and compass data onto labels or some cool graphics objects on the screen.
  • On Tab 2, display a UITableView with one row for each of your favorite restaurants. The list should be driven by a JSON file that loads a collection of "Restaurant" objects, either from the bundle or delivered from a server location like AWS or DropBox.
  • When a cell with a restaurant is selected in the table view, push a MapKit view onto the screen, showing your current location and the location of the restaurant.
  • Consider adding a sectioned tableview with different sections based on categories like the style of food, rating or price.

Lecture 7 - Internet Continued..., Concurrency and Multi-Threading - 11/13/2019

In this lecture, we continue our discussion of Internet resource use, catching up on material scheduled for last week. We will look at methods of keeping the UI responsive during background processing. In a practical sense, this generally means downloading content from the Internet on a background thread, freeing up the main thread to update the user interface.

The 'Blocks' Objective-C language and 'Closure' Swift features are discussed in class. These features are a central part of supporting background processing on iOS.

Multithreading techniques on MAC and iOS include:
  • Creating and managing your own NSThread objects
  • NSOperationQueue and NSOperation
  • Built-in delegate callback mechanisms such as NSURLConnectionDelegate or NSURLSession
  • Grand Central Dispatch - a C-based API that leverages Blocks to place tasks into a queue for processing on other threads
  • URLSession and DataTask

Homework 7: Better Internet Downloading

  • Create a view-based iOS Application
  • Implement a UIScrollView that is several screens tall
  • Load four large/slow images from the Internet and place them onto the UIScrollView.
  • Start with a simple blocking call to download the images, and observe the blocking problems in the UI
  • Refactor to incorporate either Grand Cental Dispatch or URLSession/DataTask to fix the UI problems
  • Implement a spinner or other UI component to indicate to the user that the image is downloading
  • Consider completing the assignment again, this time integrating a network library such as AFNetworking to handle the background tasks
See the demos from tonight's lecture if you need some guidance with GCD.

A slow image you could use can be found here, change the delay as needed:

Video: - Background thread processing

Lecture 6 - Internet resource access, JSON and XML Parsing - 11/6/2019

In this lecture, we look at practical methods of interacting with data downloaded from Internet servers.

Topics Include:
  • WKWebView
  • NSURLConnection and NSURLConnectionDataDelegate
  • NSURLSession
  • URLSessionDataTask
  • Integrating cloud technologies - setup of and Ubuntu Apache Web Server using AWS, PHP and MYSQL
  • Parsing JSON and XML data into objects

In class tonight the open source network framework AFNnetworking was mentioned. Review the source code within this framework for an example of how to build networking code, as well as to practice including an externally written framework within your app. Open source frameworks are widely used and you may run into a need to support them.

This is a pretty complete article on json parsing:

In this video homework 6 is demonstrated, downloading and parsing JSON data from a web server.
Direct link to the file:homework6-json-parsing-final.mp4

In this video the setup of a new PHP/MYSQL webserver at AWS is demonstrated.
Direct link to the file:iphone-aws-demo.mp4

Homework 6: Parsing a JSON feed
  • Create a view-based application
  • Download the JSON feed we created in class at, a static json data file that you create and post to a cloud provider such as AWS, or setup AWS API Gateway to deliver a json feed.
  • Be sure to set the App Transport Security Settings in info.plist to allow arbitrary downloads if not using SSL on the server
  • Parse the JSON data into an array of custom objects or an array of NSDictionary objects using Apple's NSJSONSerializer Class
  • Add a UITableView to the screen to display the collection of objects

Lecture 5 - Custom UIView Drawing, CALayer - 10/23/2019

In this lecture, we look at drawing within our own custom UIView classes. The drawRect method of UIView provides a context into which you can draw using the Core Graphics C library. The Core Graphics API is known as Quartz, Quartz 2D or QuartzCore.

See the Quartz 2D Programming Guide at for in depth information about working with Core Graphics.

Behind every UIView is at least one CALayer object exposed as the .layer property. CA (Core Animation) layers provide a rendering pipeline for the contents of a UIView that is handled by the onboard graphics chip, freeing up the CPU for other tasks. CALayer supports custom drawing using Core Graphics by calling a delegate method drawLayer:inContext:. CALayer also calculates intermediate positions of UIView objects when you change a property within an animation block. Core Animation Programming Guide at is a great reference for Core Animation in general and in getting started with CALayer objects.

CALayer objects are quite similar to UIView objects (frame, subViews/subLayers). The main difference is that a CALayer object will not handle touch events, and they tend to have a lighter footprint and be faster to render.

Don't forget to import <QuartzCore/QuartzCore.h> as you start to work with CALayer objects.

Homework 5: Custom View Drawing
In this lab, you will investigate drawing custom UIView objects with Core Graphics and CALayer. Many of the more creative iphone and ipad application interfaces use this technique to create something truly unique and dynamic.
  • Create an iphone or ipad application using the view-based template using Storyboards for the UI.
  • Wipe out the viewcontroller scene in the storyboard file, and the corresponding source code files(s).
  • Add three new ViewController objects to the storyboard
  • Draw a box around all the ViewController objects in the storyboard, then choose Editor/Embed In/Tab Bar Controller
  • Create three new ViewController classes as listed below
  • Highlight each viewController, then change the class name to your three new ViewController classes
  • In the first tab, implement a UINavigationController that holds a UITableView showing your favorite musicians. Slide in a detail screen with more information about the musician when a row is clicked.
  • On the second tab, display a scrollable UIImageView with a world map that is larger than the physical screen on the device. You will need the UIScrollViewDelegate for this to function correctly.
  • On the third tab, display custom UIView class to support drawing an outline of a star with a clear backgound
  • When the application loads, create a random number of star views
  • Use viewDidAppear to animate the star views into position on the screen
  • Bonus: Using CAAnimation, animate a bounce movement when you touch a star

Lecture 4 - UIViewController, UINavigationController and UITabBarController - 10/16/2019

In this lecture, we will first wrap up our discussion of delegation, then will look at view controllers and classes that act as parents to UIViewControllers.

UINavigationController is a class that maintains a stack of view controllers, and presents the user with the option to move deeper into a hierarchy of data, then move back up the hierarchy by using a back button. Generally as you navigate up and down the stack, the .view property of the UIViewController slides in from the right, and slides off the right hand side of the screen as you navigate back.

UITabBarController is best used when you have distinct sections in your application. Each tab may have a different look at the same data, or it might be completely distinct, such as a "Settings" page.

The "Music" app and the "App Store" app are good examples of applications that make extensive use of both tabs and a navigation stack. Please spend some time in these apps, paying attention to layout and behavior of the UI elements.

To present anything on the iOS screen, it is important to have a clear understanding of the UIViewController Class instance methods:
  • -initWithNibName:Bundle
  • -loadView
  • -viewDidLoad
  • -viewWillAppear
  • -viewDidAppear
  • -viewWillDisappear
  • -viewDidDisappear
and properties:
  • .view
  • .title
  • .parentViewController
  • .navigationController
  • .tabBarController

Homework 4: UITabBarController
Lab has been postponed until next class, 10/23/2019, so we can catch up.

Lecture 3 - Foundation collection Classes, delegation introduction - 10/9/2019

In this lecture, the Foundation classes NSArray and NSDictionary are covered in more detail.

The design object-oriented software design pattern 'delegation' is discussed. The delegate design pattern is demonstrated through implementation of a basic UITableView object and through implementing a .delegate property on a custom class.

See Delegation in Wikipedia. The key is that the action is delegated to a helper object, but that the helper object has a pointer to the original context.

Homework 3: Investigating delegation and the UITableView

The purpose of this homework assignment is to gain more practice working with delegation and the UITableView class.

Hopefully you will have fun with the assignment and will experiment outside of the homework requirements, for example by adding a custom view to the UITableviewCell or by changing the appearance of the cell. This one could take up some time as some of the concepts may be unfamiliar.

  • Create an iPhone or iPad application using view-based template
  • Add an NSArray of items to be displayed on the screen
  • Add a UITableView to the screen
  • Add the appropriate delegate methods to support the UITableView drawing
  • After you get the tableview to work properly, add the appropriate delegate method to change the height of each UITableViewCell to be 100 points.

This assignment will take some time, but will be a foundation for many iphone projects.

Video: Homework 3 - Delegation and UITableView

Lecture 2 - Screen structure and layout, Specialized UIView Objects, Target/Action - 10/2/2019

In this lecture, we review the startup process of an iOS application from main() to the UIApplicationDelegate's application: didFinishLaunchingWithOptions: method. We continue to investigate Objective-C and Swift classes including methods and properties.

Fundamental application architecture is discussed, including screen structure and layout. The UIView hierarchy is reviewed, and more of the properties of UIView are discussed. A few specialized UIView objects are demonstrated, such as UIImageView and UITextField.

The target/action pattern is introduced and an example of this pattern is demonstrated with a UIButton.

This wikipedia link on Target/Action might be interesting to check out. The 'target' of the UIButton events will typically be the UIViewController instance, and the 'action' will be a method that has been defined by the programmer in the UIViewController object.

Homework 2: Specialized UIViews and Target/Action
  • Create an iphone application using the view-based template
  • Place a UITextField, UILabel and UIButton into the view hierarchy
  • Define a method that reads the contents of the UITextField and sets the .text property of the UILabel
  • Use target/action on the UIButton to call your method when the TouchUpInside event is fired

Video: Homework 2 - Target/Action

Lecture 1 - iOS Platform, Objective-C and Swift 5.1 - 9/25/2019

In this lecture, practical iOS development is introduced. A sample application is created to introduce the Objective-C/Swift 5 programming languages and their basic elements.

Objective-C is an programming language that features extensions of the ANSI C language. These extensions that have been added are mostly centered around object-oriented programming: creating Classes and working with methods on the Classes.

The following foundational programming topics are discussed:
Declaring constants and variables Control of program flow Comments Datatypes The following Objective-C syntax extensions should be reviewed:
  • @interface
  • @implementation
  • @property
  • [ ] (square brackets)
  • #import
  • - (minus sign to mark an instance method)
  • + (plus sign to mark an class method)
  • The @ sign as a shortcut - for example, @"Hello, World" creates an instance of an NSString

Swift is a programming language released with iOS8 which has subsequently been updated continuously to version 5.1. It is a more modern language and is similar to Java and C#.

The Apple Swift website is a good place to start learning about Swift programming for iOS, as well as the Apple WWDC Site.

The following Swift concepts and keyword should be reviewed:
  • var
  • let

Homework 1: Contact Info, Setting Up Your Development Environment, Basic App
  • Send an email to Dave at with iOS in the subject line. This is important so your email address can be whitelisted, and so you can be invited to the Slack channel.
  • Install the current production version of XCode (Version 11.0 as of September 2019). This will likely need to be updated before our course has completed. Use the "App Store" application on your Mac to find and download the free (quite large) XCode application.
  • Create an iphone application using the "Single View Application" template.
  • Display a red UIView object on the screen.
  • Add a touch event to move the UIView around the screen
  • Repeat once for Swift and once for Objective-C
  • Zip up the project folders and post them to Dave on Slack.
  • See the video(s) below for help! Note that the section on Swift needs an update in the video due to older syntax.

Video: Homework 1 - Getting Started with Objective-C and Swift
Note: This video needs to be updated for Swift 5! Coming soon.

Back to Top

XCode Projects - Class Demos, Examples and Homework Answers


Class Logistics

Previous Versions of iPhone and iPad iOS Development class

External Links

home Site Map Terms of Use Privacy Policy Client Directories