SlideShare a Scribd company logo
1 of 23
Download to read offline
A Better Interface
Builder Experience
Justin Munger
NSCoder
October 27, 2015
Introduction
• Professional software developer for 17 years
• Independent contractor for 10 years
• Mobile development for 6 years
• Started in iOS in 2009, Android in 2010
• Full-time Android in 2012
• Back to both iOS and Android in 2015
Interface Builder
• One of the things I’ve enjoyed working with in
iOS
• Ability to see UI and interactions in one place
• Accurate visual representation of static UI
components
BUT…
Annoyances of IB
• Not all properties of UI I want to change are
available in the Attributes Inspector
• Mix of configuration in IB and code
• Difficult to consolidate UI initialization into a
storyboard
User Defined Runtime
Attributes
• Introduced in Xcode 4
• Uses KVC to set values defined in Storyboard at
runtime
• Found in Identity Inspector for current view
• Limited to the following data types:
• Boolean
• Number
• String
• Localized
String
• Point
• Size
• Rect
• Color
Demo
This is GREAT!
• I can now consolidate my UI initialization into the
view in the storyboard scene
• Fewer surprises and gotchas with code
initialization that I forgot about
BUT…
Still not ideal
• The User Defined Runtime Attributes are not
really user-friendly
• Key needs to be typed correctly and doesn’t
work if you have a typo
• My initialization for the UI is still split up between
the User Defined Runtime Attributes in the
Identity Inspector and the regular view attributes
in the Attribute Inspector
Wouldn’t it be nice if…
• …we could have User Defined Runtime
Attributes be part of the Attributes Inspector
instead?
• …attributes were modifiable in a name-safe,
type-safe, easy-to-read format?
• …attributes were organized in a user-friendly
manner, even grouped together?
Introducing IBInspectable!
• Attribute added to a property in your application
• Allows it to be added to the Attributes Inspector
along with all of the other view attributes
• Interface Builder automatically generates the
appropriate UI for the attribute based on its type
• IBInspectable uses User Defined Runtime
Attributes underneath the covers to store/set
value
How to use IBInspectable
• Add IBInspectable/@IBInspectable (Obj-C/Swift)
preceding the property definition
• That’s it! Super simple!
• Can be applied to properties of UIView
subclasses
• Also can be applied using categories/extensions
on existing UIViews and its subclasses
Naming/Grouping Properties
for IBInspectable
• Requires proper ordering/naming of properties
in source file
• Property name is converted from camel case to
title case (with spaces) for all words in name 2
characters or longer
• Interface Builder appears to create groupings if
either the first or last part of the property name is
the same
• Adds a divider line between these grouping
Demo
This is REALLY GREAT!
• Now my view configuration is all consolidated
into the Attributes Inspector for the view
• I can easily see and change the values as
needed
BUT…
I Can’t SEE My Changes
• None of the changes I make to the attributes are
reflected in the actual view at design-time
• I still need to run the app to see how the
attributes change the view at run-time
• Wouldn’t it be nice if there was a way to be able
to see changes in these attributes reflected in
the view at design-time?
Introducing IBDesignable!
• Attribute added to a UIView subclass
• Allows changes made to custom attributes to be
drawn in the view and instantly visible at design-
time
• Helps give a more accurate look at what the UI
will appear like when it is first initialized
How to use IBDesignable
• Add IB_DESIGNABLE/@IBDesignable (Obj-C/
Swift) preceding the class definition
• Again, that’s it! Super-simple!
• Can be applied to any UIView-derived subclass
• Since it is applied at a class level, it cannot be
used with category/extension like IBInspectable
can
Demo
Any Questions?
Thanks!
• Slides and code are at:

https://github.com/justinkmunger/
BetterIBExperience
• Email: justinkmunger@gmail.com
• Twitter: @justinmunger

More Related Content

What's hot

Ember presentation
Ember presentationEmber presentation
Ember presentationDaniel N
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015Mike McNeil
 
An Inforgraphic to Learn React Native
An Inforgraphic to Learn React NativeAn Inforgraphic to Learn React Native
An Inforgraphic to Learn React NativePaddy Lock
 
Automated Testing on iOS
Automated Testing on iOSAutomated Testing on iOS
Automated Testing on iOSMake School
 
Mobile sdk feb_2015
Mobile sdk feb_2015Mobile sdk feb_2015
Mobile sdk feb_2015Jebacilon
 
React Native - Why Designers should use React native. And everyone else too.
React Native - Why Designers should use React native. And everyone else too.React Native - Why Designers should use React native. And everyone else too.
React Native - Why Designers should use React native. And everyone else too.Val Scholz
 
Hybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinHybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinDeepu S Nath
 
Angular 2 - How we got here?
Angular 2 - How we got here?Angular 2 - How we got here?
Angular 2 - How we got here?Marios Fakiolas
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code CampBaskar rao Dsn
 
Putting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native BostonPutting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native Bostonstan229
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativePolidea
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentDevathon
 
