SlideShare a Scribd company logo
Three20 framework for iOS development

      Chih-Wei Lee
Google Summer of Code Student 2010

Email: dlackty@gmail.com
Twitter/Facebook/GitHub: @dlackty
Google Summer of Code 2010
Why you should know more about mobile apps?
Lots of new startups build their own mobile app first!
Web giants also build wonderful mobile apps.
Mobile first, web second.



   1. Mobile is exploding

   2. Mobile forces you to focus

   3. Mobile extends your capabilities




                                      Luke Wroblewski
                           Source : http://www.lukew.com/ff/entry.asp?933
Connected to Internet

90% apps has data transmission to server
•Push notifications
•Member system
•Data display/browse
•Online ranking
•Search
Cocoa touch aren’t optimized as a web client

•No simple mechanism to manipulate online objects
•Need to make lots of caches of online resource
•Some UI components are missing
•Navigation between view controllers are trivial

•There’re event no built-in JSON parsers!
Three20
Three20

•Originally developed by Joe Hewitt at Facebook
•Used to build official Facebook app
•Similar to many web frameworks

•Now an most popular Objective-C project on GitHub
More on http://three20.info/
Three20 modules
Three20 Core

Three20 Core provides a basic set of tools useful for
debugging your applications, dealing with standard data
structures, and doing basic text manipulation.
Examples:

•TT_RELEASE_SAFELY(POINTER);
•NSString* TTPathForDocumentsResource(NSString* relativePath);
•(NSDictionary*)queryDictionaryUsingEncoding:(NSStringEncoding)
encoding;

•NSArray - (void)perform:(SEL)selector;
•NSData - (NSString*)md5Hash;
Three20 Network

Three20 Network mainly provide TTURLRequest,
compared to NSURLRequest, it provides more features.
Features

•HTTP methods support (POST/GET/PUT)
•Simple post parameters
•File-based cache
•Automatically parse downloaded data an validate
•Handle cookies
Three20 UICommon

Three20 UICommon provides basic UI utilities for
construction of higher level UI modules.
Examples:

•float TTOSVersion();
•BOOL TTIsPad();
•BOOL TTIsKeyboardVisible();
•void TTAlert(NSString* message);
•- (UIView*)findFirstResponderInView:(UIView*)topView;
Three20 UINavigator

Three20 UINavigator makes iPhone apps like web apps
based on URL-mapping mechanism.
The URLs are mapped into Objective-C view controllers,
and the parameters are passed to init method.
Features:

•TTBaseNavigator - The main url handler to open urls
•TTURLAction - Action to open url with some option parameters
•TTURLMap - Map URLS to view controllers
URL-Mapping examples
    TTURLMap* map = navigator.URLMap;
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://catalog" toViewController:[CatalogController class]];
[map from:@"tt://photoTest1" toViewController:[PhotoTest1Controller class]];
[map from:@"tt://photoTest2" toViewController:[PhotoTest2Controller class]];
[map from:@"tt://imageTest1" toViewController:[ImageTest1Controller class]];
[map from:@"tt://tableTest" toViewController:[TableTestController class]];



then, you can simply:
TTOpenURL(@"tt://launcherTest");



