Why take this course?

Since 2014, the majority of internet traffic is generated from mobile devices (phones and tablets). Sales of desktop and notebook computers are dropping, while the number of mobile devices is increasing rapidly. The opportunities for those who can program mobile devices will continue to increase for many years.

Programming for mobile devices requires many paradigm shifts when compared to traditional computing. Mobile devices have limited storage, slower speed, and little or no file system. Also, their small screen sizes require new methods of user interface. Mobile devices must have access to the network in order to be truly useful, but apps can help bridge the gap between a standalone mobile device and a system that requires a network at all times. Mobile devices have capabilities that traditional computers don't, such as location services, gesture input, and accelerometer.

Course Information

Course Description

This course is an introduction to programming iPhone and iPad applications in Swift using an object-oriented paradigm. Students learn to develop simple to more advanced applications using Xcode, Swift, Model-View-Controller framework, graphical-user interface, classes, methods, and messages.

Prerequisites

  • CIS 007 (Python) or ...
  • CIS 040 (C++) or ...
  • CIS 043 (Java)

Student Learning Outcomes

  1. Students will design and code iOS programs using Swift.
  2. Students will describe the model-view-controller (MVC) pattern and design applications with multiple MVC views.
  3. Students will use views to build hierarchical navigation-based applications.

Student Course Objectives

Upon completion of the course the student should be able to:
  1. Install and use iOS development tools such as Xcode.
  2. Describe application components and resources.
  3. Design and program applications with UI controls and event handling.
  4. Develop applications using split view controller, navigation view controller and web view.
  5. Develop applications using graphics, sounds and animation.
  6. Implement applications using accelerometer sensor and motion event handling.
  7. Develop applications with database capability.
  8. Prepare iPhone applications and deploy the application to Apple's App Store.

Course Outline

  1. Introduction to iOS App Development and Swift
    1. iOS history and features
    2. Xcode integrated development environment
    3. Swift overview
    4. Application components and resources
  2. Application Development and User-interface Features
    1. UI design and storyboarding
    2. Building and using controls
    3. Using alerts and dialogs
    4. Understanding the MVC pattern and creating applications with multiple views.
    5. Using hierarchical navigation and table views.
  3. Appication with multi-media and device features
    1. Graphics and animation
    2. Sounds and media
    3. Persistant data: files and database
    4. Location services
    5. Handling gesture inputs
    6. Interfacing applications with accelerometer and gyroscope.

Lab Content

  1. Installing and using the Xcode IDE
  2. Building a simple application using Swift
  3. Building an application with user interface controls
  4. Building an application that supports multiple views
  5. Building an application with hierarchical navigation and table views
  6. Building an application that uses Core Data
  7. Building an application with graphics and animation
  8. Building an application using location services
  9. Building an application that handles gesture inputs
  10. Building an application that that interfaces with accelerometer and gyroscope

Evaluation

  • Students will complete weekly reading and programming assignments.
  • Students are required to analyze, explain, deduce, problem-solve, synthesize and demonstrate understanding of aspects of computer programming.
  • Students will write programs, run the programs and check the correctness of the output produced by the programs.
  • Students will be evaluated through weekly assignments, tests and projects.

Resources


Alternatives to Xcode and Swift

The most common question when starting out writing apps for iPhone is: Can I create iPhone apps on my Windows PC? If you ask this question on Google, you'll get 7 million results. The second most common question is: Can I create iPhone apps on my iPad? This questions has 5 million matches on Google.

TL;DR: There are no viable alternatives to using a Mac and Xcode if you wish to succeed in this course.

Understanding Swift vs. Understanding the Frameworks

You might have heard that Swift is now open source and you can run it on many different platforms, including Linux, Windows, Android, and even over the web. This is true. However, iOS development involves much more than just the Swift language. Developing for iOS also means you need to understand the various frameworks. These are some of the frameworks we will explore in this course:
  • AV Foundation
  • Core Data
  • Core Foundation
  • Core Graphics
  • Core Location
  • Map Kit
  • UI Kit
