39. User Interface Client Logic
iPhone Objective C Objective C
Mobile Web
HTML / CSS Javascript
40. User Interface Client Logic
Calatrava
Objective C Objective C
HTML / CSS Javascript
A bridge between native and web
41. Calatrava
Technology choice per feature
More an approach than a framework
Will soon be open source
http://en.wikipedia.org/wiki/Puente_del_Alamillo
42. Populating web views from templates: GRMoustache
<div class="person">
<span class=”name”>{{name}}</span>
{{#address}}
<div class="address">
{{.}}
</div>
{{/address}}
... and all the other stuff
</div>
43. Populating web views from templates: GRMoustache
NSDictionary *person = @{ @"name": @"Stew", @"address": @"Melbourne" };
GRMustacheTemplate *template = ...;
NSString *renderedContent = [template renderObject:person];
[webView loadHTMLString:renderedContent baseURL:...];
Should we populate templates on the
client or server?
44. Signal when the UIWebView has loaded
<body onload="window.location = 'myapp://ready'">
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
if ([request.URL.scheme isEqualToString:@"myapp"] &&
[request.URL.host isEqualToString:@"ready"])
{
// We're done, you can display the content now
return NO;
}
...
}
45. Implementing javascript logic
Inside a UIWebView
Use JavaScriptCore directly?
[webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];
46. User Interface Client Logic
Calatrava
Objective C Objective C
HTML / CSS Javascript
So were is this kind of architecture well suited?
47. ›❯ Apps for multiple mobile platforms
›❯ Evolving hybrid architectures
›❯ Mobile backend systems
›❯ Testing hybrid applications
48. Apps are just the
tip of the iceberg
Call Centre Retail
Legacy Thing Message Hub
Database Mainframe
Some expensive and proprietary system
51. How do we build simpler apps
and smarter backends?
App API Backend
Principles of REST
Serving data and style
Product-aligned teams
52. Forcing logic to the server
What if you could only use NSDictionary
objects for your domain model?
http://www.flickr.com/photos/jakecaptive/3205277810
53. ›❯ Apps for multiple mobile platforms
›❯ Evolving hybrid architectures
›❯ Mobile backend systems
›❯ Testing hybrid applications
58. business-level platform-specific
requirements mapping UI client logic
e.g.
Frank
e.g.
Business-level Shared business
Native-
specs logic
Driver
e.g.
Web-
Driver
Testing