+ All Categories
Transcript
Page 1: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

Dileepa Jayathilake

SATURN 2013

Page 2: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

Background

Problem Identification

Solution Overview

Implementation

Discussion

Conclusion

OU

TLI

NE

Page 3: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

Product for both OS X and iOS

BACKGROUND

With a significant part in common

How to reuse code maximally?

Page 4: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

BACKGROUND

Page 5: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

PROBLE

M

IDENTI

FICAT

IONIs it possible

to share UI code?

Page 6: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

SOLUTI

ON

OVERVIEW

Page 7: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

View Models implement common part of UI

View Models are shared

View hooks into View Model

Controllers hold platform specifics SOLU

TION

OVERVIEW

Bidirectional bindings are platform-specific

Page 8: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

SOLUTI

ON

OVERVIEW

View Models contain view data and common UI behaviorModels are exposed to Views through View Models

1

2

Page 9: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

SOLUTI

ON

IMPL

EMENTATI

ON

Common & Platform-specific components of the solution

Page 10: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

SOLUTI

ON

IMPL

EMENTATI

ON

Proof of Concept: Book Store Application

Page 11: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

SOLUTI

ON

IMPL

EMENTATI

ON

Use of the solution in Book Store application

Page 12: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

Advantages

• Improved code reuse• Better readability• Better Separation of View Logic• Enhanced testability

Concerns

• Framework class usage• Bi-directional bindings

DISCUSSIO

N

Page 13: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

CONCLUSION

View Models combined with traditional MVC can improve code reuse significantly while providing other advantages for applications

targeting both OS X and iOS.

Page 14: Adapting View Models as a Means For Sharing User Interface Code Between OS X and iOS

QUESTIONS


Top Related