Swift and iOS8 Apps in 31 Days: Build 16 iPhone apps

Design UI and write code using Swift and Xcode 6. Make apps for iOS8 and iPhone 6 – sell your apps on the App Store!
4.4 (121 ratings) Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
6,228 students enrolled
Instructed by Paul Solt Development / Mobile Apps
$30
Take This Course
  • Lectures 255
  • Contents Video: 35 hours
    Other: 12 mins
  • Skill Level All Levels
  • Languages English, captions
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 11/2014 English Closed captions available

Course Description

From a former Apple employee and the incredibly successful Kickstarter project (475% funded) comes the Swift and iOS8 Apps in 31 Days: build 16 iPhone apps course.

Do you want to boost your income as an app developer?

Or do you want to change careers to increase your salary, flexibility, and freedom?

The Swift and iOS8 Apps in 31 Days course is the most comprehensive, cost effective, and career changing iPhone app development course that you’ll find online – or your money back.

BONUS CONTENT - Learn from the creators of Square, Zombie Highway, and Fantastical. You’ll get insight into how successful app developers have been able to get millions of downloads and tons of money. Listen to the exclusive interview and Q&A that you can’t get anywhere else! The insight is worth $1000’s!

It is the complete course that you can use to start making professional iOS apps that will delight users, solve problems, and will make you money!

If you are looking for a course that will turn your ideas into apps that will start earning you cash, I personally guarantee this is the best course for you.

From Beginner to iOS App Developer in 31 Days

  • Xcode and Interface Builder
  • Buttons, user input, and adaptive UI
  • Swift: Apple’s new programming language (the future of iOS)
  • Variables, tables, touch gestures, and Auto Layout
  • Navigation, storage, and web content
  • Images, animations, and App Store polish
  • Facebook SDK and JSON
  • Web services + top 100 App Store app tracker
  • App Store submission
  • Open source code and SDK integration
  • Interview with successful app developers (millions of downloads + $$$ = Day 12)

Throughout 150 lectures and over 18 hours of content, you will start with the basics and build apps from the very beginning. You’ll learn tips and tricks to work effortlessly with Xcode and Swift.

Throughout the course you will build upon knowledge into bigger apps using web, animations, and touch input. Together these technologies will allow you to create apps like many on the top 100 lists of the App Store.

I promise that this course will not waste your time or hard earned money. You don’t need to buy books, expensive online courses, or bootcamps. Skip old YouTube videos that lack a structured curriculum.

With the Swift and iOS8 Apps in 31 Days course you will get everything you need, all with one convenient, easy to navigate online course. Plus, you will get fast, friendly, and responsive support by email, Twitter, and on the Udemy discussions.

What are the requirements?

  • No programming experience required
  • A Mac or PC (MacinCloud.com)
  • A paid iOS Developer account is not required – you can download Xcode 6 free
  • You will learn everything you need to know to make your first app

What am I going to get from this course?

  • You will learn how to publish apps to the App Store
  • How to sell and earn money from your apps
  • Design and create new iPhone apps from scratch
  • Create a real app for an app idea you have had
  • Start a career as an iOS app developer

What is the target audience?

  • Anyone who wants to make apps
  • Anyone who wants to learn to code
  • Designers and web programmers who want to make iOS apps
  • Business owners who need to build an iPhone app
  • Any underpaid employee who wants to switch careers
  • People who want to earn side income from app development

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Getting Started
00:56

Download Xcode 6 from the Mac App Store.

Xcode 6 is like Word, but instead of writing papers your will be writing code and designing user interfaces with drag-and-drop controls.

Resources

01:57

1. After you download Xcode, find it using Spotlight (Command + Spacebar) and type Xcode.

Tip: You can pin Xcode to your Dock using by right-clicking on the icon and selecting Options > Keep in Dock

2. Alternatively you can open Launchpad (4 finger pinch gesture).

04:28

Create a new Xcode project from the startup window or by navigating to:

File > New > Project

An Xcode project is a folder with settings, code files, and resources. Using the Xcode app you'll be able to turn these files into an app that you can run on an iPhone, iPad, or the Mac.

Xcode is bundled with an iOS Simulator, which is a virtual iPhone on your Mac. You don't need to own an iPhone to get started, you just need a Mac.

Download your App to your iPhone

If you want to install the app that you are creating on your iPhone, you'll need to register with Apple for the iOS Developer Program. It's $99/year + taxes and it allows you to test your app on your devices, or even send it to friends to try out.

When you first start, you don't need to register for the paid developer program. Wait until you have a working app, or are ready to submit to the App Store.

If you're in college, most universities are part of a special student/faculty program, which can allow you to test on your iPhone for free (but you can't submit to the App Store until you make a paid account).

Section 2: Day 1
06:53

Materials

  • Mac (2008+) or MacinCloud.com (PC users)
  • Xcode 6 and Mavericks (10.9+)
  • Notebook

Learning Outcomes

  • Write Swift code
  • Design user interfaces (UI)
  • Learn how to learn

Get Help

01:21

Text Labels and Animations

Today you are going to build an iPhone app that uses touch input and text labels. User interface (UI) elements like buttons and labels are the building blocks of every app.

You will use labels to display text to the user. We're going to get a little fancy and use a Tap Gesture to make the entire screen a button.

What does all this code do?

There is a lot of code in this lesson that you might not understand, and that's the point. I want to show you how to create something, without fully understanding it.

Follow along and type the code you see in the video. It will help you ask questions and start to see what you do and don't understand.

12:12

Position the UI in Code

To give you a sense for how the internals work under the hood, you are going to add the UILabel (text) to the screen in code. The drag and drop editor is convenient, but it doesn't make you think about the spacial relationship of your iPhone app's UI.

Required Steps

