SlideShare a Scribd company logo
© 2015 WIRE SWISS GMBH
Advanced UI styling and animations for iOS
© 2015 WIRE SWISS GMBH
AdvancedUIstylingandanimationsforiOS
© 2014 WIRE SWISS GMBH
About the Author: Mike Gerasymenko
• Working on iOS since 2008 (iOS 2.2)
• Around 35 apps for the AppStore
• With Wire since March 2014
© 2014 WIRE SWISS GMBH
Disclaimer
• A lot of open-source code is used
• Not all presented is created at Wire
• We love open-source and we do pull
requests and share the things we
develop
• github.com/wearezeta
© 2014 WIRE SWISS GMBH
Follow-Up on Cristobal’s presentation
• Why I brought up this topic?
• Bring the Sense of continuity
• Broaden-up the insight for those
who was interested last time
• Give a deep insight on how UI
works in Wire
• Design is crucial
© 2015 WIRE SWISS GMBH
Plan
• Everything is Custom:
• Custom animation’s timings on UIViews and
CALayers
• Custom styling for the user interface
• One More Thing
© 2014 WIRE SWISS GMBH
Glossary
© 2014 WIRE SWISS GMBH
Animation timing (easing): functions
• Animation is a change of property from
initial (A) to end value (B) in given time (t)
• How the change is distributed over the
time t?
• Timing curve (Easing):
• Gives animation progress for time
• Implementation:
• UIView: predefined set of timing curves
• CoreAnimation: can be defined as
arbitrary Bézier curve that starts in (0,
0) and ends in (1, 1), so two control
points can vary
© 2014 WIRE SWISS GMBH
Animation timing (easing): functions
• Animation is a change of property from
initial (A) to end value (B) in given time (t)
• How the change is distributed over the
time t?
• Timing curve (Easing):
• Gives animation progress for time
• Implementation:
• UIView: predefined set of timing curves
• CoreAnimation: can be defined as
arbitrary Bézier curve that starts in (0,
0) and ends in (1, 1), so two control
points can vary
© 2014 WIRE SWISS GMBH
Animation timing (easing): example
© 2014 WIRE SWISS GMBH
Animation timing (easing): custom timing
Why custom timing function is important?

Because designers says so

Because it looks better and makes the difference

How we can use custom timing function with UIView animation?