Xcode also includes the Interface Builder for laying out your screens, which are called storyboards.  It is possible to lay out your screens using code only without the Interface Builder, but this is tedious. Learning to use Interface Builder to create storyboards using constraints is an important part of this course. Constraints are a way of building apps that work on many different devices, regardless of their screen size, pixel density, or screen aspect ratio.

Xcode vs. Other Tools

There are competing technologies such as PhoneGap, Sencha Touch, Ionic, Cordova, Appcelerator, and Xamarin, which allow you to develop apps without Swift and Xcode. Xamarin lets you write your code in C#. The other technologies let you write your code in HTML, CSS, and JavaScript, which is especially nice if you already know how to develop web apps. In general, these technologies tend to be on the slow side compared to native apps written in Swift on Xcode. But their advantage is that you can write one code base and deploy to various platforms, such as iOS, Android, Blackberry, etc.

If you wish to develop apps using such tools, I suggest you keep an eye out for this course: GDS 051: Mobile App Development Using Web Standards, which is offered from time to time.

However, the stated purpose of this course is to teach iOS development using the Apple tools (Xcode and Swift).

Xcode on iPad

The CPU on this device is not sufficient to run Xcode. The iPad has no command line interface or text editor. There is no version of Xcode or the iOS Simulator available for iPad. There is no file system on the iPad, so you'd have to store all your files, which could be quite large, in the cloud, and this would cause the system to be slow.

There is an iPad app called Swift Playgrounds, and it is useful for beginning programmers who wish to learn the Swift programming language, but it does not include the Interface Builder, the iOS Frameworks, or the iOS Simulator. It is only useful for learning the Swift programming language itself.

Xcode on Windows

Some will tell you that you can get Xcode to run on a Windows or PC box or Linux, by using a virtualization machine, such as Virtual Box or VMWare. While is it possible to get Xcode running on a non-Mac box, it is generally acknowledged that it is next to impossible to get the iOS Simulator running. This leaves you with a system where you can write and compile code, but you can't test it or deploy it.

I have had several students attempt to create a Hackintosh or try to run Xcode on a non-Mac box in other ways. I've never seen a student succeed. I had a student in the high school whose father was a manager in industry (and was on our school's advisory board) and had a whole engineering department at his disposal, and they could not make it happen. Even if it is technically possible to accomplish this, it is likely that you'd spend weeks working on it, only to fall so far behind that you'd fail the course.

Resources
Q&A: Can I Use a PC for iPhone App Development? from Code With Chris

Use Xcode On Windows 10 For iOS App Development on Windows from Webile Technologies

What You Need

You will need three things to do the homework for this class. Before coming to class the first day, you should arrange to have all these things in order, especially #3, the Apple developer account, which is free and takes only a few minutes to sign up for.
  1. A Mac capable of running Xcode.
  2. A recent version of Xcode.
  3. A free Apple developer account.

1 Mac

You will need access to a recent Mac that has a decent amount of memory and disk. It is not possible to run Xcode on any other platform: Windows, Linux, or iOS. I have run Xcode on the following systems:
  • A Mac Mini from 2012 with 16 GB of RAM.
  • A MacBook Pro 13-inch from 2013 with 16 GB of RAM and 256 GB SSD.
  • An iMac from 2014 with 32 GB of RAM.
In general, you want your Mac to have as much RAM as you can afford, at least 256 GB of disk, and at least Mac OS 10.12 (Sierra). Your Mac should have at least an i5 or i7 processor, not the older Core or Core Duo processors.

RAM. You'll probably need at least 8 GB of RAM. 16 GB would be better if you can afford it. Older versions of Xcode could run in 4 GB, but no longer. These RAM requirements rule out some older systems, which either max out at 4 GB, or are not capable of running the Sierra OS. A MacBook Air might work if you can add more RAM. The 12-inch MacBook probably does not have sufficient RAM and CPU. Try it if you already have one or if you can borrow one before buying.

