first steps in ios development
DESCRIPTION
Presentation at ConFoo 2014 on iOS Development. Discussing the basic components of the iOS ecosystem and building a basic todo list manager app with Xcode and storyboards.TRANSCRIPT
© Copyright SELA software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
Sasha Goldshtein @goldshtnCTO, SELA Group blog.sashag.netFirst Steps in iOS Development
The iOS Platform
• 877,013+ of them Apps• UI, gestures, view
navigation, mediaCocoa Touch
• Location, threading, HTTP
Core Services
• Drivers, securityDarwin (kernel)
Platform Philosophy
User
• Consistent interface metaphors
• Always at home, on any device and in any app
• Seamless sync, backup, purchase
Developer
• Strong push to object orientation
• Just one language (Objective C)
• Strong separation of concerns in UI – MVC
Apple
• Full control over the ecosystem, hardware and software
• Ultimate arbitrator on whether an app is a fit for the App Store
iOS Devices and Versions
iPhone 3GS• iOS 3• iOS 4
Original iPad
iPhone 4/4S• iOS 5
iPhone 5• iOS 6
iPhone 5c/5s• iOS 7
September 2013:≈95% of iOS
devices run iOS 6
Devices and Resolutions
iPhone
3/3GS
3.5”
320×480
iPhone
4/4S
3.5”
640×960
iPhone
5/5c/5s
4”
640×1136
iPad 1/2
9.7”
1024×768
iPad Mini
7.9”
1024×768
iPad 3/4
9.7”
2048×1536
Developing for iOS
Xcode
Objective C
UIKit
self.title = [NSString initWithFormat:@"%d", n];[button setTitle:self.title forState:UIControlStateNormal];
Demo
Our First iOS App
Project Components
Generated files:Application delegateInitial view controllerMain storyboardProperty listFile for localizable stringsApplication icons
Xcode also adds basic frameworks to your app
iOS MVC Fundamentals
View
• Draws itself on the screen
• Contains generic UI-related data
View Controller
• Creates and coordinates views
• Populates views and reflects changes to the model
Model
• UI-agnostic classes
• Can be a bunch of objects, a database, a file, an Internet service
Outlets and Actions
Xcode connects views and controllersController manipulates views through outletsController receives events through actions
@interface MyViewController : UIViewController
@property (nonatomic, weak) IBOutlet UITextField *petName;
- (IBAction)getQuote;
@end
Demo
Connecting UI to Code
iOS Navigation Types
Tab bar controllerNavigation controller
Storyboards
The storyboard describes your application’s view controllers and connects them with segues
Passing Parameters
Usually the source view controller sets properties or calls methods on the destination view controller
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ MySecondVC *vc = segue.destinationViewController; vc.itemToDisplay = [self selectedItem]; vc.delegate = self; // For callbacks}
Demo
Storyboards and Segues
Summary
Objective C fundamentalsView controllers, views, outlets, actionsStoryboards, seguesIt’s just another{language, IDE, UI framework}The rest is just details: data, networking, settings, table views, styling, …
QuestionsSasha Goldshtein @goldshtnCTO, SELA Group blog.sashag.net