Course material
|
Mobile landscape
mobile vs. desktop applications
native vs. bybrid development
iOS vs. Android
market share, ease of development, profits vs. volume
iOS platform
iOS history
iOS architecture
Cocoa Touch, media layer, core services, core OS
mobile design guidelines
iOS design themes: clarity, deference, depth
iOS design principles
aesthetic integrity, direct manipulation, metaphors,
consistency, feedback, user control
general tips
minimize cognitive load, optimize user flow, cut out the clutter,
make navigation self-evident, design for interruption,
focus on first-time experiece, avoid annoying notifications
Swift programming language
released in 2014 (replacing Objective-C)
variables
let vs. var
scope - can have variable shadowing (override variable in new scope)
data types (Int, Double, Boolean, Character, String, ...)
fully type safe, type inferencing
expressions and operations
+, -, *, /, %, +=, -=, *=, /=, %= (no ++ or --)
==, !=, <, <=, >, >=
cannot have mixed types in an expression
Strings
+ operator, multiline strings using """, string comparison (==, >, ...)
fields: count
methods: lowercased, uppercased, contains, hasPrefix, hasSuffix
control statements
if, if-else, while, for, guard
specify ranges using ... or ..<
functions
internal vs. external names for parameters, default parameters
defining types
struct: generally used for data structures
can define fields private, but not common
can define methods, but usually only limited functionality
can define Init, but usually initialize fields directly
does not support inheritance
implemented as value type - makes copy when assigned/passed
class: generally used for full-blown objects
provide data hidig with private fields
provide functionality with public methods
provide Init to initialize fields
supports inheritance
must specify which methods override parent,
use super. to call methods in parent class
implemented as reference type - assigns/passes reference to object
enumerations
collections
Array
e.g., var names = ["Chris", "Pat"]
access via [], e.g., names[0]
fields: count
methods: append, +=, remove, insert
Dictionaries (maps)
e.g., var ages = ["Chris": 20, "Pat": 21]
access via []: names["Chris"]
fields: count, keys
note: collections are structs, so value types
optionals
used when value may or may not be present
unwrap using !, or if-let
optional type can be declared: String?, Int?, ...
Xcode & iOS UIkit
Xcode IDE
playgrounds vs. projects
IDE areas: editor, toolbar, navigator, debug, utility
utility area includes Object Library & Attribute Editor
Interface Builder is integrated into the editor area
UIKit
code framework for building iOS apps
UIView is the foundational class for displaying things
subclasses: UILabel, UIImageView, UITextView, UIScrollView
UITableView, UIToolbar, UINavigationBar, UITabBar
UIControl defines control elements
subclasses: UIButton, UISegmentedControl, UITextField,
UISlider, UISwitch, UIDatePicker
Single View App template
ViewController.swift: controls the behavior of the app
Main.storyboard: defines the UI for the app
Common tasks
add a UI element: drag from object library onto storyboard
create an action: control-drag from UI element to ViewController
adds a method associated with the specified action
create an outlet: control-drag from UI element to ViewController
adds a fields associated with that UI element
app layout:
center elements using Add New Alignmewnt Constraints
fix size and position relatively using Add New Constraints
group elements horzontally or vertically using stack views
segues:
each screen in an app has its own ViewController
transition from one view to another by connecting the controllers
can select the presentation method
can add navigation controllers to control destination
|