Affordances

Affordances
-right size
-flip it
-throw it
-hide behind it

conceptual model
signified

most interesting solution comes out most interesting question.

good conceptual model <-> inaffective conceptual model

Quantitative:Quantitative data are things you measure as numbers such as temperature, money, and the number of scratches from your cat. You can split quantitative data into two groups, continuous and discrete.

Qualitative:Qualitative data is descriptive information about things that can’t be quantified with numbers, like male/female and hair color. These are categorical data, data that indicates belonging to a category or group. Often you’ll want to group your data by the categories and compare them.

Representing data with visual elements
Dots, Lines, Bars, Color

function

func averageScore(firstScore: Double, secondScore: Double, thirdScore: Double){
	let totalScore = firstScore + secondScore + thirdScore
	print(totalScore/ 3)
	}
func nameOfFunction(/* parameters */) -> Type {
	var valueToReturn: Type
	return valueToReturn
}

func calculateTip(priceOfMeal: Double) -> Double {
	return priceOfMeal * 0.15
}

func isValidLength(password: String) -> Bool {
	if password.characters.count >= 8 {
		return true
	} else {
		return false
	}
}

func calculateTip(priceOfMeal: Double -> Double{
	return priceOfMeal * 0.15
	})

let priceOfMeal = 43,27

let tip = calculateTip(priceOfMeal: priceOfMeal)

what’s string about

let theTrueth = "Money can't buy me love."
theTruth.characters.count

var forwardString = "spoons"
var charactersReversed = forwardString.characters.reversed()

for character in charactersReversed {
	print ("\(character)")
}

let similarTruth = "can't buy me"
var birthdayCheer = "Happy Birthday!"
print(birthdayCheer)

var name = "Kate"
var customizedBirthdayCheer = "Happy Birthday, \(name)!"
print(customizedBirthdayCheer)
var doggyDiet = "Mia eats 10 lbs of dog food per month."

var dogName = "Zebedee"
var lbsPerMonth: Double = 25

doggyDiet = "\(dogName) eats \(lbsPerMonth)lbs of dog food per month"

print(doggyDiet)

var kilosInALb = 0.45
var metricDoggyDiet = "\(dogName) eats \(kilosInALb * lbsPerMonth)kilos of dog food per month"

print(metricDoggyDiet)
let monkeyString = "I saw a monkey."
let thiefString = "He stole my iPhone."

var monkeyStringWithEmoji = "I saw a *."
var thiefStringWithEmoji = "He stole my *."

var forwardString = "time"
var charactersReversed = forwardString.characters.reversed()

for character in charactersReversed {
	print("\(character)")
}

let numOfPennies = 567
let dollarInt = numofPennies/100
let dollarsAndCentsString = "$\(dollarInt).\(numOfPennies % 100)"

let monkeyString = "I saw a monkey."
let thiefString = "He stole my iPhone."
var sillyMonkeyString = monkeyString + "" + thiefString

replacingOccurences(of: with:)

sillyMonkeyString.contains("key")

Different types of variables

var petsAge = 12
var myMiddleInitial: Character = "A"
var numberOfWheels: Int = 4
var centimetersOfRainfall: Float = 5.5
var pi: Double = 3.14159265359
var letterOfTheDay: Character = "z"
var myFavoriteAnimal: String = "nudibranch"
var rainingOutside: Bool = true
let encouragement = "you can do it!"
var customizedEncouragement = "you can do it, stephanie!"
customizedEncouragement = "you can do it, Ryder!"

let birthYear = 2008
var currentYear = 2017
var age = currentYear - birthYear
currentYear = 2017
age = currentYear - birthYear

Names cannot contain whitespace characters, mathematical symbols, arrows and [a few other obscure characters].
Names must begin with an uppercase or lowercase letter A through Z, an underscore, or [a few other less common options].

let theTrue = "Money can't buy me love."

var characterPoorString = ""
let stringWithPotential = String()

Sandbox

// test code here!
print((200 * 7)/2)

print("hello from iOS team")

var question = "Ready to write your first lines of Swift code?"
print(question)

var response = "Yeah! I'm ready!"
print(response)
var numberOfServingsForRecipe = 4
var desiredNumberOfServings = 8

var servingsFactor = desiredNumberOfServings/numberOfServingsForRecipe

var poundsOfTomatoesForRecipe = 2
var amountToUseToday = poundsOfTomatoesForRecipe * servingsFactor

print(amountToUseToday)

Drawing to code

step1: select the views
step2: position the views
step3: style the views

what view group should you use
-LinearLayout
-RelativeLayout : relative positioning, overlap

The drawable folder
android:src=”@drawable/androidparty”

Position the view
Style the view

Trouble shooting

android studio strouble shooting
https://docs.google.com/document/d/1w1Xn_hnSAODAAtdRDp7haYPBtEwX_l7Htpf8Wpgbu6w/pub?embedded=true

Linear layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:paddingBottom="@dimen/activity_vertical_margin"
	android:paddingLeft="@dimen/activity_horizontal_margin"
	android:paddingRight="@dimen/activity_horizontal_margin"
	android:paddingTop="@dimen/activity_vertical_margin"
	tools:context="com.xxx.myapplication.MainActivity">

	<TextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:text="Hello world!" />
</RelativeLayout>

Relative Layout

top edge, left edge, right edge, buttom edge
relative to parent

android:layout_alignParentTop=”true”
android:layout_alignParentBottom=”false”
android:layout_alignParentLeft=”true”
android:layout_alignParentRight=”true”

<RelativeLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:padding="16dp">

	<TextView
		android:text="I'm in this corner"
		android:layout_height="wrap_content"
		android:layout_width="wrap_content"
		android:layout_alignParentBottom="true"
		android:layout_alignParentLeft="true" />

    <TextView
        android:text="No, up here"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true" />
 
    <TextView
        android:text="Wait, I’m here"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true" />
 
    <TextView
        android:text="Actually, I’m here"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true" />

</RelativeLayout>

Simple image view

<ImageView
	android:src="@drawable/cake"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:scaleType="center"/>
<ImageView
	android:src="@drawable/cake"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:scaleType="centerCrop"/>

textView android, use google search
https://developer.android.com/reference/android/widget/TextView.html

capitalize

<TextView
	android:text="Oh the possibilites of TextView"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:textSize="36sp"
	android:textAllCaps="false"/>

LinearLayout

<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content">

<TextView
	android:text="I'm a lonely TextView"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content" />

<TextView
	android:text="I'm a lonely TextView"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content" />

</LinearLayout>

android orientation
https://developer.android.com/reference/android/widget/LinearLayout.html

200dp, wrap_content, match_parent

wrap_content

<TextView
	android:text="wait, today's your birthday?"
	android:background="@android:color/darker_gray"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content" />

font size

<TextView
	android:text="wait, today's your birthday?"
	android:background="@android:color/darker_gray"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:textSize="56sp" />

appearance

<TextView
	android:text="wait, today's your birthday?"
	android:background="@android:color/darker_gray"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:textAppearance="?android:textAppearanceSmall" />

google design spec style color
https://material.io/guidelines/style/color.html

text color and background color

<TextView
	android:text="wait, today's your birthday?"
	android:background="#ECEFF1"
	android:textColor="#616161"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:textAppearance="?android:textAppearanceSmall" />