Instead of
LauncherViewTestController *viewController = [[LauncherViewTestController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
Three20 Style

Three20 Style make developers to style UIs with a main
stylesheets, instead of manually set each UIs style.
Also it provides some utilities to cope with UIs and do
images manipulations.
Examples:

•- (UIImage*)transformWidth:(CGFloat)width height:(CGFloat)height rotate:
(BOOL)rotate;

•- (void)drawInRect:(CGRect)rect radius:(CGFloat)radius;
Three20 UI

Three20 UI is the most wonderful part of the framework,
includes enhancements of UIKit, new view controllers and
new UI components
TTImageView examples

  TTImageView *imageView = [[TTImageView alloc] initWithFrame:frame];
  [imageView setUrlPath:@"http://www.foo.com/bar.jpg"];




Instead of
  UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
  NSURL *url = [NSURL URLWithString:@"http://www.foo.com/bar.jpg"];
  NSData *data = [[NSData alloc] initWithContentsOfURL:url];
  [imageView setImage:[UIImage imageWithData:data]];




and with additional
asynchronous loading, and disk cache
TTPhotoViewController
TTMessageController
TTLauncherView
Three20 extensions
Three20 Extensions

extCSSStyle
This extension provides support for reading Three20 style sheets from CSS files.

extXML
Three20 XML Extension for parsing XML objects into Objective-C NSObjects.

extJSON
Three20 JSON Extension for parsing JSON objects in to Objective-C
NSObjects.
New official website with docs and tutorials
                                 Check out http://three20.info/
Reference

Official website http://three20.info
GitHub http://github.com/facebook/three20
Google Group http://groups.google.com/group/three20/

More Related Content

PDF
Introduction to Node.js
PDF
不断归零的前端人生 - 2016 中国软件开发者大会
PDF
Rails Developer In Australia
PDF
Taipei.rb 201612 紅寶石工程師在澳洲生存之道
PDF
淺談 Startup 公司的軟體開發流程 v2
PDF
AngularJS for Web and Mobile
PPTX
Angular JS - Introduction
PPTX
Angular JS, A dive to concepts
Introduction to Node.js
不断归零的前端人生 - 2016 中国软件开发者大会
Rails Developer In Australia
Taipei.rb 201612 紅寶石工程師在澳洲生存之道
淺談 Startup 公司的軟體開發流程 v2
AngularJS for Web and Mobile
Angular JS - Introduction
Angular JS, A dive to concepts

Similar to Three20 framework for iOS development (20)

PPTX
The current status of html5 technology and standard
PDF
jQuery: The World's Most Popular JavaScript Library Comes to XPages
PDF
AngularJS Basics
PDF
Architecting your Frontend
PDF
Manageable Robust Automated Ui Test
PPTX
221c82d4-5428-4047-8558-0467b34083e8.pptx
PDF
Desktop apps with node webkit
PDF
The fundamental problems of GUI applications and why people choose React
PDF
Faites évoluer votre accès aux données avec MongoDB Stitch
PPTX
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
PPT
Apps & Widgets in Mobile Learning
PDF
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
PPTX
04 objective-c session 4
PPTX
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
PPTX
Overview of Visual Studio Team System 2010
PPTX
Backbone/Marionette recap [2015]
PPTX
Meteor meetup
PDF
Building Responsive Websites with the Bootstrap 3 Framework
PPTX
Siligong.Data - May 2021 - Transforming your analytics workflow with dbt
PDF
Why and How SmartNews uses SaaS?
The current status of html5 technology and standard
jQuery: The World's Most Popular JavaScript Library Comes to XPages
AngularJS Basics
Architecting your Frontend
Manageable Robust Automated Ui Test
221c82d4-5428-4047-8558-0467b34083e8.pptx
Desktop apps with node webkit
The fundamental problems of GUI applications and why people choose React
Faites évoluer votre accès aux données avec MongoDB Stitch
AD105 - OneUI.. really? Is that because you don't know about Twitter Bootstrap?
Apps & Widgets in Mobile Learning
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
04 objective-c session 4
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
Overview of Visual Studio Team System 2010
Backbone/Marionette recap [2015]
Meteor meetup
Building Responsive Websites with the Bootstrap 3 Framework
Siligong.Data - May 2021 - Transforming your analytics workflow with dbt
Why and How SmartNews uses SaaS?
Ad

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Modernizing your data center with Dell and AMD
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
A Presentation on Artificial Intelligence
Modernizing your data center with Dell and AMD
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Monthly Chronicles - July 2025
Ad

Three20 framework for iOS development

  • 1. Three20 framework for iOS development Chih-Wei Lee Google Summer of Code Student 2010 Email: dlackty@gmail.com Twitter/Facebook/GitHub: @dlackty
  • 2. Google Summer of Code 2010
  • 3. Why you should know more about mobile apps?
  • 4. Lots of new startups build their own mobile app first!
  • 5. Web giants also build wonderful mobile apps.
  • 6. Mobile first, web second. 1. Mobile is exploding 2. Mobile forces you to focus 3. Mobile extends your capabilities Luke Wroblewski Source : http://www.lukew.com/ff/entry.asp?933
  • 7. Connected to Internet 90% apps has data transmission to server •Push notifications •Member system •Data display/browse •Online ranking •Search
  • 8. Cocoa touch aren’t optimized as a web client •No simple mechanism to manipulate online objects •Need to make lots of caches of online resource •Some UI components are missing •Navigation between view controllers are trivial •There’re event no built-in JSON parsers!
  • 10. Three20 •Originally developed by Joe Hewitt at Facebook •Used to build official Facebook app •Similar to many web frameworks •Now an most popular Objective-C project on GitHub
  • 13. Three20 Core Three20 Core provides a basic set of tools useful for debugging your applications, dealing with standard data structures, and doing basic text manipulation. Examples: •TT_RELEASE_SAFELY(POINTER); •NSString* TTPathForDocumentsResource(NSString* relativePath); •(NSDictionary*)queryDictionaryUsingEncoding:(NSStringEncoding) encoding; •NSArray - (void)perform:(SEL)selector; •NSData - (NSString*)md5Hash;
  • 14. Three20 Network Three20 Network mainly provide TTURLRequest, compared to NSURLRequest, it provides more features. Features •HTTP methods support (POST/GET/PUT) •Simple post parameters •File-based cache •Automatically parse downloaded data an validate •Handle cookies
  • 15. Three20 UICommon Three20 UICommon provides basic UI utilities for construction of higher level UI modules. Examples: •float TTOSVersion(); •BOOL TTIsPad(); •BOOL TTIsKeyboardVisible(); •void TTAlert(NSString* message); •- (UIView*)findFirstResponderInView:(UIView*)topView;
  • 16. Three20 UINavigator Three20 UINavigator makes iPhone apps like web apps based on URL-mapping mechanism. The URLs are mapped into Objective-C view controllers, and the parameters are passed to init method. Features: •TTBaseNavigator - The main url handler to open urls •TTURLAction - Action to open url with some option parameters •TTURLMap - Map URLS to view controllers
  • 17. URL-Mapping examples TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from:@"tt://catalog" toViewController:[CatalogController class]]; [map from:@"tt://photoTest1" toViewController:[PhotoTest1Controller class]]; [map from:@"tt://photoTest2" toViewController:[PhotoTest2Controller class]]; [map from:@"tt://imageTest1" toViewController:[ImageTest1Controller class]]; [map from:@"tt://tableTest" toViewController:[TableTestController class]]; then, you can simply: TTOpenURL(@"tt://launcherTest"); Instead of LauncherViewTestController *viewController = [[LauncherViewTestController alloc] init]; [self.navigationController pushViewController:viewController animated:YES]; [viewController release];
  • 18. Three20 Style Three20 Style make developers to style UIs with a main stylesheets, instead of manually set each UIs style. Also it provides some utilities to cope with UIs and do images manipulations. Examples: •- (UIImage*)transformWidth:(CGFloat)width height:(CGFloat)height rotate: (BOOL)rotate; •- (void)drawInRect:(CGRect)rect radius:(CGFloat)radius;
  • 19. Three20 UI Three20 UI is the most wonderful part of the framework, includes enhancements of UIKit, new view controllers and new UI components
  • 20. TTImageView examples TTImageView *imageView = [[TTImageView alloc] initWithFrame:frame]; [imageView setUrlPath:@"http://www.foo.com/bar.jpg"]; Instead of UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame]; NSURL *url = [NSURL URLWithString:@"http://www.foo.com/bar.jpg"]; NSData *data = [[NSData alloc] initWithContentsOfURL:url]; [imageView setImage:[UIImage imageWithData:data]]; and with additional asynchronous loading, and disk cache
  • 25. Three20 Extensions extCSSStyle This extension provides support for reading Three20 style sheets from CSS files. extXML Three20 XML Extension for parsing XML objects into Objective-C NSObjects. extJSON Three20 JSON Extension for parsing JSON objects in to Objective-C NSObjects.
  • 26. New official website with docs and tutorials Check out http://three20.info/
  • 27. Reference Official website http://three20.info GitHub http://github.com/facebook/three20 Google Group http://groups.google.com/group/three20/