There are three important steps when you add a UI element to the iPhone screen (or else you won't see anything!).

  1. Set the size (rectangle bounds)
  2. Set the position (2D point)
  3. Add it to the view (iPhone screen) as a subview (child element).
08:32

Animations

Animations and iOS apps go together, in this lesson you'll learn how to quickly create a complex animation to make your app stand out.

You will learn how to add physics-based animations to give the iPhone app a bit more spring.

These techniques can be applied to any UI element (UIImageView for pictures, UITextField for text input, or even UIButton for buttons).

08:43

Gestures

Touch gestures on iOS give you the power to create user experiences that you are familiar with in Apple's own apps. You can use touch gestures to pinch, drag, flick, rotate, twist, tap, double tap and more.

I love touch gestures, and that is why I first created Photo Table. It uses the Pan Gesture, Pinch Gesture, Rotate Gesture, and Tap Gestures. I also incorporated Pan Gestures with Bomb Dodge to make an avoidance game.

Refactoring Code - i.e. Reusable Code

Much like paper writing, the first lines of code you write aren't the final lines of code you end up with.

During the development process you'll find out that you want to reuse some code or logic that you've implemented elsewhere. This might be to repeat an animation, or to add a paid customer to a mailing list.

Chunks of code that you can reuse are contained within methods or functions. In Swift, you'll use the func keyword to create a named chunk of code that you can reuse.

Repeatable Animations

Refactor the label setup, position, and animation code and move it into a new method called addLabels(). Then you can call the method addLabels() when the viewDidLoad method starts (i.e. the screen is visible on the iPhone) and when the user taps anywhere on the screen.

13:37

3 Common Mistakes

1. Typo or missing method name

If you use the target/action to setup a button action, or to setup a gesture action you can create a situation that will crash with the SIGABT error code.

In the real-world this error is non-recoverable, so you'll have to fix it now, or you'll risk 1-star reviews.

Searching Google Effectively

You might be confused and not sure where to turn. Google's a great resource, but you need to learn how to search.

a. Copy/paste the error message into Google.com (It'll be long and ugly)

   	2014-10-06 15:42:40.497 Bouncing Labels[15216:1451611] -[Bouncing_Labels.ViewController handleTapGesture]: unrecognized selector sent to instance 0x7ffad3c1c9f0   	
   	2014-10-06 15:42:40.500 Bouncing Labels[15216:1451611] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Bouncing_Labels.ViewController handleTapGesture]: unrecognized selector sent to instance 0x7ffad3c1c9f0'   	

b. Usually the first line has the message, in this case you want to search for:

   	-[Bouncing_Labels.ViewController handleTapGesture]: unrecognized selector sent to instance 0x7ffad3c1c9f0<br>   	

c. If the first part was the name of an open source project, like AlamoFire, that would be a clue to investigate, otherwise you'll want to remove it. Search for the following in quotes:

   	"unrecognized selector sent to instance"   	

d. Because Swift is new there will be a lot of answers and support for Objective-C, and most will be out of date. Make sure you add Swift to the search term to make it explicit.

Search Google: "unrecognized selector sent to instance" swift

2. Missing a matching double quote, parenthesis, square brackets, angular brackets, or curly brackets.

There are a few symbols in most programming languages that come in pairs. If you don't have both a left and right side, you'll have a syntax error, and you'll see a ton of Swift Compiler Errors.

Make sure that you match these symbols in pairs, you can use the left/right arrow keys to double check the start/end pair by moving back and forth on the right most symbol.

   	"hello"   	addLabels()   	fund doSomething() {   	    println("running to the store");   	}   	

3. Breakpoints are False Positives (Timecode: 10:45)

When you are just starting you might accidentally click on the left gutter, by the line numbers. If you do, you'll see a little blue, or faded blue flag appear.

This flag is a breakpoint, and it's used to debug a program to look for crashes, or to walk through the logic of an app.

When you don't expect it, it can appear to be a crash, but you can recover from it and resume the app.

Look on the right side of the code window. If it says something like Thread 1.1 breakpoint then your ok.

You can safely remove the breakpoint flag by right-clicking on it and pressing delete, or by left-clicking and dragging it off to the side.

09:43

Where can I find the solutions?

On the forums, there’s a daily post for each exercise. Post your code and answers there, or discuss issues you might have had.

http://forum.iphonedev.tv/category/code-solutions

Subtitles are not showing - Jason

It’ll be a 1-3 day turn-around for subtitles on all videos. I need to make sure the content is good before I pay $1/minute for captioning.

I’m open to suggestions or alternatives to ZenCaptions.com

Should I own Mac before this course

I think you should own a Mac, but you have to justify the cost.

If you want to experiment, you can try the MacinCloud.com service, it's $20/month and a little slow, but it’s much cheaper than buying a Mac.

I want to learn from scratch so which course should I take first , course one or bundles - Navy Seal

Start with the first Swift course that started October 6th: http://learn.iphonedev.tv/course/make-iphone-apps-in-swift-for-ios8

I paid for the courses on Kickstarter, but it’s asking me to pay again. It says I have not signed up for any courses. - Suresh and Drew

You need to look for a message from Kickstarter, login to Kickstarter and read your messages. There should be one or more special links that will allow you to enroll in your courses.

http://forum.iphonedev.tv/t/kickstarter-backers-how-to-redeem-your-pledge-reward-level/132

Do you recommend learning Objective-C first? - Kyle

No I don't recommend learning Objective-C to learn Swift. Learn the language that you want to use.

When you’re passionate about learning, take the opportunity to push yourself. When you have to learn X and Y before Z, it can really kill your momentum and motivation.

Objective-C is a 31 year old language. Swift is new and provides modern programming features that reduce the amount of code you type. Swift also helps you write better code, so that you can avoid the common Objective-C app crashes.

Why would you wanna make a Label manually by code when you can just use the drag and drop feature?

If you want to do fancy animations and transitions, you'll do it in code.

Drag and drop is a good starting point, but it has limitations on the complexity and layout that you can do in code.

I use both approaches depending on how interactive the UI is. Most of the time I can get by with Xcode's Interface Builder to layout the design, it's a lot easier to see visually. To get finer control, or to dynamically move elements you can use code to control visibility, size, transitions, etc.

Hi Paul, why we need to use "self." in the UIView.animateWithDuration? - Jayden

Short Answer We need to use self in blocks/closures because otherwise it’s a compiler error, which means your app will not run.

Swift Compiler Error

Long Answer

Google the compiler error above for more insight. It’s ok if you don’t understand what this means now, this is something we’ll learn more about later in the course.

You can write self.view and view in any method. The shortcut is new for Swift, so that you don’t have to write as much code.

The completion bland animation closures are special functions that you can write in-line. When you write them this way they can capture the local and instance variables by reference.

Read the following parts from The Swift Programming Language book that’s available for free on iBooks.

Capturing Values

A closure can capture constants and variables from the surrounding context in which it is defined. The closure can then refer to and modify the values of those constants and variables from within its body, even if the original scope that defined the constants and variables no longer exists.”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

Resolving Strong Reference Cycles for Closures

NOTE

Swift requires you to write self.someProperty or self.someMethod (rather than just someProperty or someMethod) whenever you refer to a member of self within a closure. This helps you remember that it’s possible to capture self by accident.”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

What is self?

“Every instance of a type has an implicit property called self, which is exactly equivalent to the instance itself. You use the self property to refer to the current instance within its own instance methods.

” Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l

Resources

http://ericasadun.com/2014/08/26/swift-capturing-references-in-closures/

Code Exercise - Change Animation Directions and Physics
Article
Notebook Activity - What did you create?
Article
Section 3: Day 2
01:47

Learn Xcode

Today you'll learn how to get started with Xcode. You'll use Xcode to write code, fix bugs, and design user interfaces.

You will learn about the panels, buttons, tabs in Xcode. There's a lot of settings and different panels can show and hide. This is great from a visual standpoint, but it can make it hard to know what's going on.

Day 2 is focused on Xcode

  1. Learn Xcode panels and Xcode buttons
  2. Xcode files (Code and User Interface files)
  3. App Flow (Where does an app start? Where do you put code?)
  4. Calculator style app UI design
  5. Auto Layout for iPhone apps
  6. Text input from the user

Code Exercise:

Work with user input using Double values (3.14)

Again I appreciate your support and I've been monitoring the discussions, but I haven't had the time yet to participate fully.

-Paul

PS Let me know if you have any feedback on the Day 1 materials in terms of flow, difficulty, and clarity.

03:35
  • Use Play/Stop to run your iPhone app or stop it if there's a bug.
  • Learn how to adjust what iPhone device or iPad device you use for the iOS Simulator (virtual iPhone on your Mac).
  • Adjust the scale or size of your iOS Simulator to fit on your computer screen. iPhones and iPads with retina displays are very tall devices.
  • Learn where to look when you have a code error in Xcode 6.
  • Find the Project Navigator, which includes all your important code, settings, and interface files.
05:51

There are 3 panels that contain different information that you'll use to make iPhone apps

  1. Navigator Panel (left)
  2. Utilities Panel (right)
  3. Debug Area (bottom)

In the center of the screen you'll find the Standard Editor (single code or UI editor).

The leftmost icon in the Navigator Panel, that looks like a folder icon is the most important tab you'll use in Xcode. It'll allow you to find any of your code files, or get to your project settings.

Tabs

There are a ton of tabs through out Xcode. You'll find tabs along the top of the Navigator Panel and Utilities Panel.

If you select the Project, the center will show project settings. Along the top of the settings are text-based tabs to give you access to more technical details. For the most part, you shouldn't need to alter any of these settings.

05:11

The three main starting points for a single view app are:

  1. AppDelegate.swift
  2. Main.storyboard
  3. ViewController.swift

The AppDelegate code file provides "hooks" or methods where you can add logic to respond to when the app first starts, closes, or pauses due to an interrupting event.

The Storyboard file will contain a set of iPhone screens, when you start it'll just be one, but you can add more.

Note: There is an arrow that indicates the first screen, click and drag it to move it to a different starting screen.

The ViewController code file is attached to the screen in the Storyboard file, when the first view appears, code in the ViewController code file will execute.

Where is the best place to start writing code?

Write code inside the { } braces in the viewDidLoad method from your ViewController.swift file.

Try writing:

   	 println("hi")   	

Resources

01:55

Design an iPhone app using labels, text fields, and buttons. You will learn how to get user input and perform a calculation that can be displayed to the user.

When you drag and drop UI elements onto the iPhone view (canvas), Xcode will magically do all the work that we did in the first day's lesson.

Each UI element corresponds with a code file, today you'll be using the UILabel, UITextField, and UIButton objects through the drag-and-drop user interface editor.

Tutorial - Design the iPhone User Interface
11:11
Tutorial - Auto Layout for Beginners
12:02
Tutorial - Connect the User Interface to Code
04:32
Tutorial - Parse Text String Input as an Integer
08:52
Tutorial - Troubleshooting User Interface Bugs
14:12
10:23

Do you want the application “Xcode.app” to accept incoming network connections? - Bennie

Yes. It seems like it's related to your firewall or security settings.

Did you download Xcode 6 from the App Store after iOS 8 was released?

http://robcottingham.ca/2008/03/os-x-applications-constantly-asking-permission-to-accept-incoming-connections-heres-a-fix/

https://discussions.apple.com/thread/1399415?tstart=0

When you are looking at some code and it looks 100% correct but it still fails to build successfully. It is possible you have inadvertently entered an invisible control character into your text and the only way to fix it is to just retype it.

All I did was retype the word Selector to correct the error. - Glenn

It's not an invisible character, but a "Code Completion" element. It's a little blue bubble that needs to be replaced with the actual expression or variable name.

When you type method names, Xcode will insert special text with the pale blue highlight lozenge. You need to replace it in order to complete the line of code.

I wonder if you could spend a minute or so explaining what each new method or function does (I may be using the wrong words here) - I will give you an example. You used the "animateWithDuration" thing in lesson 1, and sped through it telling us what to enter. From my perspective, a minute or so telling us about the options around that would be very helpful. - John

I'll have a lesson on methods and go much more in depth, as well as looking at the definition for all the parts.

Right now I want you to focus on getting something working, so that you can start to see all the parts that we'll be learning. I didn't want to explain everything in the lecture materials, unless you really think it's crucial.

Typing in code and getting it to run is a big first step. There's going to be a lot of questions, and I promise I will be answering them.

Paul’s Question: How much time?

"The first lesson was much better than I thought it was going to be. I really thought I was going to be extremely overwhelmed. I managed it pretty well and wrote down some notes. It did take me a little longer than I thought, because of pausing then writing and writing code. Maybe 2.5 hrs today. Hopefully as I get better at this it will not take me as long.” - Lindsey

Play with the code and explore - Ryan

Swift Primer - Yes I finished that one with the birthday in days and it worked perfectly my parents liked it as well thnx -Benjamin

Quick question: what are the limitations of Swift? ...is Objective C being fully replaced by Swift or is Swift merely a RAD tool sitting on top of Objective C? ...trying to figure out whether I should bypass Swift and concentrate on Objective C? -Chris

I would say that today the only limitations of Swift are merely cosmetic. It is a full replacement for Objective-C moving forward.

The only downside to Swift today is that there are less Open Source code options and that there is less support on common error messages. Both of these two downsides are going to change rapidly as more developers make the transition to Swift.

I expect that in the next 2-3 years, Apple may add features that make Swift significantly better than Objective-C code. This will probably be in the form of better code assistance in Xcode and smarter error messages. You’ll be able to make apps faster with less of the boiler plate code, which will become unnecessary.

Apple has been moving in this direction with Objective-C, but they ran into legacy issues that prevented more changes. Hence the announcement of a new language that doesn't have 31+ years of legacy to support.

I travel every day a lot, is there a way to download all the lessons at one

time? - Aaik

Not yet, but I’m working to support that. I may experiment this week with a single daily zip download, after I finalize the daily lesson.

Right now I’m not sure how to provide captions with video downloads.

Please help me with this weird error ( Was trying to add gesture to labels ) - Shashwat

It's not an error, it's a breakpoint. That stops the execution of the program, which is useful when you're trying to fix bugs. However when you first start, it's really confusing and looks like a bug.

Watch my video on trouble shooting: http://learn.iphonedev.tv/lecture/91909/16-tutorial-troubleshooting-common-mistakes/

I discuss the solution below in the text, as well as in the video around 10:45 into it.

Question about this course? Like courses in Udemy, is it possible to download videos to my iPhone in an app of some sort? - Jordan

No, not yet.

I would like to make an app, but I don't have an ETA until I finish teaching the first 4 courses.

I will be providing a video download link, but I don't have specifics yet. I'm working to export the videos so they are smaller, and will be easier to download and transfer to your iPhone/iPad.

Why isn’t there support for Double conversion?

Checkout Fernando’s code sample, he used an extension to add support.

https://gist.github.com/Conaaando/6c931cd5da81e9a39d7c

So a bunch of places in the ViewController class we're referencing the view object, such as:

view.addSubview(myFirstLabel)

What is it? Where does it come from? - Andrew

view is a property from the UIViewController class. When we subclass we get that property and can use it in our code.

Look at the UIViewController class reference to understand what other properties are provided from Apple.

UIViewController Overview:

https://developer.apple.com/library/ios/Documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instp/UIViewController/view

UIViewController view Property:

https://developer.apple.com/library/ios/Documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instp/UIViewController/view

We’ll learn more about the details in the coming week.

I notice Paul, that your X-code app displays the option for iPhone 6 as your display device, mine only has 5S, how do I get iPhone 6 in my app? - Jeffery

1. Click on the Device type to make the drop down appear.

2. Scroll up/down to the desired device.

Not working? Try these steps

1. Delete any old beta versions of Xcode (i.e. Xcode6-Beta7.app) from your Applications folder.

2. Are you using the latest version of Xcode 6 from the App Store?
If not, download Xcode 6 today.
https://itunes.apple.com/us/app/xcode/id497799835?mt=12

3. Are you on Mavericks or Yosemite?
The user interface will look a little different on Yosemite. I recommend staying in Mavericks until I recommend upgrading. Usually I think it's best to wait to see if anyone else has any issues.

Code Exercise - Experiment with Double or Float Numbers
Article
Notebook Activity - Auto Layout and User Interface Design
Article
Bug Fix - Three Xcode UI Connection Bugs
11:47
Bug Fixes - Size Classes for Compact Any
06:18
Section 4: Day 3
01:37

Day 3 Topics

  • Learn to debug code
  • Walk through code line by line
  • Understand breakpoints
  • Using the code Playgrounds

Feedback

  • What is confusing?
  • Where did you get stuck?
  • What can I explain better?

Tomorrow we should be starting the programming concept lessons. I'll explain some of the code you've been working with and what it means.

Questions and Feedback

Lecture - Xcode Overview
00:56
Tutorial - Xcode Debugging with Breakpoints and stack frames
09:00
Tutorial - Playgrounds Introduction
08:20
Tutorial - Adding Images to Playgrounds and UIView iPhone Screens
15:28
Tutorial - Add an Image to Xcode 6
02:49
Tutorial - Troubleshooting Playgrounds
06:03
14:53

I was wondering, how many apps will we have made at the end of the course? And what kind of apps will that be? - Nick

10-24 apps - based on code exercises and app challenges.

Right now the course is super flexible, so I'm going to make a list to get more suggestions for "simple" apps.

The types of apps are up to the class, what do you want to learn?

If it fits with the materials, we can probably do it, otherwise I’ll try and use it in one of my more advanced courses.

Post on the forum: http://forum.iphonedev.tv/t/app-suggestions-for-code-exercises/195?u=paulsolt

I am a total programming beginner, so this exercise completely threw me for a loop (and on Day 2! That was a tad discouraging :D)

I actually found the bonus part easier to understand and do than #1 or 2 because a) I have no idea what Double or Int numbers are, and

b) Even when I found the code examples on stack overflow I was unsure where to put them in my code or what ways I would need to alter them in order for the answer given there to fit into my project.