Addon sdk content scripts
Addon sdk content scriptsAddon sdk content scripts
Addon sdk content scriptsIrvin Chen
 
Swagger for startups
Swagger for startupsSwagger for startups
Swagger for startupsTony Tam
 
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...Codemotion
 

What's hot (20)

Ember presentation
Ember presentationEmber presentation
Ember presentation
 
React Native
React NativeReact Native
React Native
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
An Inforgraphic to Learn React Native
An Inforgraphic to Learn React NativeAn Inforgraphic to Learn React Native
An Inforgraphic to Learn React Native
 
API Design Approach
API Design ApproachAPI Design Approach
API Design Approach
 
Automated Testing on iOS
Automated Testing on iOSAutomated Testing on iOS
Automated Testing on iOS
 
SONY BBS - React Native
SONY BBS - React NativeSONY BBS - React Native
SONY BBS - React Native
 
Mobile sdk feb_2015
Mobile sdk feb_2015Mobile sdk feb_2015
Mobile sdk feb_2015
 
React Native - Why Designers should use React native. And everyone else too.
React Native - Why Designers should use React native. And everyone else too.React Native - Why Designers should use React native. And everyone else too.
React Native - Why Designers should use React native. And everyone else too.
 
Hybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - XamarinHybrid Mobile App Development - Xamarin
Hybrid Mobile App Development - Xamarin
 
Angular 2 - How we got here?
Angular 2 - How we got here?Angular 2 - How we got here?
Angular 2 - How we got here?
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code Camp
 
Putting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native BostonPutting the Native in React Native - React Native Boston
Putting the Native in React Native - React Native Boston
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Art of Building APIs
Art of Building APIsArt of Building APIs
Art of Building APIs
 
How native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App DevelopmentHow native is React Native? | React Native vs Native App Development
How native is React Native? | React Native vs Native App Development
 
Addon sdk content scripts
Addon sdk content scriptsAddon sdk content scripts
Addon sdk content scripts
 
Swagger for startups
Swagger for startupsSwagger for startups
Swagger for startups
 
Xamarin.Forms
Xamarin.FormsXamarin.Forms
Xamarin.Forms
 
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
 

Similar to A Better Interface Builder Experience

Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationVu Tran Lam
 
React UI Development: Introduction to "UI Component as API"
React UI Development: Introduction to "UI Component as API"React UI Development: Introduction to "UI Component as API"
React UI Development: Introduction to "UI Component as API"Itaru Kitagawa
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhoneVu Tran Lam
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using XamarinGill Cleeren
 
Bringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsBringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsRené Cacheaux
 
Lessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxLessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxMohammad Azam
 
"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade
"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade
"iOS: MVVMC" - Aleksandr Nikolajev from MooncascadeMobileMonday Estonia
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Phil Leggetter
 
PrototypingToolsDiscovery_1280x720_v3
PrototypingToolsDiscovery_1280x720_v3PrototypingToolsDiscovery_1280x720_v3
PrototypingToolsDiscovery_1280x720_v3Dan Frazier
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin formsSolTech, Inc.
 
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business ToolsSUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business ToolsAnindita Bhattacharya
 
Hey Android, Mirror Mirror all day long - Yossi Elkrief, Tikal
Hey Android, Mirror Mirror all day long - Yossi Elkrief, TikalHey Android, Mirror Mirror all day long - Yossi Elkrief, Tikal
Hey Android, Mirror Mirror all day long - Yossi Elkrief, TikalDroidConTLV
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Developmentandriajensen
 
DIC To The Limit – deSymfonyDay, Barcelona 2014
DIC To The Limit – deSymfonyDay, Barcelona 2014DIC To The Limit – deSymfonyDay, Barcelona 2014
DIC To The Limit – deSymfonyDay, Barcelona 2014Ronny López
 
DroidCon TLV 2015 - Hey android, mirror mirror all day long
DroidCon TLV 2015 - Hey android, mirror mirror all day longDroidCon TLV 2015 - Hey android, mirror mirror all day long
DroidCon TLV 2015 - Hey android, mirror mirror all day longYossi Elkrief
 

Similar to A Better Interface Builder Experience (20)

iOS UI best practices
iOS UI best practicesiOS UI best practices
iOS UI best practices
 
iOS storyboard
iOS storyboardiOS storyboard
iOS storyboard
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 application
 
React UI Development: Introduction to "UI Component as API"
React UI Development: Introduction to "UI Component as API"React UI Development: Introduction to "UI Component as API"
React UI Development: Introduction to "UI Component as API"
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhone
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
Bringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C ProjectsBringing Swift into your Objective-C Projects
Bringing Swift into your Objective-C Projects
 
Lessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptxLessons-Learned-SwiftUI.pptx
Lessons-Learned-SwiftUI.pptx
 
"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade
"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade
"iOS: MVVMC" - Aleksandr Nikolajev from Mooncascade
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
User Experience Prototyping
User Experience PrototypingUser Experience Prototyping
User Experience Prototyping
 