We can’t, it is not supported by the API
?
© 2015 WIRE SWISS GMBH
Animation timing (easing): Math 101
• Bezier curves are defined as power functions
• Exponential functions are the different set of
functions
• Use «Best Fitting» Bezier curves, would be not
equal to expo but close enough
• Root mean squared error is as low as 0.00000102
( ) ( )( )( ) ( )
( ) tttt dxxfy 1
1
0
2
∫ −
© 2014 WIRE SWISS GMBH
The Problem
© 2015 WIRE SWISS GMBH
Animation timing (easing)
• UIView animations do not support
custom easing
• CoreAnimation API is complicated
and bulky
• We need to implement the API that
would work as UIView, but support
passing in the custom easing
© 2015 WIRE SWISS GMBH
Animation timing (easing): UIView animation 101
• UIViews are using CALayers (.layer from CoreAnimation framework) to display it’s contents
• CALayers are using CAAnimation family to do animations
• Conclusion: when UIView animation is created the backing animation is CAAnimation anyway
• We need to find a way to create CAAnimations like iOS do:
1 [UIView animateWithDuration: timingFunction: animations:^{
2 view.property = newValue;
3 }]
and produce the CAAnimations on the appropriate objects
© 2015 WIRE SWISS GMBH
Animation timing (easing): Introducing UIView+ExtendedBlockAnimations
• Approach:
• Swizzle -[CALayer actionForLayer:forKey:]
• When animation method is called, call UIView animation
block with the same parameters and expect it to create
the animations on CALayers
• Capture when UIView creates it’s animations
• Replace created animations with our own animations that
are utilising the custom timing functions
© 2014 WIRE SWISS GMBH
To The Code
© 2015 WIRE SWISS GMBH
Animation timing (easing): Preparation
Swizzle:
1 SEL originalSelector = @selector(actionForLayer:forKey:);
2 SEL extendedSelector = @selector(WR_actionForLayer:forKey:);
3
4 Method originalMethod = class_getInstanceMethod(self, originalSelector);
5 Method extendedMethod = class_getInstanceMethod(self, extendedSelector);
6
7 method_exchangeImplementations(originalMethod, extendedMethod);
Apply:
1 - (id<CAAction>)WR_actionForLayer:(CALayer *)layer forKey:(NSString *)event
2 {
3 ...
4 if (currentContext == BlockAnimationsContext &&
5 [supportedProperties containsObject:event]) {
6
7 [savedAnimations addObject:[WRSavedAnimationState savedStateWithLayer:layer
8 keyPath:event]];
9
10 // no implicit animation (it will be added later)
11 return (id<CAAction>)[NSNull null];
12 }
13 ...
14 }
© 2015 WIRE SWISS GMBH
Animation timing (easing): application
1 + (void)wr_animateWithEasing:(RBBEasingFunction)easing
2 duration:(NSTimeInterval)duration
3 delay:(NSTimeInterval)delay
4 animations:(void (^)(void))animations
5 options:(WRExtendedBlockAnimationsOptions)options
6 completion:(void (^)(BOOL finished))completion
7 {
8 RBBTweenAnimation *animation = [[RBBTweenAnimation alloc] init]; // create the template anim
9 animation.easing = easing;
10 ...
11
12 [self wr_animateWithBasicAnimation:animation
13 duration:duration
14 animations:animations
15 options:options
16 completion:completion];
17 }
© 2015 WIRE SWISS GMBH
Animation timing (easing): easy as 1-2-3
1 [UIView wr_animateWithEasing:RBBEasingFunctionEaseInExpo duration:0.35 delay:0 animations:^{
2 // Do animations
3 view.frame = newFrame;
4 view.alpha = 1.0f;
5 view.transform = newTransform;
6 } completion:^(BOOL finished) {
7 // Do completion
8 }];
© 2014 WIRE SWISS GMBH
© 2014 WIRE SWISS GMBH
Animation timing (easing)
Grab it at goo.gl/uYItrG
© 2014 WIRE SWISS GMBH
Questions
© 2014 WIRE SWISS GMBH
Interface Styling
Defining User Interface style
© 2014 WIRE SWISS GMBH
Interface Styling: What we need?
• Ability to define UI element’s style:
• Colour
• Font
• Insets
• Any other style-related property
• Per element objc-class, class, parent
• Ability to tweak style during runtime
• Clean stylesheet format
© 2014 WIRE SWISS GMBH
Interface Styling: Classy!
✓ Ability to define UI element’s style:
✓ Colour
✓ Font
✓ Insets
✓ Any other style-related property
✓ Per element objc-class, class, parent
✓ Ability to tweak style during runtime
✓ Clean stylesheet format
© 2014 WIRE SWISS GMBH
– http://cloudkite.github.io/Classy/
“Not CSS. Instead of trying to force UIKit to fit CSS syntax,
properties, conventions and constructs. Classy is a
stylesheet system built from the ground up to work in
harmony with UIKit. It borrows the best ideas from CSS and
introduces new syntax, conventions and constructs where
appropriate.”
Interface Styling: Classy!
© 2014 WIRE SWISS GMBH
Interface Styling: Classy integration
• Steps to integrate Classy:
• Grab framework via
• CocoaPods: pod 'Classy', '~> 0.2.4’
• Carthage: github "cloudkite/Classy"
• Create stylesheet
• Insert minimal initialisation code
• Profit!
© 2014 WIRE SWISS GMBH
Interface Styling: Classy stylesheet
1 @import "colors.cas";
2
3 $accentColor = #acacac;
4
5 // Supports custom UIView subclasses
6 WireView {
7 background-color: $accentColor;
8 title-insets: 5, 10, 5, 10;
9 > UIProgressView.tinted {
10 progress-tint-color: rgb(200, 155, 110, 0.6);
11 track-tint-color: yellow;
12 }
13 }
14
15 ^UIButton.warning, UIView.warning ^UIButton {
16 title-color[state:highlighted]: #e3e3e3;
27 }
© 2014 WIRE SWISS GMBH
Interface Styling: Classy selectors
• Selectors:
• Runtime class name
• cas_styleClass class
• Containment
• Property of
• Selectors can be mixed
© 2014 WIRE SWISS GMBH
Interface Styling: Classy properties
• Properties supported:
• Any system or user-defined
• Property types supported:
• UIColor
• UIFont
• UIEdgeInsets
• Any custom property
© 2014 WIRE SWISS GMBH
Interface Styling: Classy in the nutshell
+ Classy =
Un-Styled UI
Different themes
or
© 2014 WIRE SWISS GMBH
Interface Styling: Classy testing
• Selectors and properties
• Covered by unit and integration
tests
• We commit to Classy with PRs;
adding more test coverage to
the product
© 2014 WIRE SWISS GMBH
One more thing
© 2014 WIRE SWISS GMBH
Interface Styling: Classy live editing
• Classy can observe the filesystem
changes on the stylesheet and re-apply
the updates live
• Knowing that we added the WebDAV
client in the application’s development
builds
• Now design people can tweak certain
properties realtime using the iPhone, dev
build and their mac with a text editor
© 2014 WIRE SWISS GMBH
Questions
© 2014 WIRE SWISS GMBH
© 2014 WIRE SWISS GMBH
Regards to my fellow colleagues
Cristobal Castilla
Jacob Persson
Vjacheslav Volodko
Alan Duric
Marke Saaremets
Natalia Dorozala
© 2014 WIRE SWISS GMBH
Contact data
Mike Gerasymenko
mihail@gerasimenko.me
(find me on Wire using this email)
mike@wire.com
© 2014 WIRE SWISS GMBH

