dwyl / learn-apple-watch-development

:green_book: Learn how to build Native Apple Watch (+iPhone) apps from scratch!
55 stars 5 forks source link

Developing iOS9 Apps with Swift - Standford iTunesU #10

Open sohilpandya opened 8 years ago

sohilpandya commented 8 years ago

Apparently, these are some of the best lectures on Swift and iOS development, might be worth investing time into it.

Its free!

sohilpandya commented 8 years ago

The first lecture is 1 hr 17min, but giving myself 2 hours to go through it, will post the outcome below

sohilpandya commented 8 years ago

In chapter 1, the student is taken through the process of building a calculator.

pre req

Things we'll learn in this course

Note that I have done next to no programming for iOS, I am a JavaScript developer

What's in iOS?

1. Core OS 2. Core Services
screen shot 2016-11-01 at 11 51 02 screen shot 2016-11-01 at 11 51 41
3. Media 4. Cocoa Touch
screen shot 2016-11-01 at 11 59 53 screen shot 2016-11-01 at 12 00 11

Things we'll learn in lecture 1

Create a Project

1. select new project 2. select type of application
1 2
3. select project name 4. voila!
3 4

Xcode screen layout

screen shot 2016-11-01 at 12 37 55

Setup Provisioning by registering an Apple ID

screen shot 2016-11-01 at 12 43 57

Known Issue If you are having trouble connecting your phone or Xcode showing an error message like such: screen shot 2016-11-01 at 12 50 12 Then please select your iPhone from the dropdown list shown here:

screen shot 2016-11-01 at 12 50 37

This will solve the issue Known Issue

ViewController.swift is our controller & Main.storyboard

Model

View Main.storyboard

Controller ViewController.swift

Interface Builder: In iOS you don't code the visuals, just drag and drop them (wire them onto the logic afterwards)

Our first Button

screen shot 2016-11-01 at 14 24 27

But nothing happens when we click the button :cry:

Connect the button to from the UI to the controller by creating a method

Create your layout for the calculator

screen shot 2016-11-01 at 14 48 28

Now print the digit that you are selecting

screen shot 2016-11-01 at 15 00 36

HINT

What the hell is Optional?

String? //Where this is an optional with the associated value being a string

So how do we get the associated value? By Simple putting an exclamation mark at the end.

let digit = sender.currentTitle!
The console is now logging the correct digit that is being clicked by the user.
screen shot 2016-11-01 at 15 12 45

Add a Display to the UI

Get rid of the trailing zero

HINT

Create our first Operation Key

screen shot 2016-11-01 at 15 38 24

You've built your first ever kind of functioning calculator using swift on iOS! 🎉

sohilpandya commented 8 years ago

This Excercise has taken me 6 Pomodoro's instead of 4. So the task has taken me an hour longer than I expected.

Reasons

I am not happy with the above as it is quite a lot, It should be a lot more condensed than this. What do you think? @nelsonic

Review