Skip to content

Latest commit

 

History

History
114 lines (74 loc) · 3.72 KB

File metadata and controls

114 lines (74 loc) · 3.72 KB

#Swift Intro Video

###Constants and Vars

####Type inference no need to specify type

###String

  • collection of characters, can use a for in loop to iterate over characters
  • can combine strings and characters

####Building Complex Strings

  • interpolations

####Array and Dictionaries

  • can work with any type, don't have to be objects or clas types
  • Collections are typed collections. Can provide a type annotation to specify only accepts strings.

##Loops ###Create and modify collections ####For-in loop

  • characters, strings, ranges 11:51, arrays, dictionaries

####Modifying an Array

  • Nothing is represented by nil

###If Statements 21%20AM.png

  • optional parens
  • braces required

###Switch Statements

  • must supply default case. either a case for every value or a default.

##Functions

Returning Values

###Tuples

  • usefule when u want to pass around multiple values simply like when a function returns multiple values

  • u get at those values with a constant

  • for each iteration of the dict you get a tuple pair

####Another wayt o get values:

##Closures

  • no need to specify types

  • functions are named closures in Swift

##Classes

  • no header files
  • no base class required, can use NSObject for ex if you want

  • would be let instead of var if you don't want to change it later on
  • stored and computed properties 30:52
  • computed properties, even read-only ones do need to be defined as variables

####Initializer Syntax

No more alloc!

  • won't need an initializer if you had supplied a default value

####Dot Syntax

####Class initialization

  • see intermediate talk

####Adding Methods to Functions

####Property Observers

left off at 36:10