More Related Content

Viewers also liked (17)

PPTX
честь имею
elvira38
 
PDF
HomeSun Solar Buy Brochure
KP4422
 
PPTX
Unit 7 y 8
Juan Abadia
 
PPTX
Senior Project
batboy1993
 
DOCX
Hout plaatmateriaal
kjill
 
PPT
Lecture2
FALLEE31188
 
PPSX
De kracht van crownsourcing met kgi
Quietroom Label
 
PPTX
Развитие финансового сектора Казахстана в посткризисный период
АО "Самрук-Казына"
 
PDF
Lommi: Kouluterveyskysely 2011 Vakka-Suomessa
Kouluterveyskysely
 
PPT
Elements, Compounds & Mixtures - Day 1
jmori1
 
DOC
베트남 노동법 주요내용
Nguyễn Khang
 
PDF
Betsy DeVos, Spence Abraham, and Saul Anuzis endorse Clark Durant for U.S. Se...
ClarkDurant
 
PPTX
Sd10 nadia alkhazaliah
Sara Alkhazaliah
 
DOCX
1° simulado es sa 2016
Sonia Aluna Química 2012-2
 
PPT
Themes ways of the world
ashleighalece
 
DOC
Successes2009
Georgette Palmer
 
PPTX
Welcome in Turin
enzoppi
 
честь имею
elvira38
 
HomeSun Solar Buy Brochure
KP4422
 
Unit 7 y 8
Juan Abadia
 
Senior Project
batboy1993
 
Hout plaatmateriaal
kjill
 
Lecture2
FALLEE31188
 
De kracht van crownsourcing met kgi
Quietroom Label
 
Развитие финансового сектора Казахстана в посткризисный период
АО "Самрук-Казына"
 
Lommi: Kouluterveyskysely 2011 Vakka-Suomessa
Kouluterveyskysely
 
Elements, Compounds & Mixtures - Day 1
jmori1
 
베트남 노동법 주요내용
Nguyễn Khang
 
Betsy DeVos, Spence Abraham, and Saul Anuzis endorse Clark Durant for U.S. Se...
ClarkDurant
 
Sd10 nadia alkhazaliah
Sara Alkhazaliah
 
1° simulado es sa 2016
Sonia Aluna Química 2012-2
 
Themes ways of the world
ashleighalece
 
Successes2009
Georgette Palmer
 
Welcome in Turin
enzoppi
 

Similar to Advanced UI styling and animations for iOS (20)

KEY
Animation in iOS
Alexis Goldstein
 
PDF
A short guide to animations in iOS
SoftTeco
 
PDF
iOS Core Animation
Jussi Pohjolainen
 
PDF
Starting Core Animation
John Wilker
 
PDF
animations
David Horvath
 
PDF
Core Animation
bdudney
 
PDF
Building animated UI with Core Animation
Marco Zoffoli
 
PDF
Crafting interactions with Core Animations, David Ortinau
Xamarin
 
PPTX
Animations & swift
Arun Nagarajan
 
