CS333

Mobile Development


Ilya Loshkarev
loshkarev.i@gmail.com

Layers of iOS

Stack of Frameworks

Fro low-level access to high-level abstractions
Cocoa Touch
Media
Core Services
Core OS
  • Darwin Kernel
    Concurrency, Networking, File-system
  • Security
    Encription, Certificates, Keychain
  • Accessory
    Bluetooth, Attached hardware communication
  • Accelerate
    Signal processing, Linear algebra
Cocoa Touch
Media
Core Services
Core OS
  • Foundation
    Collections, Threads, Socket communication
  • Core Data
    Internal database storage system
  • Core Media
    Low-level media data access
  • Core Location
    Positioning and compass
  • Core Motion
    Motion-data access
Cocoa Touch
Media
Core Services
Core OS
  • Core Graphics
    Low-lewel drawing
  • Core Animation
    Low-lewel animation
  • Core Image
    Image manipulation
  • AV Foundation
    Recording and playback of audio and video
  • Advanced graphics
    OpenGL, Metal, SceneKit, SpriteKit
Cocoa Touch
Media
Core Services
Core OS
  • UIKit
    • Lifecycle mangement
    • UI managment
    • Multitasking
    • Notifications
  • App Extensions
    Calling an app from within another app
  • Notification Center
    Showing custom data in notification center
Cocoa Touch
Media
Core Services
Core OS

App Life Cycle

App Bundle

  • App Executable
  • UI files
  • Stored Images
  • Localization Resources
  • Temporary Files
  • Cache

Execution States

  • Inactive – app is executed but cannot recieve any events.
    Usually right after launch or coming from background
  • Active – app is up and running
  • Background – app is finishing it's tasks ready to get closed. Usually right after being switched out or turned off
  • Suspended – app is not running and can be terminated by the system without any warning

Allowed Background Tasks

  • Audio Player/Recorder
  • Location Updater
  • VoIP Listener
  • Accessory Listener
  • Background Downloader
  • Push Notification Listener

Background task must be declared in app preferences

App's Limits

  • Sandbox FileSystem
  • 250/500MB RAM
  • Workflow Guidelines
  • User Permissions

Model View Controller

Model

  • Stored Files
  • CoreData Objects
  • Custom Classes

Describes data and it's relations

View

  • .Xib Files
  • Storyboard Views
  • Code-generated Views

Provides interface for data and user actions

Controller

  • AppDelegate Subclass
  • Storyboard Segues
  • Layout Constrains
  • ViewController Subclasses

Describes possible actions and reactions to events

App Delegate

UIApplicationDelegate

Provides custom handlers for system events
Handles basic app operations
Stores main window of the app

UIWindow

Root view of the application
Stores View Stack

App Launch

Simple App


						@UIApplicationMain
						class AppDelegate: UIResponder, UIApplicationDelegate {
							// Create new UIWindow
							var window: UIWindow? = UIWindow(frame: UIScreen.mainScreen().bounds)

							func application(application: UIApplication,
								didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
								// Create root ViewController
								window!.rootViewController = UIViewController()
								// Set window to handle input and show it
								window!.makeKeyAndVisible()
								return true
							}
						}
						

Storyboards

Scenes

A scene represents an onscreen content area

Segues

A segue represents the transition from one scene
to the next scene

Designing with Storyboard

Storyboards allow to graphically lay out
the user’s path through your app

Storyboard vs XiB

.xib
  • Single scene
  • A file for every scene
  • Manual scene transition
Storyboard
  • Multiple scenes and segues
  • Can be slow and heavy
  • Not well-suited for collaborative development

Related Resources

Swift-logo