Transcript

Taking Control of Storyboard

Pitiphong PhongpattranontiOS Developer @ Throughwave@pitiphong_p

Benefits

Reduces a huge amount of codes

Decoupling your view/view controller from each other

Visualizing your views appearance

And also every scenes and transition at a glance(?)

Responsive UI Development

“มีแบบนี้ไหม ของเว็บหนะ”

–Designer ท่านหนึ่ง

Core Concept

Main.storyboard

Navigation ControllerNavigation Controller

TableView Controller

View Controller

root shows

Main.storyboard

Navigation ControllerNavigation Controller

TableView Controller

View Controller

root shows

Scenes

Main.storyboard

Navigation Controller

TableView Controller

View Controller

root shows

Segues

Main.storyboard

Navigation Controller

TableView Controller

View Controller

root shows

Relationship Segues

Main.storyboard

Navigation Controller

TableView Controller

View Controller

root shows

Triggered Segues

Terminologies

Document Outline

Canvas

Inspector

Object Library

Scene

Segue

Scene Dock

-[TableViewController shouldPerformSegueWithIdentifier:sender:]

Segue

-[TableViewController prepareForSegue:sender:]

Segue

Segue

Segue

Segue

Adaptability

Adaptability

Adaptability

Adaptability

IBDesignable/IBInspectable

Adaptability

override func viewDidLoad() { super.viewDidLoad() button.cornerRadius = 12 button.borderColor = .blueColor() button.filled = true }

Demo

Unwind Segue

Unwind Segue

protocol UserRegistrationControllerDelegate { func userRegistrationControllerWantToChangeUsername(controller: UserRegistrationController) func userRegistrationControllerWantToChangeUserDetail(controller: UserRegistrationController) func userRegistrationControllerDidCancel(controller: UserRegistrationController) func userRegistrationControllerDidFinish(controller: UserRegistrationController, userDetail: UserDetail) }

Unwind Seguefunc userRegistrationControllerWantToChangeUsername(controller: UserRegistrationController) { navigationController?.popToViewController(self, animated: true) } func userRegistrationControllerWantToChangeUserDetail(controller: UserRegistrationController) { navigationController?.popToViewController(self, animated: true) } func userRegistrationControllerDidCancel(controller: UserRegistrationController) { dismissViewControllerAnimated(true, completion: nil) } func userRegistrationControllerDidFinish(controller: UserRegistrationController) { // User Registration logic goes here dismissViewControllerAnimated(true, completion: nil) }

Unwind Segue

@IBAction func performUserRegistration(segue: UIStoryboardSegue) { // User Registration logic goes here } @IBAction func cancelUserRegistration(segue: UIStoryboardSegue) {} @IBAction func unwindToChangeUsername(segue: UIStoryboardSegue) {} @IBAction func unwindToChangeUserDetail(segue: UIStoryboardSegue) {}

Improvements in Xcode 7

Storyboard Reference

UIStoryboard(name: "Secondary")

UIStoryboard(name: “Secondary") .instantiateControllerWithIdentifier("tabBarController")

Customizing Standard Segue

Segue

Unwind Segues and Custom Containers

Q&A

Thank You