Disk. 128 GB of disk is not enough. The Sierra OS itself takes up more than half of that. The Xcode application is currently around 13 GB, and all the extra Xcode files take up 35 GB more. Every device you wish to test on has a simulator that takes up more than 1 GB, and I require that you test on at least three devices.

CPU and OS. In order to use the latest versions of Xcode (8 and 9), you need at least Mac OS 10.12 (code named Sierra). Sierra runs on these Macs:
  • iMac: Late 2009 or newer
  • MacBook and MacBook Retina: Late 2009 or newer
  • MacBook Pro: Mid 2010 or newer
  • MacBook Air: Late 2010 or newer
  • Mac Mini: Mid 2010 or newer
  • Mac Pro: Mid 2010 or newer

2 Xcode

It is best if the whole class is using the same version of Xcode. The latest version is Xcode 10. However, the class materials are mostly written for Xcode 9, so it's best to install Xcode 9.

Each new version of Xcode supports a new version of Swift and a new version of iOS. If you use Xcode 9, you'll be able to run your code on your device that runs iOS 11 or earlier. However, if you have a device that runs iOS 12, you must use Xcode 10 if you want to run your code on that device. You can always run your code in the simulator.

My suggestion is that you hold off buying a new iOS device or upgrading your current device to iOS 12 until you've completed this course. Please refer to this discussion regarding an update of the Apple course materials to support Xcode 10.

Here are previous versions of Xcode and their capabilities:

Xcode ver.Swift ver.iOS SDKYear released
105122018
94112017
83102016
7292015
6182014
5Objective-C72013

3 Apple Developer Account

The Apple developer account is now free, and it lets you deploy your apps on your own device. Note: it is not necessary that you have access to an iPhone or iPad for use in this class, but we do suggest it. This is because it would not be possible to test your app on a real device before submitting to the App Store. Here is a short video that shows you how to create the developer account.




The App Design Process

Target Audience

The App Design Process is like any other marketing or graphic design process in that you start by understanding your target market. In this case, the target audience would be the class, company, or  people you are making the app for: Cybersecurity, Electrical Maintenance, Medical Careers, Sports Medicine, HVAC, Construction, Welding, etc. So you'd need to understand a few things about the customer:
  • What is their class or business about?
  • What kind of app would benefit them? (Reference, tutorial, vocabulary, flash cards, etc.)
  • What level would the app be aimed at? Experts? Novices? Somewhere in between?

User Interface

Then, of course, you need to understand some basic things about user interface. The essence of modern apps is that you allow users to do "the same old thing" in "a new and easier way." So, for example, if you are going to create an Anatomy app, what is the easiest way to let them choose a particular part of the anatomy to get information? (Think about a list of words vs. some kind of visual.) Weigh the difference between letting them type in information (lots of touches) vs. using the Picker widget (just a few touches).

The Process

Here is a general outline of how you might make your app:
  1. Start by understanding exactly what the app is going to do.
  2. Think of a way to accomplish this.
  3. Storyboard the app. Xcode is a great storyboarding system but it may be overly complicated. There may be some other online systems such as Balsamiq or FluidUI that serve your purpose better. But the best way to start is to just sketch our your screens on paper, then draw lines between the screens to indicate how they connect. We call these wireframes.
  4. If your app has a particularly difficult part, it might be worth prototyping that part first. For example, if you need to do something new like incorporating motion into your app, you might want to create a simple app that tests just that feature and lets you learn how to do it. You could also do some prototyping if you think your app may need lots of constraints.
  5. We usually start an Xcode app by putting together at least part of the storyboard, before making any code. This is because we can't really "connect" the code if we don't have buttons and other widgets to "connect" to.
  6. Possibly the most important step in creating an app is to test it. There are two parts to this. 
    1. First, you must test that your app works on the smallest iPhone (typically SE), the largest iPhone (typically 6s+/7s+/8+/X) and the iPad (they are all pretty much the same). 
    2. Second, you must let some of your users (i.e. students in the other class) play with the app and see how it works for them.
  7. Refine your app based on input from the Mobile Apps instructor, other instructors, students, and others in the target audience. You might think you know best, but in the end, you have to give the target audience the app they need, not the app you want to give them.
  8. Eventually, you'll want to submit your app to the App Store. There is no way for your students to get the app if it's not in the store. So, you'll need to make sure you make all the required icons and other assets required for app submission.

