## cs193p – Project #1 Assignment #1 Task #3

Please note, this blog entry is from a previous course. You might want to check out the current one.

Add the following operations to your Calculator:
a. sin: calculates the sine of the top operand on the stack
b. cos: calculates the cosine of the top operand on the stack
c. π: calculates (well, conjures up) the value of π. For example, 3 π × should put three times the value of π into the display on your calculator. Ditto 3 ↲ π x and also π 3 ×.

Change the empty labels of the three buttons on the right hand side to “sin”, “cos” and “pi”:
Continue reading “cs193p – Project #1 Assignment #1 Task #3”

## cs193p – Project #1 Assignment #1 Task #2

Please note, this blog entry is from a previous course. You might want to check out the current one.

Your calculator already works with floating point numbers (e.g. if you touch 3 ↲ 4 ÷, it will properly show 0.75), however, there is no way for the user to enter a floating point number directly. Fix this by allowing legal floating point numbers to be entered (e.g. “192.168.0.1” is not a legal floating point number!). You will have to add a new “.” button to your Calculator. Don’t worry too much about precision or significant digits in this assignment.

In Storyboard change the currently blank label of the bottom left button to “.”:
Continue reading “cs193p – Project #1 Assignment #1 Task #2”

## cs193p – Project #1 Assignment #1 Task #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

Get the Calculator working as demonstrated in lectures 1 and 2. The Autolayout portion at the end of the lecture is extra credit, but give it a try because getting good at autolayout requires experience. If you do not do autolayout, be sure to position everything so that it is visible on all iPhones (i.e. the upper left corner of the scene).

I finished this task already during the lectures, including lecture #3. For convenience sake (mostly mine) I will base the follow tasks on the code from the end of lecture #3.

The complete code for the task #1 (different branches for end of lectures #1, #2 and #3) is available on GitHub.

## cs193p – Project #1 Reading Assignment

Please note, this blog entry is from a previous course. You might want to check out the current one.

The first part of the first project is an reading assignment of the Swift Programming Language.

The following sections are very important and need to be read very carefully:

## cs193p – Lecture #3 – Applying MVC

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #3 continues the calculator demonstration, adding the model to the MVC pattern. In addition he shows how to use

• enums,
• simple initializers,
• returning optionals,
• dictionaries,
• and tuples.

The lecture is available via iTunes named “3. Applying MVC”. The code for the demo is available on GitHub.

## cs193p – Lecture #2 – More Xcode and Swift, MVC

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture #2 continues with the demonstration from the previous lecture showing:

• how to use arrays,
• computed properties,
• the conditional statement switch,
• functions as types,
• various combinations of closure syntax defining functions “on the fly”,
• method overloading – same method name, different arguments,
• and more Autolayout.

## cs193p – Lecture #1 – Logistics, iOS8 Overview

Please note, this blog entry is from a previous course. You might want to check out the current one.

Like every year lecture #1 is an general introduction of the course with an overview about iOS, MVC and this time the Swift.

… and again Paul Hegarty stresses the importance of being familiar with object oriented programming as prerequisites for the course and that it is not for absolute beginners.
Continue reading “cs193p – Lecture #1 – Logistics, iOS8 Overview”