PDF
Beginning iOS6 Development CH04 More User Interface Fun
Abdulrazzaq Alnajjar
 
PDF
Core Animation
Blogintosh
 
KEY
Effectively Using UI Automation
Alexander Repty
 
PDF
Why design matters?
Ozlem Bilis
 
PDF
Leaving Interface Builder Behind
John Wilker
 
PPT
Programming iOS in C#
Frank Krueger
 
PDF
MOPCON 2014 - Best software architecture in app development
anistar sung
 
PDF
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Vu Tran Lam
 
PDF
Practical tipsmakemobilefaster oscon2016
Doris Chen
 
PDF
iOS 7 Human Interface Guidelines
Evgeny Belyaev
 
PPTX
Apple Watch Human Interface Guidelines
ShengWen Chiou
 
Animation in iOS
Alexis Goldstein
 
A short guide to animations in iOS
SoftTeco
 
iOS Core Animation
Jussi Pohjolainen
 
Starting Core Animation
John Wilker
 
animations
David Horvath
 
Core Animation
bdudney
 
Building animated UI with Core Animation
Marco Zoffoli
 
Crafting interactions with Core Animations, David Ortinau
Xamarin
 
Animations & swift
Arun Nagarajan
 
Beginning iOS6 Development CH04 More User Interface Fun
Abdulrazzaq Alnajjar
 
Core Animation
Blogintosh
 
Effectively Using UI Automation
Alexander Repty
 
Why design matters?
Ozlem Bilis
 
Leaving Interface Builder Behind
John Wilker
 
Programming iOS in C#
Frank Krueger
 
MOPCON 2014 - Best software architecture in app development
anistar sung
 
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Vu Tran Lam
 
Practical tipsmakemobilefaster oscon2016
Doris Chen
 
iOS 7 Human Interface Guidelines
Evgeny Belyaev
 
Apple Watch Human Interface Guidelines
ShengWen Chiou
 
Ad

Recently uploaded (20)

PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPT
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
PPTX
drones for disaster prevention response.pptx
NawrasShatnawi1
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
PPTX
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PDF
Additional Information in midterm CPE024 (1).pdf
abolisojoy
 
PDF
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
PPTX
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
PDF
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PPTX
Presentation on Foundation Design for Civil Engineers.pptx
KamalKhan563106
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PPTX
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
PPTX
Structural Functiona theory this important for the theorist
cagumaydanny26
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
drones for disaster prevention response.pptx
NawrasShatnawi1
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
EC3551-Transmission lines Demo class .pptx
Mahalakshmiprasannag
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
Additional Information in midterm CPE024 (1).pdf
abolisojoy
 
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
Presentation on Foundation Design for Civil Engineers.pptx
KamalKhan563106
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Benefits_^0_Challigi😙🏡💐8fenges[1].pptx
akghostmaker
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
Structural Functiona theory this important for the theorist
cagumaydanny26
 
Ad