String and NSString examples given there sailed right over my head like the Swift bird. - Chris

Day 4+ will go into the programming details and explain everything. Right now I want you to be a little confused, that is the first step in learning.

You need to get the big picture, which is the point of the first several days. Now that you see at a high-level, how an app works, I can start explaining the programming concepts, without boring you.

The Code Exercises will challenge you to think, and discover the parts you don't understand. Post questions on the forum, search Google, and watch the upcoming videos on the basics.

I am feeling so depressed, Its my last year in school and i very bad at c++ ;( i am getting really bad grades in computer science. Paul help !! - Kyle

  1. Did you get the lesson code working?
  2. Grades don’t matter in the big picture. Learn and follow your passion, then your grades will follow.

Being bad just means you don't have enough practice or experience. Set some goals to learn something new in this course.

It takes time to learn something new, and you need to be ok with going outside your comfort zone. Explore, experiment, and write code.

I think it helps to have an end goal in mind. C++ doesn't provide a tangible way to show something in the same way that Swift does. Make apps, it's a lot more rewarding to see something you create, instead of a boring algorithm in C++.

Personally, I don't like traditional programming courses that only focus on theory (I don't like theory), I'm a hands-on practice type of person. I need to try to learn, theory is just ... theory.

am I okay? ivar: new term for variables in swift. -Aldo

