• Save
Session 7 - Overview of the iOS7 app development architecture
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Session 7 - Overview of the iOS7 app development architecture

on

  • 347 views

 

Statistics

Views

Total Views
347
Views on SlideShare
346
Embed Views
1

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 1

http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Session 7 - Overview of the iOS7 app development architecture Presentation Transcript

  • 1. iOS Application Development
  • 2. Overview of the iOS 7 Application Development Architecture These are confidential sessions - please refrain from streaming, blogging, or taking pictures Session 7 Vu Tran Lam IAD-2013
  • 3. Start Developing iOS Apps Today
  • 4. Creating iOS apps is fun and rewarding. If you're a new developer, you might be wondering where to begin. This road map provides the perfect starting point for iOS app development.
  • 5. When you develop apps, you use the iOS software development kit (SDK) and Xcode, Apple’s integrated development environment (IDE).
  • 6. To make a great iOS app, you need to learn and do many things, but the tools and iOS SDK make it easy to get a simple app running. Let’s do the tutorial Your First iOS App.
  • 7. Xcode provides tools to manage your entire development workflow- from creating your app and designing your user interface, to testing, optimizing, and shipping your app to the App Store.
  • 8. Objective-C is an elegant object-oriented language that is used in all iOS apps. You need to understand this language in order to use most iOS application frameworks.
  • 9. If you’ve learned enough about Objective-C to read and write basic code, you can begin to think in terms of objects - OOP. To create an iOS app, you need to know how to create, compare, query objects and access objects in collections such as arrays.
  • 10. iOS app consists of code that you write and frameworks provided by Apple. A framework contains a library of methods that your app can use. More than one app can access a framework library at the same time.
  • 11. A design pattern solves a common software engineering problem. Patterns are abstract designs, not code. When you adopt a design, you adapt the general pattern to your specific needs.
  • 12. Users expect iOS apps to be intuitive, interactive, and engaging. Think about user experience as you design every aspect of your app, from the features you choose to the way your app responds to a gesture.
  • 13. Before you begin writing a line of code, you should make some critical design decisions. Be as specific as possible about your app’s purpose and features. Choose the kind of data model your app will use. Decide on a user interface style for your app.
  • 14. After completing your iOS App, if you want more and more iOS users know and download your app, you must publish your app on the App Store. To make a great app, you need to test it on actual devices, not just in Simulator. To run an app on iOS-based devices, you need to register your devices, create certificates that authorize developers to sign an app, and create an app ID to identify the app.
  • 15. While developing your apps, you’ll need easy access to detailed technical information. Xcode makes that material available at your fingertips while you're coding.
  • 16. • Model-View-Controller • Delegation • Target-Action • Block objects • Sandboxing Fundamental iOS Design Patterns & Techniques
  • 17. Model-View-Controller • By default, iOS apps are organized around the Model-View- Controller design pattern. • The Model-View-Controller (MVC) design pattern assigns objects in an application one of three roles: model, view, or controller. The pattern defines not only the roles objects play in the application, it defines the way objects communicate with each other. • MVC is central to a good design for a Cocoa Touch application. Many objects in these applications tend to be more reusable, and their interfaces tend to be better defined. • Applications having an MVC design are also more easily extensible than other applications.
  • 18. Model-View-Controller ViewModel Controller
  • 19. Assign objects in an application to one of three roles. ViewModel Controller Model-View-Controller
  • 20. Model objects encapsulate the data specific to an application and define the logic and computation that manipulate and process that data, e.g: a model object represent a character in game or a contact in address book. Model View Controller Model-View-Controller
  • 21. A view object is an object in an application that users can see. A view object knows how to draw itself and can respond to user actions. Model View Controller Model-View-Controller
  • 22. A controller object acts as an intermediary between view and model objects. In MVC, a controller object interprets user actions made in view objects and communicates new or changed data to the model objects. Model View Controller Model-View-Controller
  • 23. ViewModel Controller It’s all about managing communication between 3 roles types Model-View-Controller
  • 24. ViewModel Controller Controllers can always talk directly to their Model. update Model-View-Controller
  • 25. ViewModel Controller Controllers can also talk directly to their View. outlet update update Model-View-Controller
  • 26. ViewModel The Model and View should never speak to each other. Controller ? outlet update update Model-View-Controller
  • 27. ViewModel Can the View speak to its Controller? Controller ? outlet update update Model-View-Controller
  • 28. ViewModel action target The Controller can drop a target on itself. Controller outlet update update Model-View-Controller
  • 29. ViewModel action target Then hand out an action to the View. Controller outlet update update Model-View-Controller
  • 30. ViewModel action target The View sends the action when things happen in the UI. Controller outlet update update Model-View-Controller
  • 31. ViewModel action target Sometimes the View needs to synchronize with the Controller. should did will Controller update outlet update Model-View-Controller
  • 32. ViewModel action target The Controller sets itself as the View’s delegate. delegate should did will Controller update outlet update Model-View-Controller
  • 33. ViewModel action target The delegate is set via a protocol (i.e. it’s “blind” to class). delegate should did will Controller outlet update update Model-View-Controller
  • 34. ViewModel action target Views do not own the data they display. delegate should did will Controller outlet update update Model-View-Controller
  • 35. ViewModel Model-View-Controller action target So, if needed, they have a protocol to acquire it. delegate should did will data at count Controller outlet update update
  • 36. ViewModel action target Controllers are almost always that data source (not Model!). data source data at count delegate should did will Controller outlet update update Model-View-Controller
  • 37. ViewModel action target Controllers interpret/format Model information for the View. data source data at count delegate should did will Controller outlet update update Model-View-Controller
  • 38. ViewModel action target Can the Model talk directly to the Controller? data source data at count delegate should did will Controller outlet update update ? Model-View-Controller
  • 39. ViewModel So what if the Model has information to update or something? action target data source data at count delegate should did will Controller outlet update update ? Model-View-Controller
  • 40. ViewModel It uses a “radio station”-like broadcast mechanism action target notification data source data at count delegate should did will Controller outlet update update notify Model-View-Controller
  • 41. Controllers (or other Model) “tune in” to interesting stuff. action ViewModel target notification data source data at count delegate should did will Controllernotify outlet update update Model-View-Controller
  • 42. Key Objects in an iOS App
  • 43. Delegation • Delegation is the design pattern which facilitates the transfer information and data from one object to another. In delegation, an object called the delegate acts on behalf of, and at the request of, another object. • A prime example of delegation can be seen in the case of the UIApplication class. The UIApplication class, of which every iOS iPhone application must have one instance, is responsible for the control and operation of the application within the iOS environment. • The Application Delegate is a custom object created at app launch time, usually by the UIApplicationMain function. • The primary job of Application Delegate is to handle state transitions within the app. For example, this object is responsible for launch-time initialization and handling transitions to and from the
  • 44. Managing App State Changes • The app launch cycle • Responding to interruptions • Moving to the background • Returning to the foreground • The main run loop
  • 45. The App Launch Cycle
  • 46. The App Launch Cycle
  • 47. The App Launch Cycle
  • 48. The App Launch Cycle
  • 49. Responding to Interruptions
  • 50. Returning to the Foreground
  • 51. The Main Run Loop The main run loop of your app is responsible for processing all user- related events. The UIApplication object sets up the main run loop at launch time and uses it to process events and handle updates to view- based interfaces.
  • 52. Target-Action • Target-action is a design pattern in which an object holds the information necessary to send a message to another object when an event occurs. • The stored information consists of two items of data: an action selector, which identifies the method to be invoked, and a target, which is the object to receive the message. • The message sent when the event occurs is called an action message.
  • 53. • For example, when a user interacts with a slider (action), it generates a UIControlEventValueChanged control event. You could use this event to update a label’s text to the current value of the slider. In this case, the sender is the slider, the control event is Value Changed, the action is updating the label’s text, and the target is the controller file containing the label as an IBOutlet. • Action methods must have a conventional signature as - (IBAction)doSomething:(id)sender;! • UIKit framework allows three different forms of action selector: - (void)action; - (void)action:(id)sender; - (void)action:(id)sender forEvent:(UIEvent *)event; Target-Action
  • 54. • Target-action is primarily a feature of controls in both the Cocoa Touch and Cocoa frameworks. • A control is a user-interface object such as a button, slider, or switch that users manipulate (by tapping, dragging, and so on) to signal their intention to an app. • A Cocoa Touch control stores both action and target; most Cocoa controls are paired with one or more cell objects that store target and action. Target-Action
  • 55. Block Objects • Block objects are a C-level syntactic and runtime feature that allow you to compose function expressions that can be passed as arguments, optionally stored, and used by multiple threads. • Declaring a block float (^aBlock)(const int*, int, float); • Creating a block int (^oneFrom)(int); oneFrom = ^(int anInt) { return anInt - 1; }; • Using block printf("%dn", oneFrom(10));
  • 56. Sandboxing • All iOS apps are placed in sandboxes to protect the system and other apps. • The structure of the sandbox affects the placement of your app’s files and has implications for data backups and some app-related features.
  • 57. • Concept of View Controller • Visual Interfaces • View Controllers manage Views • Taxonomy of View Controllers • Using Storyboards to design User Interface Overview of View Controllers
  • 58. • View controllers are a vital link between an app’s data and its visual appearance. Whenever an iOS app displays a user interface, the displayed content is managed by a view controller or a group of view controllers coordinating with each other. • View controllers are traditional controller objects in the Model-View- Controller (MVC) design pattern, but they also do much more. View controllers provide many behaviors common to all iOS apps. About View Controllers
  • 59. Visual Interfaces Screens, Windows, and Views create Visual Interfaces.
  • 60. • Each view controller organizes and controls a view • View controllers are controller objects in the MVC pattern, but a view controller also has specific tasks iOS expects it to perform. • These tasks are defined by the UIViewController class that all view controllers inherit from. View Controllers Manage Views
  • 61. • Each view controller organizes and controls a view • View controllers are controller objects in the MVC pattern, but a view controller also has specific tasks iOS expects it to perform. • These tasks are defined by the UIViewController class that all view controllers inherit from. Taxonomy of View Controllers
  • 62. Taxonomy of View Controllers
  • 63. Using Storyboards to Design User Interface
  • 64. Documentation iOS App Programming Guide https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ Introduction/Introduction.html Streamline Your App with Design Patterns https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/chapters/ StreamlineYourAppswithDesignPatterns/StreamlineYourApps/StreamlineYourApps.html Concepts in Objective-C Programming https://developer.apple.com/library/ios/documentation/general/conceptual/CocoaEncyclopedia/Introduction/ Introduction.html View Programming Guide https://developer.apple.com/library/ios/DOCUMENTATION/WindowsViews/Conceptual/ViewPG_iPhoneOS/ Introduction/Introduction.html
  • 65. many thanks to lamvt@fpt.com.vn please say Stanford University https://developer.apple.com Developer Center http://www.stanford.edu/class/cs193p xin chào
  • 66. Next: Xcode 5 & Interface Builder for iOS 7 App