Advanced UI styling and animations for iOS

  • 1. © 2015 WIRE SWISS GMBH Advanced UI styling and animations for iOS
  • 2. © 2015 WIRE SWISS GMBH AdvancedUIstylingandanimationsforiOS
  • 3. © 2014 WIRE SWISS GMBH About the Author: Mike Gerasymenko • Working on iOS since 2008 (iOS 2.2) • Around 35 apps for the AppStore • With Wire since March 2014
  • 4. © 2014 WIRE SWISS GMBH Disclaimer • A lot of open-source code is used • Not all presented is created at Wire • We love open-source and we do pull requests and share the things we develop • github.com/wearezeta
  • 5. © 2014 WIRE SWISS GMBH Follow-Up on Cristobal’s presentation • Why I brought up this topic? • Bring the Sense of continuity • Broaden-up the insight for those who was interested last time • Give a deep insight on how UI works in Wire • Design is crucial
  • 6. © 2015 WIRE SWISS GMBH Plan • Everything is Custom: • Custom animation’s timings on UIViews and CALayers • Custom styling for the user interface • One More Thing
  • 7. © 2014 WIRE SWISS GMBH Glossary
  • 8. © 2014 WIRE SWISS GMBH Animation timing (easing): functions • Animation is a change of property from initial (A) to end value (B) in given time (t) • How the change is distributed over the time t? • Timing curve (Easing): • Gives animation progress for time • Implementation: • UIView: predefined set of timing curves • CoreAnimation: can be defined as arbitrary Bézier curve that starts in (0, 0) and ends in (1, 1), so two control points can vary
  • 9. © 2014 WIRE SWISS GMBH Animation timing (easing): functions • Animation is a change of property from initial (A) to end value (B) in given time (t) • How the change is distributed over the time t? • Timing curve (Easing): • Gives animation progress for time • Implementation: • UIView: predefined set of timing curves • CoreAnimation: can be defined as arbitrary Bézier curve that starts in (0, 0) and ends in (1, 1), so two control points can vary
  • 10. © 2014 WIRE SWISS GMBH Animation timing (easing): example
  • 11. © 2014 WIRE SWISS GMBH Animation timing (easing): custom timing Why custom timing function is important? Because designers says so Because it looks better and makes the difference How we can use custom timing function with UIView animation? We can’t, it is not supported by the API ?
  • 12. © 2015 WIRE SWISS GMBH Animation timing (easing): Math 101 • Bezier curves are defined as power functions • Exponential functions are the different set of functions • Use «Best Fitting» Bezier curves, would be not equal to expo but close enough • Root mean squared error is as low as 0.00000102 ( ) ( )( )( ) ( ) ( ) tttt dxxfy 1 1 0 2 ∫ −
  • 13. © 2014 WIRE SWISS GMBH The Problem
  • 14. © 2015 WIRE SWISS GMBH Animation timing (easing) • UIView animations do not support custom easing • CoreAnimation API is complicated and bulky • We need to implement the API that would work as UIView, but support passing in the custom easing
  • 15. © 2015 WIRE SWISS GMBH Animation timing (easing): UIView animation 101 • UIViews are using CALayers (.layer from CoreAnimation framework) to display it’s contents • CALayers are using CAAnimation family to do animations • Conclusion: when UIView animation is created the backing animation is CAAnimation anyway • We need to find a way to create CAAnimations like iOS do: 1 [UIView animateWithDuration: timingFunction: animations:^{ 2 view.property = newValue; 3 }] and produce the CAAnimations on the appropriate objects
  • 16. © 2015 WIRE SWISS GMBH Animation timing (easing): Introducing UIView+ExtendedBlockAnimations • Approach: • Swizzle -[CALayer actionForLayer:forKey:] • When animation method is called, call UIView animation block with the same parameters and expect it to create the animations on CALayers • Capture when UIView creates it’s animations • Replace created animations with our own animations that are utilising the custom timing functions
  • 17. © 2014 WIRE SWISS GMBH To The Code
  • 18. © 2015 WIRE SWISS GMBH Animation timing (easing): Preparation Swizzle: 1 SEL originalSelector = @selector(actionForLayer:forKey:); 2 SEL extendedSelector = @selector(WR_actionForLayer:forKey:); 3 4 Method originalMethod = class_getInstanceMethod(self, originalSelector); 5 Method extendedMethod = class_getInstanceMethod(self, extendedSelector); 6 7 method_exchangeImplementations(originalMethod, extendedMethod); Apply: 1 - (id<CAAction>)WR_actionForLayer:(CALayer *)layer forKey:(NSString *)event 2 { 3 ... 4 if (currentContext == BlockAnimationsContext && 5 [supportedProperties containsObject:event]) { 6 7 [savedAnimations addObject:[WRSavedAnimationState savedStateWithLayer:layer 8 keyPath:event]]; 9 10 // no implicit animation (it will be added later) 11 return (id<CAAction>)[NSNull null]; 12 } 13 ... 14 }
  • 19. © 2015 WIRE SWISS GMBH Animation timing (easing): application 1 + (void)wr_animateWithEasing:(RBBEasingFunction)easing 2 duration:(NSTimeInterval)duration 3 delay:(NSTimeInterval)delay 4 animations:(void (^)(void))animations 5 options:(WRExtendedBlockAnimationsOptions)options 6 completion:(void (^)(BOOL finished))completion 7 { 8 RBBTweenAnimation *animation = [[RBBTweenAnimation alloc] init]; // create the template anim 9 animation.easing = easing; 10 ... 11 12 [self wr_animateWithBasicAnimation:animation 13 duration:duration 14 animations:animations 15 options:options 16 completion:completion]; 17 }
  • 20. © 2015 WIRE SWISS GMBH Animation timing (easing): easy as 1-2-3 1 [UIView wr_animateWithEasing:RBBEasingFunctionEaseInExpo duration:0.35 delay:0 animations:^{ 2 // Do animations 3 view.frame = newFrame; 4 view.alpha = 1.0f; 5 view.transform = newTransform; 6 } completion:^(BOOL finished) { 7 // Do completion 8 }];
  • 21. © 2014 WIRE SWISS GMBH
  • 22. © 2014 WIRE SWISS GMBH Animation timing (easing) Grab it at goo.gl/uYItrG
  • 23. © 2014 WIRE SWISS GMBH Questions
  • 24. © 2014 WIRE SWISS GMBH Interface Styling Defining User Interface style
  • 25. © 2014 WIRE SWISS GMBH Interface Styling: What we need? • Ability to define UI element’s style: • Colour • Font • Insets • Any other style-related property • Per element objc-class, class, parent • Ability to tweak style during runtime • Clean stylesheet format
  • 26. © 2014 WIRE SWISS GMBH Interface Styling: Classy! ✓ Ability to define UI element’s style: ✓ Colour ✓ Font ✓ Insets ✓ Any other style-related property ✓ Per element objc-class, class, parent ✓ Ability to tweak style during runtime ✓ Clean stylesheet format
  • 27. © 2014 WIRE SWISS GMBH – http://cloudkite.github.io/Classy/ “Not CSS. Instead of trying to force UIKit to fit CSS syntax, properties, conventions and constructs. Classy is a stylesheet system built from the ground up to work in harmony with UIKit. It borrows the best ideas from CSS and introduces new syntax, conventions and constructs where appropriate.” Interface Styling: Classy!
  • 28. © 2014 WIRE SWISS GMBH Interface Styling: Classy integration • Steps to integrate Classy: • Grab framework via • CocoaPods: pod 'Classy', '~> 0.2.4’ • Carthage: github "cloudkite/Classy" • Create stylesheet • Insert minimal initialisation code • Profit!
  • 29. © 2014 WIRE SWISS GMBH Interface Styling: Classy stylesheet 1 @import "colors.cas"; 2 3 $accentColor = #acacac; 4 5 // Supports custom UIView subclasses 6 WireView { 7 background-color: $accentColor; 8 title-insets: 5, 10, 5, 10; 9 > UIProgressView.tinted { 10 progress-tint-color: rgb(200, 155, 110, 0.6); 11 track-tint-color: yellow; 12 } 13 } 14 15 ^UIButton.warning, UIView.warning ^UIButton { 16 title-color[state:highlighted]: #e3e3e3; 27 }
  • 30. © 2014 WIRE SWISS GMBH Interface Styling: Classy selectors • Selectors: • Runtime class name • cas_styleClass class • Containment • Property of • Selectors can be mixed
  • 31. © 2014 WIRE SWISS GMBH Interface Styling: Classy properties • Properties supported: • Any system or user-defined • Property types supported: • UIColor • UIFont • UIEdgeInsets • Any custom property
  • 32. © 2014 WIRE SWISS GMBH Interface Styling: Classy in the nutshell + Classy = Un-Styled UI Different themes or
  • 33. © 2014 WIRE SWISS GMBH Interface Styling: Classy testing • Selectors and properties • Covered by unit and integration tests • We commit to Classy with PRs; adding more test coverage to the product
  • 34. © 2014 WIRE SWISS GMBH One more thing
  • 35. © 2014 WIRE SWISS GMBH Interface Styling: Classy live editing • Classy can observe the filesystem changes on the stylesheet and re-apply the updates live • Knowing that we added the WebDAV client in the application’s development builds • Now design people can tweak certain properties realtime using the iPhone, dev build and their mac with a text editor
  • 36. © 2014 WIRE SWISS GMBH Questions
  • 37. © 2014 WIRE SWISS GMBH
  • 38. © 2014 WIRE SWISS GMBH Regards to my fellow colleagues Cristobal Castilla Jacob Persson Vjacheslav Volodko Alan Duric Marke Saaremets Natalia Dorozala
  • 39. © 2014 WIRE SWISS GMBH Contact data Mike Gerasymenko [email protected] (find me on Wire using this email) [email protected]
  • 40. © 2014 WIRE SWISS GMBH