Short name for "instance variable" which means that it's owned by the current object. Used in object oriented programming languages (OOP).

I am surprised to see Swift String class not contain default Float or Double conversion methods. Do you feel this is something Apple left out because of time, or because they wanted a lighter weight String class that only casted out to NSString when necessary.

The reason I ask is that it seems a String extension is ideal for adding the functionality based on my research, but that would then, as I understand, burden the String class with the functionality anyway. The other way is to do that inline, but that seems inefficient if you have to do it more than once, as is the case here. The other option I found is the bridgeToObjectiveC method, but that just seems like a terrible idea as if I wanted to be using ObjectiveC, I'd be using ObjectiveC. - Josh

Double and String

I agree, the lack of type conversions from String was very frustrating. I would recommend you submit a bug report to apple, requesting the additions.

I think it was a time constraint, since there were major issues in the first beta's that they have since resolved.

Fernando had a nice post on the extension, which would solve the problem. But that's an additional chunk of code you'd have to maintain and keep in a "Swift code library" that you use between projects.

Not great for beginners or people coming from Objective-C expecting a full solution, like in Objc.

Performance

Don't worry about performance now, that's a slippery slope that leads to in-action. The naive code approach is the best place to start. Xcode comes with Instruments, which is a performance tool to check what areas actually need to be optimized.