My Advice for Buying a Mac

What entitles me to give this advice: I have bought 12 different Macs since 1985, so I've been doing this for a long time. I have bought both brand new and refurbished. I have opened almost every Mac I've ever owned to upgrade it (except the new ones that can't be opened.) I am stingy, so I always look for the best deal and the best strategy.

[1] Your friend who works at Apple may be able to get you a discount. However, Apple employees are inundated with such requests from their friends, and they have a limited number of discounts to use, so employees usually reserve the discounts for their family members.

[2] Don't be afraid to buy a refurbished Mac. Apple sells them for about 15% less than list price. A refurbished computer has been returned to a tech who checks everything and fixes what may be broken. Many new computers ship with problems or even DOA. A refurbished computer has been checked a second time beyond the normal factory testing. (This is true of other computer brands besides Apple too.) Be careful: you may be buying last year's model.

Go to http://store.apple.com, scroll to the bottom, and look for "Refurbished and Clearance."

There are also educational discounts. The discount is about 10-15%. You can get the discount only on Mac Books and iMacs, not on Mac Minis or Mac Pros.

As of late 2018, there is a new 10% discount for active duty military and veterans.

You can sometimes buy refurbished Macs from these companies:

[3] Memory. You want your Mac to have as much memory as possible. But it's less expensive to install the memory yourself. Other World Computing (www.macsales.com) is a reputable company that sells quality memory, hard disks, and SSDs. Their web site can tell you how much memory your computer will hold, and they have videos that will show you how to install it, and tools to help you get rid of static electricity, etc.

(I've opened almost every Mac I've owned, including laptops, and upgraded the RAM and hard disk.)

[4] Processor. You'll need to have a computer running High Sierra (10.13+) to run Xcode 9. To run these operating system. you need a computer with an i5 or i7 processor, not the older Core 2 Duo or (shudder) Core Duo chip. The latest version of Xcode is 10, but it may be possible get by in this class with Xcode version 8. (You can run Xcode 8 on Sierra or El Capitan.)

[5] Screen. The new retina screens are beautiful. Once you use one, you'll never go back. Some people can't tell the difference. If you're one of those, don't bother. Some say that if your eyes are bad, you won't notice the difference. My experience is the opposite: my eyes are bad, and the retina screen really helps a lot.

[6] Upgrades. On most recent Macs, it is not possible to upgrade the processor chip. On many of the Macs released in the past three years, it is not possible to upgrade anything at all inside. The latest MacBook Air and MacBook Pro Retina are not user serviceable at all. You cannot upgrade the RAM, disk, battery, or anything else inside. If the upgrade you'd like to do is not available on www.macsales.com, then it is not possible to do that upgrade. Some of the older MacBook Airs have upgradeable parts but not all parts. The recent MacBook Pro (not Retina) may still have available upgrades.

[7] Beware of Craigslist and Ebay unless you know what you're doing. The conventional wisdom is that any laptop being sold on Ebay has been dropped.

[8] To order any upgrade, you have to know your Mac's model identifiers. If you already have your Mac in hand, do this:

     Apple Menu → About This Mac → System Report
         - or -
     ⌘-Space (Spotlight) → System Information

Then look at the Model Identifier. An example is "Macmini6,2."

You can look up the tech specs on any Mac model on the Every Mac web site.

Why take this course?

Since 2014, the majority of internet traffic is generated from mobile devices (phones and tablets). Sales of desktop and notebook computers ...