SlideShare a Scribd company logo
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

PPTX
IBDesignable & IBInspectible
PDF
Tech Talk #5 : KIF-iOS Integration Testing Framework - Nguyễn Hiệp
PDF
How To Build iOS Apps Without interface Builder
PPTX
Types of mobile apps
PDF
IOT strategy
PDF
Introduction to React Native & Rendering Charts / Graphs
PDF
Building Salesforce1 Communities Apps with React Native and Flux
PDF
Developing ionic apps for android and ios
IBDesignable & IBInspectible
Tech Talk #5 : KIF-iOS Integration Testing Framework - Nguyễn Hiệp
How To Build iOS Apps Without interface Builder
Types of mobile apps
IOT strategy
Introduction to React Native & Rendering Charts / Graphs
Building Salesforce1 Communities Apps with React Native and Flux
Developing ionic apps for android and ios

What's hot (20)

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

Similar to A Better Interface Builder Experience (20)

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

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