Optimization is always last.

I understood the demonstration of breakpoints and how you can create them...but I don't understand WHY one would use them. - Benjamin

You mainly use them when you're tracking down crashing app bugs.

If Apple rejects your app due to crashing, you have to try and reproduce the error and find it in code to fix it. Otherwise you can't sell the app. That means no money!

It's like searching for a needle in a haystack without a debugger app, and that's what Xcode is. Using Xcode's breakpoints you can isolate chunks of code to look for the bad line or lines of code.

It let's you get into the CPU's brain and see what is really join on. Seeing the state of an app (variables + method calls + flow) is very useful in a complex program.

Right now you're dealing with <100 lines of code, but think, how would you deal with 10,000 lines of code, or 100,000 lines of code. You can't possible keep all the code in your mind, so you need to look at certain parts and leverage tools to help you uncover the real problem.

Until you get to a situation where you have a bigger program, some of these topics won't make sense, but then when you do, you can come back and re-learn what you didn't fully understand.

Any software you recommend for designing UI? - Shashwat

I love pen and paper.

Otherwise use fluid.io or balsamiq.com

2.6 Auto Layout for Beginners - At 2m50s, I don't know how do this this. The label is moving. I don't see rules in green.

Create a connection with right mouse click, not left. Or 2 fingers on trackpad, or using Ctrl+Left-click and drag.

problem with changing the keyboard layout. I've taken a screenshot to show you what i have...and it looks nothing like what paul gets when he selects his text field inputs! -Miles

You accidentally hide the options. Click the "Show" text to the right of Text Field, on the top of the Utilities Panel.

Spend a minute or so explaining what each new method or function does

I am happy that we get on with it in the manner you are doing. What I would like is a recommended reference source where I can go to read about whatever we have been discussing.

For instance, is there reference material (in addition to the Help text that Fernando kindly pointed out) to read about animateWithDuration and its parameters where we can go to discover more? -John

Yes, I plan on getting more links and resources to supplement the materials. I'll make a note for my upcoming lessons.

just a quick word to let you know I love your lessons. I do have to pause the video quite often to write some code and catch up, but I think this is the way to go so everyone can do the lesson at their own pace. I found the Day 2 exercise challenging, I tried a bunch of code before finding something that worked, but was very happy when I did found a solution. I think it could be nice to have some quick feedback from you in the Q&A the next day, just a minute or 2 where you could tell us what was the most efficient approach and why. Thanks again. - Eloise

Great!

There are many approaches. Depending on the complexity, I might provide a solution, but many of the posted code examples seem to provide enough direction.

At the end of the day, the naive approach is always best. It doesn't have to be the fastest, it just needs to get the job done.

Fight less battles and get something working, that way you'll be able to ship an app.

May I ask why you don't build the user interface in the any-any size class? Apple recommends doing as much work as possible in that size class (said in "What's new in Interface Builder" from WWDC 2014). - Ludvig

I'll investigate that and make changes based on what I find works best for new videos.

Visually I find the large "canvas" unwieldy and hard to explain to beginners.

The course is more focused on iPhone apps to start, and I want to reduce complexity for beginners.

Code Exercise - Play with the Playgrounds
Article
Notebook Activity - What don't you understand?
Article
Section 5: Day 4
01:08

More videos coming on Variables and Types!

Sit tight!

-Paul

Lecture - Variables
06:35
Lecture - Types
04:50
Lecture - var and let Keywords
02:14
Tutorial - Strings and Characters
06:23
Tutorial - Int and Double Numbers
05:46
Tutorial - Tip Calculator App Introduction
01:23
Tutorial - Create the Tip Calculator User Interface (UI)
09:32
Tutorial - Connect Interface to Code in the Tip Calculator
02:58
Tutorial - Auto Layout for the Tip Calculator
11:46
Tutorial - Tip Math Logic Makes the App Work
06:10
Tutorial - Finding Methods and Currency Number Formatting
14:06
01:02