Ui 5
Ui   5Ui   5
Ui 5
 
MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
 
PrototypingToolsDiscovery_1280x720_v3
PrototypingToolsDiscovery_1280x720_v3PrototypingToolsDiscovery_1280x720_v3
PrototypingToolsDiscovery_1280x720_v3
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin forms
 
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business ToolsSUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
 
Hey Android, Mirror Mirror all day long - Yossi Elkrief, Tikal
Hey Android, Mirror Mirror all day long - Yossi Elkrief, TikalHey Android, Mirror Mirror all day long - Yossi Elkrief, Tikal
Hey Android, Mirror Mirror all day long - Yossi Elkrief, Tikal
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
 
DIC To The Limit – deSymfonyDay, Barcelona 2014
DIC To The Limit – deSymfonyDay, Barcelona 2014DIC To The Limit – deSymfonyDay, Barcelona 2014
DIC To The Limit – deSymfonyDay, Barcelona 2014
 
DroidCon TLV 2015 - Hey android, mirror mirror all day long
DroidCon TLV 2015 - Hey android, mirror mirror all day longDroidCon TLV 2015 - Hey android, mirror mirror all day long
DroidCon TLV 2015 - Hey android, mirror mirror all day long
 

A Better Interface Builder Experience

  • 1. A Better Interface Builder Experience Justin Munger NSCoder October 27, 2015
  • 2. Introduction • Professional software developer for 17 years • Independent contractor for 10 years • Mobile development for 6 years • Started in iOS in 2009, Android in 2010 • Full-time Android in 2012 • Back to both iOS and Android in 2015
  • 3. Interface Builder • One of the things I’ve enjoyed working with in iOS • Ability to see UI and interactions in one place • Accurate visual representation of static UI components
  • 5. Annoyances of IB • Not all properties of UI I want to change are available in the Attributes Inspector • Mix of configuration in IB and code • Difficult to consolidate UI initialization into a storyboard
  • 6. User Defined Runtime Attributes • Introduced in Xcode 4 • Uses KVC to set values defined in Storyboard at runtime • Found in Identity Inspector for current view • Limited to the following data types: • Boolean • Number • String • Localized String • Point • Size • Rect • Color
  • 8. This is GREAT! • I can now consolidate my UI initialization into the view in the storyboard scene • Fewer surprises and gotchas with code initialization that I forgot about
  • 10. Still not ideal • The User Defined Runtime Attributes are not really user-friendly • Key needs to be typed correctly and doesn’t work if you have a typo • My initialization for the UI is still split up between the User Defined Runtime Attributes in the Identity Inspector and the regular view attributes in the Attribute Inspector
  • 11. Wouldn’t it be nice if… • …we could have User Defined Runtime Attributes be part of the Attributes Inspector instead? • …attributes were modifiable in a name-safe, type-safe, easy-to-read format? • …attributes were organized in a user-friendly manner, even grouped together?
  • 12. Introducing IBInspectable! • Attribute added to a property in your application • Allows it to be added to the Attributes Inspector along with all of the other view attributes • Interface Builder automatically generates the appropriate UI for the attribute based on its type • IBInspectable uses User Defined Runtime Attributes underneath the covers to store/set value
  • 13. How to use IBInspectable • Add IBInspectable/@IBInspectable (Obj-C/Swift) preceding the property definition • That’s it! Super simple! • Can be applied to properties of UIView subclasses • Also can be applied using categories/extensions on existing UIViews and its subclasses
  • 14. Naming/Grouping Properties for IBInspectable • Requires proper ordering/naming of properties in source file • Property name is converted from camel case to title case (with spaces) for all words in name 2 characters or longer • Interface Builder appears to create groupings if either the first or last part of the property name is the same • Adds a divider line between these grouping
  • 15. Demo
  • 16. This is REALLY GREAT! • Now my view configuration is all consolidated into the Attributes Inspector for the view • I can easily see and change the values as needed
  • 18. I Can’t SEE My Changes • None of the changes I make to the attributes are reflected in the actual view at design-time • I still need to run the app to see how the attributes change the view at run-time • Wouldn’t it be nice if there was a way to be able to see changes in these attributes reflected in the view at design-time?
  • 19. Introducing IBDesignable! • Attribute added to a UIView subclass • Allows changes made to custom attributes to be drawn in the view and instantly visible at design- time • Helps give a more accurate look at what the UI will appear like when it is first initialized
  • 20. How to use IBDesignable • Add IB_DESIGNABLE/@IBDesignable (Obj-C/ Swift) preceding the class definition • Again, that’s it! Super-simple! • Can be applied to any UIView-derived subclass • Since it is applied at a class level, it cannot be used with category/extension like IBInspectable can
  • 21. Demo
  • 23. Thanks! • Slides and code are at:
 https://github.com/justinkmunger/ BetterIBExperience • Email: justinkmunger@gmail.com • Twitter: @justinmunger