40

Winch - Build Faster Mobile Apps

Embed Size (px)

DESCRIPTION

Winch is a sync engine for iOS and Android apps. It lets you build highly responsive mobile apps that even work off-line. These slides give an overview including a case study that leverages Mantle - a model framework for Cocoa and Cocoa Touch. Presentation made for CocoaHeads Paris. See: * https://winch.io * http://cocoaheads.fr/2013/11/la-gestion-des-donnees-le-14-novembre-a-paris/ * https://github.com/deltheil/snippets * https://github.com/github/Mantle

Citation preview

Page 1: Winch - Build Faster Mobile Apps
Page 2: Winch - Build Faster Mobile Apps
Page 3: Winch - Build Faster Mobile Apps

In-app latenciestranslate into...

Page 4: Winch - Build Faster Mobile Apps

frustrated users :(

Page 5: Winch - Build Faster Mobile Apps

Common app pattern

Every user action requires downloading data

•  pros: simple to implement,

•  cons: poor user experience.

Page 6: Winch - Build Faster Mobile Apps

"Speed is afeature"

Page 7: Winch - Build Faster Mobile Apps

Minimize in-applatencies...

Page 8: Winch - Build Faster Mobile Apps

to make yourusers happy :)

Page 9: Winch - Build Faster Mobile Apps
Page 10: Winch - Build Faster Mobile Apps

Build FasterMobile Apps

Page 11: Winch - Build Faster Mobile Apps

Additional benefits

Besides reacting faster, your app:

1.  works off-line,

2.  stays up-to-date seamlessly.

Page 12: Winch - Build Faster Mobile Apps

How does itwork?

Page 13: Winch - Build Faster Mobile Apps

As simple as 1, 2, 3

1.  import your data,

2.  drag and drop the Winch iOS framework,

3.  call sync() .

Page 14: Winch - Build Faster Mobile Apps

Concepts

Page 15: Winch - Build Faster Mobile Apps

In short

Winch is a key-value data store.“

Page 16: Winch - Build Faster Mobile Apps

Think of it as...

datastore ~ database

namespace ~ table

key ~ primary key

value ~ data

Page 17: Winch - Build Faster Mobile Apps

Example:Snippets for iOS

Page 18: Winch - Build Faster Mobile Apps

What is Snippets?

•  an iOS app to learn and experience your favorite tech on-the-go,

•  it works with Redis so far,

•  it is open source,

•  it is powered by Winch.

Initiated at AngelHack Paris, October 2013.

Page 19: Winch - Build Faster Mobile Apps

Overview

Page 20: Winch - Build Faster Mobile Apps
Page 21: Winch - Build Faster Mobile Apps
Page 22: Winch - Build Faster Mobile Apps
Page 23: Winch - Build Faster Mobile Apps
Page 24: Winch - Build Faster Mobile Apps

Data Model

Page 25: Winch - Build Faster Mobile Apps

Commands: rds:cmds

•  key: command unique ID, e.g "get"

•  value: JSON doc with command name, summary, CLI sample, e.g:

{

"name": "GET",

"summary": "Get the value of a key"

"cli":["GET nonexisting",...]

}

01.

02.

03.

04.

05.

Page 26: Winch - Build Faster Mobile Apps

Groups: rds:groups

•  key: integer key, e.g "0003"

•  value: JSON doc with group name and related commands, e.g:

{

"name": "Hashes",

"cmds": ["hdel", "hget", ...]

}

01.

02.

03.

04.

Page 27: Winch - Build Faster Mobile Apps

HTML docs: rds:docs

•  key: command unique ID, e.g "get"

•  value: HTML fragment, e.g:

<h1>GET key</h1>

<h3>Available since 1.0.0</h3>

...

It is used with: [webView loadHTMLString:html baseURL:nil];

01.

02.

03.

Page 28: Winch - Build Faster Mobile Apps

Model Layer

Page 29: Winch - Build Faster Mobile Apps

Use Mantle™, by GitHub

Mantle makes it easy to write a simple model layer

for your Cocoa or Cocoa Touch application.“

Page 30: Winch - Build Faster Mobile Apps
Page 31: Winch - Build Faster Mobile Apps

RDSCommand.h

Page 32: Winch - Build Faster Mobile Apps

RDSCommand.m

Page 33: Winch - Build Faster Mobile Apps

Winch Category

Page 34: Winch - Build Faster Mobile Apps

Write app specific helpers

Create a WNCDatabase+MyApp category and

implement custom extensions for your app data

model.

Page 35: Winch - Build Faster Mobile Apps

Overview

Page 36: Winch - Build Faster Mobile Apps

Sync

Abstract your namespaces under a custom sync method:

Page 37: Winch - Build Faster Mobile Apps

Fetch

Get a collection of model objects via a single call:

Page 38: Winch - Build Faster Mobile Apps

Save

Persist local data with a local namespace:

Page 39: Winch - Build Faster Mobile Apps

Questions?

Page 40: Winch - Build Faster Mobile Apps

Thanks :)