What's my tip?

1. Add a custom tip percentage field and use Double values.

2. Add a UISlider to your app to control the tip percentage. Google "UISlider tutorial Swift"

3. Group tips: what do I owe? Add a text field to input multiple people to split a bill. Add output labels to display what each person owes (even split).

Questions

1. What is the difference between the following two lines of code?

   	var x = 1 / 3   	var y = 1.0 / 3.0   	

2. What's a constant variable?

3. Declare a constant called PI and assign it the value 3.14159265359.

4. How much memory does an Int or a Double use?

Solution

Share your code or ask questions on the Day 4 solution forum post.

13:05

I re-open my AreaCalculator app this morning before beginning day 4 lesson and all elements have disappeared from the Storyboard.

I can still build the app and everything is wording on the simulator, but I can just find how to show the UI elements again.

All items are greyed out in the document outline too. - Eloise

This is because in the Area Calculator we chose the "w Compact h Any" size class.

In Day 4's UI Design I show how to make it work for Any x Any, which is that initial screen you see.

Select the bottom text and make the rectangle look like an iPhone (2 vertical left rectangles).

numberFormatter.numberStyle = NSNumberFormatterStyle.DecimalStyle

if let amount = numberFormatter.numberFromString(amountTextField.text) as? Double

Last word (for those who have read so deep ) as i have already done in the Day 2 exercise i didn't use the as NSString thing to go from string to double because it doesn't caught exception and could lead to funny errors like - Alexandre

http://forum.iphonedev.tv/t/swift-1-day-4-code-exercise-solution/197/8

… 1o3 will become just 1, not 1

numberFromString(amountTextField.text) as? Double

textfield... float not mixing with int not mixing with double etc etc etc. Seems so simple to calculate this... but couldn't figure out the right syntax. - Eloise

Swift unlike other programming languages requires that you explicitly set the types.

We discussed types a little bit yesterday. Basically Swift won’t allow you to add a Movie to a Picture, unless you make the operation explicit.

It’s to prevent errors, but it can be confusing for beginners. Do something like the following line

var result = Double(amount) + Double(tip10)

Looking at examples from others I still don't understand those 'return' or ‘refresh’. - Eloise

Text field sends messages every time the user types.

Apple provides “hooks” into those messages using the Delegate Design Pattern (delegate objects).

It’s like delegating a job at work to one of your colleagues, except in code we can let specific code files handle the work.

References

https://developer.apple.com/library/ios/documentation/general/conceptual/DevPedia-CocoaCore/Delegation.html

Actually kinda fun playing around in here and seeing immediate results / updating in the window without rerunning.

Sorry, I type my question wrong. I mean why you put both function outside of ViewDidLoad function. - Jayden

You want to put functions out side other functions to make them available to use throughout the code file.

Put them within the { } from the class declaration at the top.

Tip Calculator Auto Layout Problem and Solution
10:03
Section 6: Day 5
01:10

Update: There are 7 new lessons to help you understand why you need arrays, loops, and how to use touch input.

Learn how to work with arrays, loops, and the pan gesture.

Let me know if you like today's format, and the App Challenge.

Lecture - You can learn anything
01:28
Lecture - Make an Array Word List
10:59
Lecture - Use the for loop
10:04
Lecture - Display a UIView and Label in Playgrounds
12:36
Lecture - Multiple Labels using Loops and Random Numbers
09:07
Lecture - Transition from Playgrounds to iPhone App
02:44
Lecture - Pan Gestures for Dragging and Moving Labels
14:04
07:35

Layout (constraints) not working as I wished. I failed to get the tip fields to fill the seen as Paul showed. I even went back to follow step by step what Paul had done - still no joy. I guess that this is an art rather than a science, and I am no artist ;-). I will keep working on it -John

I’ll put together more tutorial videos on Auto Layout, since it is hard. If you mess up a connection, it can mess up the entire interface.

Cannot get labels to expand like Paul, instead it shows the orange - Miles

Auto Layout is tricky to get right. If you make an “invalid” connection it can throw off the UI.

There’s a button (3rd) from the left in the bottom of the canvas. Press it and you can make a view Update it’s frame (The UI element will move) or it’s constraints (the orange lines will update based on new position)

Both of these operations can be undone. Experiment updating the UI.

I filmed two new videos, watch them and see if they help you figure out your auto layout problems.

Watch: 4.14 Tip Calculator Auto Layout Problem and Solution - http://learn.iphonedev.tv/lecture/103431/414-tip-calculator-auto-layout-problem-and-solution

Watch: 8.12 Bug Fix - Number Guessing Game - Auto Layout Issue and Solution - http://learn.iphonedev.tv/lecture/103434/812-bug-fix-number-guessing-game-auto-layout-issue-and-solution

The system stubbornly displayed in $, in spite of my being in UK. I had understood that it understood localizations. - John

Read about it more here:

Apple Guide: https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/InternationalizingLocaleData/InternationalizingLocaleData.html

NSHipster on NSFormatters: http://nshipster.com/nsformatter/

Overview of Localizing an app: http://engineering.hoteltonight.com/the-nitty-gritty-of-ios-internationalization-and-localization

Menu item under Editor > Execute Playground will re-run everything bringing back a console if you coded one - Glenn

Great! But there’s no default hotkey.

I have managed to set it up so I can enter a new word through the screen, this is added to the array, and the array is re-displayed with the added word.

However, I cannot find out how to wipe the old words off, so I finish up with them duplicated. A hint would be appreciated - even if only what to search for in Google. -John

Do you want to remove words?

  1. Remove it from the super view... use a tap gesture, get the view, and then ask it to remove itself from the superview.

i.e. Search “remove subview from view”

UIView https://developer.apple.com/library/IOs/documenta...

Code Sample http://stackoverflow.com/questions/4690391/does-u...

2. I showed you how to create the list in the viewDidLoad, but that wordArray won't persist outside the viewDidLoad method. You'd have to create a property, and store the wordArray with the ViewController class. (we'll learn about this more in a future lesson)

https://developer.apple.com/library/ios/documentation/swift/conceptual/swift_programming_language/Properties.html

I have tried learning this in several other ways and I have never been able to get as far as we already did on week one.

My only suggestion is that if possible you start including other controls on the examples. Like segmented controls, switches, etc. As an example I am very curious how would I do an equivalent to a drop down menu. -Ed

Awesome!

I’m looking for input on what you want to learn, thanks for concrete control examples.

Feel free to suggest Code Exercises that might use one of these controls.

Suggestions for upcoming Code Exercises: http://forum.iphonedev.tv/t/app-suggestions-for-c...

Do you have anything you would recommend around guidelines around how an iOS application framework should be set up. For example; I am assuming that code organization/modules would would different for a game vs a social media application. Any guidance would be appreciated. Thanks! - Richard

Right now you don't have many code files.

It generally start creating groups for related files, especially different screens. However it really depends on how you want to organize.


I think it's important that your organization doesn't get in the way, so do the naive approach for now and keep it all in one group. Look at how other open source projects organize their code, art, etc. Make sure you can quickly find the files you need to work on, that's the important part.


For my apps I generally have a Code, Resources (images, etc), and Dependencies (open source) folder.

thank you for this. Can I assume that the 'view' is the whole screen, and the 'subviews' in this case are the individual words on the screen? - John

Yes, that’s a good mental model. The view is a 2D canvas that you can put objects on.

You can also create your own views and create custom compositions or embedded controls.

A friend of mine has played a lot with the app, and was wondering if it could be published ...

I had 2 questions about that, do you think it has a sufficient level of quality to be published ? -Alexandre

It doesn’t hurt to get your app on the App Store. Try and publish your app if you’re happy with it. We can work through any issues to get it on the App Store.

If you’ve built a working app, try and sell it. It’s a learning experience to get your first iPhone app out there.

I got lost and downloaded the zip file. but when i open it i don't see any interface in the main storyboard. its just blank page and its also big. but when i click the use size classes, than i see some stuff up top left corner. but when i run the app it works fine. how do i make it so it looks good again in the main storyboard? -Daniel

The UI disappears when you open an existing project that didn’t set any UI for the Any x Any size class. You’ll have to select the Compact X Any size class to see it again.

Alternatively, you should see the UI elements in the left panel (Document Outline), click on them and you can “Install” them into the Any x Any size class.

it may be cool to give a sort of visual introduction to arrays for folks not familiar with the concept. With this you could show how what happens when things are added, deleted, inserted, etc...Great stuff so far! -Richard

perimeterButtonPressed

fatal error: unexpectedly found nil while unwrapping an Optional value

Make sure to reconnect any outlets. If it crashes with this error, on a value that’s not suppose to be optional, it means (implicitly optional) it means that your connection is bad.

Lecture - Image Backgrounds for Apps
08:54
Code Exercise - Design UI for a Weather App and Photo File paths
Article
Section 7: Day 6 and Day 7 - 1st App Challenge
00:58

Design a multitouch app that uses the Pan Gesture to move text labels around the screen.

iPhone meets Magnetic Poetry.

Add Features

  1. Add custom words in-app (UITextField user input)
  2. Hide the keyboard after typing a word and pressing Return
  3. Add buttons to change text or background colors
  4. Add images with UIImageView
  5. Advanced: Throw the labels using physics animations and the velocity of your finger.

Show the App to a Friend

See if your friends or family have ideas for cool features.

Solutions and Screenshots

Share your code or screenshots from your Word Magnets app.

Questions

  1. Did you pick a theme for your word list?
  2. What phrases did you make?

References

Magnetic Poetry: http://www.amazon.com/Magnetic-Poetry-3000-Origina...

Tutorial - App Flow with App Delegate and ViewControllers
07:01
05:39

Browse the Top Word Magnet Apps

These apps were built over several days and already show a ton of promise. Another week or two and they'll be ready to submit to the App Store as fully functional apps.

Solutions and Screenshots

View code or screenshots from the Word Magnets App Challenge.

Top Submissions

I'll highlight the top submissions from the course, so that you can see what can be done, and the process into getting to that point. Share your code, screenshots, sketches, and videos of your app with the class to get featured.

1. Casual Poet - Alexandre

2. Magnetic Word App Challenge - Fernando

3. Word Magnets app - Eloise

4. Dan

5. Alphabet Magnets - Rajee

Play with letters instead of words, awesome job!

Suggested Reading: Animation and UIDynamics

Creating fluid animations is a ton of fun and can make your app feel like it's ready for the App Store. Read this guide on using animations and UIDynamics in your apps to give it a physics feel.

http://omarfouad.com/blog/2014/08/02/getting-started-uikitdynamics-swift/

Section 8: Day 8
Lecture - Conditionals and Optionals
01:26
06:45
Today we'll be working with if/else statements, also known as conditional statements.
Tutorial - Conditional Code
02:55
Tutorial - Greeting App
07:45
Tutorial - Greeting App with Current Hour from NSDateComponents
05:22
Lecture - Optionals
03:18
Tutorial - Optionals in Code
03:48
Tutorial - Optional Force Unwrap
06:01
Tutorial - Optional Binding with if statements
04:19
02:28

Guess My Number

Create a number guessing game using if/else statements. The iPhone app will pick a random number between [1, 100] and the user will have to guess the value.

Each time the user guesses, the app will display a message informing the user is above, below, or if they won.

Add two buttons, one to guess a number from the UITextField, and one to Reset the game (clear the UITextField and pick a new random number).

Extras

1. Customize the UI app design using background images or a minimalist color layout.

2. Add additional Witty Messages to inform the user they are super far away, or completely wrong. "Way off, try again..." or "Nope, my number isn't 42, it's a lot bigger"

3. Proximity messages - inform the user they're very close ... within 2 of the correct answer.

4. Respond to invalid input with a funny message. "That's a number I've never seen before..."

Solution

Post your questions, solution code, and screenshots on the Day 8 Solution post.

Code Exercise - Number Guessing Hints
07:07
09:33

App Challenge Results

http://learn.iphonedev.tv/lecture/100342/70-app-challenge-top-student-apps-and-solutions/

Videos from first week were great. A lot more content that I was expecting and this is a good thing. The code was great as well but for more experience people, as I said earlier an easy version and an advanced version would be awesome. - andersson

Great, I’ll try and provide some “extras” at various difficulty levels.

Can you update the code solution for the Word magnet challenge based on day 5 code that you made?

Yes please because i still have problems how to take the user input and add it to the array - andersson

First I would look at solutions that other students post. If there is enough feedback I’ll put together videos highlighting an approach.

what is the purpose of optional binding? Can you explain what are the real application for optional binding? Is this concept important? -Jason

You’re going to see it in a lot of code projects. It reduces the number of lines of code and makes it so you can use the temporary variable without force unwrapping.

If the expression is invalid, it’ll skip over, which allows you to provide better error handling and failure recovery in your apps.

Hey Paul, I have a question about how I can use the auto-layout with the labels that are added through code. Jordan

Yes, but it’s UIConstraints in code is a mouthful. For now I’m not going to recommend you use Auto Layout on content that can move around by the center position. I may talk about it constraints in code later in the course, but not yet.

I’ve done it, but it’s a pain and requires a ton of code to make it so that it works. You’d need an extra UIView to pin each moveable word to, so that you can offset it’s (x,y) access.

You are better off calculating the relative position based on the screen size, and then shifting the positions of all the labels when you rotate.

That’s what I did in Photo Table. https://itunes.apple.com/us/app/photo-table/id455322208?mt=8

For example, I am running simulator in iPhone 6 mode, the words all seem to appear using our copied playground code with the random 320x480 location. But when I rotate I lose some. Thoughts on this? I suppose that in a word cloud this might not make sense because when you rotate you would lose sentences. Maybe prevent rotation through the app settings screen? -Jordan

Yes you can prevent rotation lock. Google rotation lock iOS.

I’ll create a video on how to prevent rotation

Also, is there a way to dynamically read what device/resolution the current device is so that the random numbers can be placed according to device for the center of the word labels?

Get the screen size using:

println(UIScreen.mainScreen().bounds)

var width = UIScreen.mainScreen().bounds.size.width

var height = UIScreen.mainScreen().bounds.size.height

println("W: \(width) H: \(height)”)

Using a SegmentedControl to let user choose background color of view for word magnet. Then looked up the code for the delegate on selection changed and was able to pull out the selectedSegmentIndex and then the value of the control with the titleForSegmentAtIndex command. However, this comes out as an optional value. Can you explain what that means? When I ran that title through a switch statement, received an error that said "Value of optional type 'String?' not unwrapped, did you mean to use a '!' or '??'. I put a '!' after the variable at the start of the switch and it worked. But just curious what that means. - Jordan

Watch the Day 8 material on optionals and force unwrapping.

It's part of the language and it's to help prevent you from writing bad code. It also makes it easier to find the line number where the code is bad, instead of trying to hunt for it using the debugger.

It seems that I am creating a'logical' screen that is a different size to the physical one. That is, I locate, on the storyboard, my items, and centre them etc. They look fine on the screen, but when I run them in the simulator, they are off to one side - the logical screen on the simulator seems to be wider than the physical one that the simulator is displaying. Can you touch again on how to make sure that these things are synchronized. I thought that the Auto-alignment should take care of this, but it seems that I am doing something wrong - John

If you see blue rectangles and lines, that means you’ve set up all the constraints so that the position of the UI element is what Xcode expects.

Otherwise if you see red or orange, it means you have a layout problem.

If red, one of the rules you made conflicts with a different rule, so Xcode will break one of the rules to make it so that it can display the app.

If orange, you haven’t given enough information to Xcode to display the UI element in the correct spot. It’ll display the UI element off to the side or it won’t work in all orientations (Command + Right Arrow)

Can you please explain how the ViewController application runs through its coding, and how it arranges itself. I assume that there is a header somewhere to set up variables, then there is a body that is run after e variables are set up, then there are some functions that may be called (or not), and possibly something that is run at the end? Can you give us a picture of how this flow works -John

I’ll get more into this in later in the week.

viewDidLoad() is a starting point for UI creation in a ViewController (screen manager) class.

there are also init() methods that get run first with any Object

More details in a future lesson.

Bug Fix - Number Guessing Game - Auto Layout Issue and Solution
18:38
Notebook Activity - Conditionals and Optional Variables
Article
Section 9: Day 9
Lecture - Functions
01:07
Lecture - Functions and Parameters
07:01
Lecture - Functions and Return Values
05:51
Lecture - Functions Calling Functions - Code Composition
06:19
Tutorial - Functions vs Methods
06:01
Tutorial - Function Parameter Names
05:46
Code Exercise - Turkey Cooking Calculator
Article
Notebook Activity: Functions
Article
Section 10: Day 10
Lecture - Objects
00:51
Lecture - Objects in Swift
05:52

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Paul Solt, iPhone App Expert

Howdy, I’m Paul! I have a master's degree in Computer Science from Rochester Institute of Technology and I used to work for Apple.

After working at Apple, I decided that I wanted more freedom. I started my own app company and followed the money (you can too!). Instead of reporting to a boss – I set my own hours and enjoy my work.

I’m passionate about teaching around the world – most recently I taught high school kids in Athens, Greece how to make iPhone games (technology skills have their perks!). People all over the world use my courses to jump-start their careers into iPhone apps.

You wouldn’t believe the opportunities, freedom, and jobs that iOS development opens to you. Sign up and find out for yourself why so many people are taking my iPhone app courses.

I believe my courses provide the most complete and comprehensive background for any beginner or experienced developer. If you don’t agree I will happily refund your money.

Sign up for the Swift and iOS 8 Apps in 31 Days course and join me on an amazing adventure to the App Store.

Ready to start learning?
Take This Course