Archive for 'Programming'

Demassify View Controllers

Nice writeup here on formalizing pattern names for approaches to avoiding that Massive View Controller problem it’s all too easy to slip into:

8 Patterns to Help You Destroy Massive View Controller

View controllers become gargantuan because they’re doing too many things. Keyboard management, user input, data transformation, view allocation — which of these is really the purview of the view controller? Which should be delegated to other objects? …

Data Source

The Data Source Pattern is a way of isolating the logic around which objects live behind what index paths. Particularly in complicated table views, it can be useful to remove all of the logic of “Which cells are visible under these conditions?” from your view controller…

Standard Composition

View controllers can be composed using the View Controller Containment APIs introduced in iOS 5. If your view controller is composed of several logical units that could each be their own view controller, consider using Composition to break them apart…

Smarter Views

If you’re allocating all of your view controller’s subviews inside of the view controller’s class, you may consider using a Smarter View. UIViewController defaults to using UIView for it’s view property, but you can override it with your own view…


The Presenter Pattern wraps a model object, transforms its properties for display, and exposes messages for those transformed properties…

Binding pattern

In method form, this might be called -configureView. The Binding Pattern updates a view with model data as it changes…

Interaction pattern

Interactions often include an initial user input (like a button press), optional additional user input (“Are you sure you want to X?”), and then some activity, like a network request or state change. The entire lifecycle of that operation can be wrapped up inside the Interaction Object…

Keyboard Manager

Updating the view after the keyboard state changes is another concern that is classically stuck in the view controller, but this responsibility can easily be shifted in a Keyboard Manager. ..


Navigating from screen to screen is normally done with a call to -pushViewController:animated:. As these transitions get more complicated, you can delegate this task to a Navigator object..

h/t: Michael Tsai!

And while you’re contemplating how to split things up into maintainability, also check out

Clean Up The Application Delegate With Initializers

Continue Reading →

Watch Out!

Just in case you were off in rural Bangladesh like us last week, the Apple WatchKit SDK is out:

Developers, Start Designing Apps for Apple Watch

WatchKit Developer Page

Video Overview of WatchKit

Apple Watch Human Interface Guidelines

WatchKit Programming Guide

Lister (for Apple Watch, iOS, and OS X)

Apple Watch Design Resources

WatchKit Development Tips

And here’s a survey of some immediate reactions:

What you need to know about WatchKit

Pretty cool stuff, right?

Initial Impressions for WatchKit

… I am very pleasantly surprised by how capable it is … Rather than just saying we only get Glances and Notifications, we get to build actual, useful watch apps …

WatchKit: Initial Impressions

Overall, WatchKit offers far more than I expected in this initial release … From the new Apple Watch-specific controls, to glances, actionable notifications, deep linking with Handoff, image caching and more — as a developer, this is the kind of stuff that gets me excited!

A day with WATCH

David Smith put it best: there’s a lot more here than most of us expected…

How To Create A “Hello World” WatchKit App and WatchKit: Let’s Create a Table and WatchKit: Page-Based Navigation and WatchKit: Hierarchical Navigation and WatchKit: Accessing Data From Your iOS App and WatchKit: The First Glance at Glances and WatchKit: Let’s Add a Menu [and WatchKit: Customizing the Global Tint and …]

I can’t get enough of WatchKit. Sooooo much to learn!

WatchKit Tutorial with Swift: Getting Started

iOS developers rejoice – WatchKit is finally here!

Apple’s new WatchKit SDK hints at the future of Apple Watch’s apps

WatchKit is here. What does it mean?

Well-nigh euphoric, you people!


Watch Hackathon Live

Hello WatchKit! Learn how to build an Apple Watch app

jblocksom / WristComms: “WatchKit extension / host app communications example.”

Thoughts on WatchKit

Confirmed: Apple Watch Runs iOS

Apple’s San Francisco Typeface

WatchKit Extension Problem: Sharing a Core Data Store Can Lead to Duplicate Entries

johnno1962 / WatchkitCurrency: “Swift Currency Convertor for iWatch with flexible interface.”

frosty / Flipbook: “A Swift tool to render UIViews to image sequences for use with WatchKit…”

azamsharp / WatchNotes: “Notes on your wrist!”

Positioning Tutorial in WatchKit

WatchKit Swift Tutorial – Download Xcode 6.2 Beta and Start Making Apple Watch Apps

David Smith’s As I Learn WatchKit (AILW)

  1. Introducing As I Learn WatchKit (AILW):
  2. Visualizing Watch Apps
  3. Learning in the Dev Forums
  4. Building a basic WatchKit App
  5. Economics of WatchKit Apps
  6. Introducing MMWormhole
  7. openParentApplication:reply:
  8. WatchKit Data Sharing (Video)
  9. Immediacy
  10. Bezel and xScope
  11. Inquisitive #21: Exploit the Constraints
  12. Beta 4 Documentation Changes
  13. A Day Spent Designing a WatchKit UI
  14. WatchKit UI Component Walkthrough (Video)
  15. Ubiquitous Time
  16. Understanding WatchKit Layout (Video)
  17. Guessing the Apple Watch Release Date
  18. Displaying Tabular Data (Video)
  19. Beta 5 Documentation Changes
  20. Tap Distance
  21. WatchCon 2
  22. A few interviews
  23. Prettier Status Bar Trick
  24. Spring Forward Event Announced
  25. #212: Four Phases of a Gold Rush
  26. Adding a Touch of Liveliness
  27. WatchSim
  28. Connected #33: The RoboCop of Apple Watches
  29. Appearance: Mobile Couch #54
  30. Pending an Apple Release
  31. My WatchKit Apps
  32. First WatchKit Review Guideline
  33. Thinking about Load Time

NSHipster’s Watch​Kit

Top 5 Things to Consider When Designing for Apple Watch

How to write a WatchKit Counter App in Swift

WKInterfaceTimer – Add a Countdown to a Swift WatchKit App

WatchKit Data Sharing: Beware of the NSFileCoordinator and NSFilePresenter

Introducing MMWormwhole

WatchKit Resources

WatchKit and Threading

Limitations of Dates and Timers on WatchKit

WatchKit: Open Your iOS App From The Watch

konstantinkoval / WatchKit-Apps : “Tutorials app for WatchKit.”

SpeakerDeck: WatchKit by Jonathan Blocksom

Integrating FontAwesome on WatchKit

How Your Favorite Apps Will Look On The Apple Watch

WatchKit Introduction: Building a Simple Guess Game

Radial Bar Chart Generator

Designing Chronicons: Icon Size

WatchKit Extensions: Communicating with your Parent Application; Communicate Between WatchKit Extension and App

D-32 / AppleWatchSBB: “Apple Watch app to access the SBB timetable”

Bezel: “shows a window that looks like an Apple Watch and projects the contents of the Simulator’s watch window into it.”

Apple Watch wins the wrist war before it starts

Apple Watch. Tesla Car. How Far Can We Drive Them?

WatchKit Delegates and Contexts

WatchKit Settings Bundle

5 Important Design Principles for Apple Watch Apps

Apple Watch apps: What to pay attention to when designing for the wrist

Instagram/IGInterfaceDataTable: “A category on WKInterfaceTable that makes configuring tables with multi-dimensional data easier.”

kenshin03/Cherry: “Mini Pomodoro Timer app designed for the  Watch.”

radianttap/WatchRingGenerator: “iOS app to generate series of PNG images, to be used in WatchKit apps.”

A Set Of Apple Watch Example Projects For Learning WatchKit

Wenderlich tutorials: Getting Started and FAQ and Tables and Network Requests and More Tables, Glances and Handoff

FancyPixel / gulps: “is an open source app for iOS and Apple Watch that lets you keep track of your daily water consumption.”

Tutorial: Sharing Data between WatchKit & your App, with Realm

Create an Apple Watch Game with Xcode and Watchkit

“My Biggest WatchKit Mistake”; More “WatchKit Mistakes”

Watchkit and iOS App Messaging with openParentApplication

Icons for Apple Watch – The Definitive Guide

Design for Wearables: “Learn to design delightful wearable experiences by going step-by-step through the process of designing an  Apple Watch app”:

  1.  Apple Watch Vision & Design Principles
  2. User Research & Discovery
  3.  Apple Watch App Primer
  4. WatchKit App
  5. Glances

“how to use Sketch, After Effects, and Xcode to craft the animation used in the Uber watch app.”

Watchkit: Best Practices for Sharing Data Between Your Watch and iOS App; WatchKit and Sharing App Data

Jared’s Code Signing Tips: Apple Watch Edition

Mike Swanson’s WatchKit Development Tips now does Apple Watch

WatchKit Controller Life Cycle

WatchKit Image Tips

Open Sourcing the Highstreet WatchKit App

WatchKit Connectivity and File Transfers

watchOS-2-heartrate: “watchOS 2.0 healthkit, heartrate streaming, start workout session”

Continue Reading →

Stand Back and Deliver

Now here’s some awesomeness topped with awesome sauce and a side of awesome for reducing your blood pressure:

KrauseFx / deliver: Deploy screenshots, app metadata and app updates to the App Store using just one command.

What, seriously? Apparently so:


  • Upload hundreds of screenshots with different languages from different devices
  • Upload a new ipa file to iTunes Connect without Xcode from any computer
  • Update app metadata
  • Easily implement a real Continuous Deployment process
  • Store the configuration in git to easily deploy from any computer, including your Continuous Integration server (e.g. Jenkins)
  • Get a PDF preview of the fetched metadata before uploading the app metadata and screenshots to Apple: Example Preview (Yes, those are screenshots taken for all screen sizes)

Yeah, we’ve been in deployment-challenged places where we really, seriously, needed that tool…

h/t: iOS Dev Weekly!


@KrauseFx seems to have the mission Make Everything Deployment-Related Work — also check out

KrauseFx / sigh: “Because you would rather spend your time building stuff than fighting provisioning.”

KrauseFx / snapshot: “Create hundreds of screenshots of your iPhone app… while doing something else.”

KrauseFx / frameit: “Want a device frame around your screenshot? Do it in an instant!”

KrauseFx / PEM: “Tired of manually creating and maintaining your push certification profiles?”

KrauseFx / produce: “Create new iOS apps on iTunes Connect and Dev Portal using the command line.”

… and all of the above are now connected into fastlane:


fastlane lets you define and run your deployment pipelines for different environments. It helps you unify your apps release process and automate the whole process. fastlane connects all fastlane tools and third party tools, like CocoaPods and xctool.

So that makes … everything pretty easy, really!

homebrew-cask: “A CLI workflow for the administration of Mac applications distributed as binaries.”

quick-look-plugins: “List of useful Quick Look plugins for developers.”

itc-api-docs: “The unofficial documentation of the iTunes Connect JSON API.”

Notes on the Developer Portal. For Dummies.

Convenient Build Settings

fastlane 1.0

Stencil Xcode Plugin “is an Xcode plugin that provides the ability to create custom file templates and use them in your project to create new files groups.”

Continue Reading →

Hakawai And Away

This is well worth taking a look at if you’re outgrowing UITextView’s functionality, LinkedIn is the latest company to kick out some awesome source to the community:

Introducing Hakawai – a powerful, mentions-enabled text view for iOS

Text Transformers

Hakawai provides block-based APIs for working with the contents of a text view. Text transformers are methods which take in special blocks. These blocks always take as an argument an attributed string (representing the initial state of the text), and return another attributed string (representing the final state of the text). Hakawai also supports attribute transformers, which work similarly…

Abstraction Layer

The experimental Abstraction Layer feature is a way to provide text view users with a higher-level change notification API than currently offered by the built-in UITextViewDelegate. There are five main types of notifications, each with associated data…


Hakawai comes with a host of extras, including (but not limited to):

  • An API for easily adding and removing accessory views from the text view
  • An API for temporarily locking the focus of the text view to the top or bottom of the text view
  • An API for rejecting autocorrect suggestions, and for working with the text view’s autocorrection, auto-capitalization, and spell checking state
  • A convenience API for working with characters and words at a given location
  • A custom text container and layout manager
  • Support for custom text formatting through custom attributes, including a pre-built attribute showcased in the mentions plug-in


Hakawai supports plug-ins, which are code modules that can be selectively activated and deactivated at run-time to provide the text view with additional functionality…


Mentions is a plug-in for creating ‘mentions’, annotations in a text view which might correspond to names of individuals or entities…

OK, that’s some serious UITextView enhancement. Check it out on github!

(And while you’re in the LinkedIn neighbourhood over there, background fetch scheduling library Selene is worth a gander as well.)

h/t: ManiacDev!


raulriera / TextFieldEffects: “Custom UITextFields effects inspired by Codrops, built using Swift”

Continue Reading →

Stylish Setup: KZBootstrap And Fabric

We’ve scattered here and there various references to goodies that make managing your Xcode project easier and/or more reliable, but here’s a particularly sweet-looking collection of most all the best bits we’ve noted plus some new clevernesses:

krzysztofzablocki / KZBootstrap: “iOS project bootstrap aimed at high quality coding.”

Each configuration can be put side by side on same device, and you can clearly distingiush each build. Easier to find issues across different version and branches…

Automatically generate macro for current developer, that way a team can have different code paths while they are working on features, or different logging levels. Without git changes.…

Often when working with big clients, you need to have multiple environments for Staging / Production / QA etc. They usually differ in some kind of configuration … Environments can be changed without reinstalling application, even while it’s running…

assertions when UIKit is layouted/displayed on background thread, so you can fix your code…

Let’s put it this way, even if you’re not particularly interested in adopting all the goodies here wholesale, it’s a useful exercise to go through all the various capabilities and understand them for when they or something along their lines might prove useful. As well as the various source references:

And while we’re on the subject of setting up new projects, if you haven’t looked at Twitter Fabric yet we’d recommend that’s a good thing to do; as Crashlytics is the only third party service we regard as an absolute necessity for any project at the moment, and if the other services Fabric provides are as competently executed and easy to manage as Crashlytics is, well we for one welcome our new Twitter overlords!


Speeding Up Custom Script Phases

futurice / ios-good-practices: “Good ideas for iOS development, by Futurice developers.”

indragiek / swiftrsrc “generates Swift code for accessing elements of asset catalogs, storyboards, and color lists in order to avoid the error-prone practice of hardcoding strings into your code. It is heavily inspired by Square’s objc-codegenutils, which you should definitely look into if you’re working on an Objective-C project.”

mac-cain13 / R.swift: “Tool to get strong typed, autocompleted resources like images and segues in your Swift project.”

Natalie – Storyboard Code Generator

a convenient way to access child controllers inserted into Storyboard container views

13 Xcode Tips That Will Help You Conquer Xcode; Spicing Up Xcode; Xcode 6 Tips: Vector Images, Code Snippets and Many More

Extend Xcode with Text Services

Tool: Xcode Plugin Adding An Action Bar For Nearly Every Built-In Xcode Action And More

Xcode Plugin Listing – Quality Xcode Plugins

The Unofficial Guide to xcconfig Files

How To Recover Disk Space from Xcode

Continue Reading →

Core Motion Slickness

The always-invaluable NSHipster has some particularly nifty trickiness in an article on Core Motion:


Let’s say we want to give the splash page of our app a fun effect, with the background image staying level no matter how the phone is tilted … Using the gyroscope, Core Motion separates user movement from gravitational acceleration and presents each as its own property of the CMDeviceMotionData instance that we receive in our handler…

We can also use the other, non-gravity portion of this composited gyro/acceleration data to add new methods of interaction. In this case, let’s use the userAcceleration property of CMDeviceMotionData to navigate backward whenever a user taps the left side of her device against her hand…

Lastly, let’s try using the device’s attitude to enable a new interaction for a flash-card app, designed to be used by two study buddies. Instead of manually switching between the prompt and the answer, we’ll automatically switch the view as the device turns around, so the quizzer sees the answer while the person being quizzed only sees the prompt…

Read it all!

Continue Reading →

SceneKit and Swift

Hmmm, looks like we’ve managed to completely overlook the existence of SceneKit in the annals herein thus far, even though it’s been around for a couple years on OS X now. So hey, why not skip learning about SceneKit in Objective-C completely and go straight to SceneKit in Swift? Everybody seems to have that idea lately:

Create Stonehenge with iOS SceneKit and Swift

SceneKit has been described as the casual game developer’s framework. Since I started playing around with it a few weeks ago, I’m having a little trouble putting it down…

Straightforward exposition of how to set up ground, sky, and build Stonehenge.

Introduction To SceneKit – Part 1 and Part 2 and Part 3

Let’s look at creating a new project that uses SceneKit. Apple provides a template for SceneKit projects(Application -> Games) but for this tutorial we’ll be adding SceneKit to an existing project to get a better understanding on how it works…

Exhaustively detailed introduction to 3D basics in SceneKit with the latest Xcode.

Beginning Scene Kit Tutorial

In iOS 7, Apple made a huge push in the casual, mobile gaming space by introducing Sprite Kit, an incredible 2D-graphics framework. Developers had plenty to chew on for a whole year, and Sprite Kit gave everyone the capability to make simple iOS games with relative ease.

However, the 3D space continued to be largely inaccessible, requiring expert knowledge of computer graphics (OpenGL ES), or a sizeable wallet (Unity Pro).

Well, not anymore. :]

A teaser for the SceneKit chapters in the Wenderlich publishing empire’s iOS 8 By Tutorials, which we’d recommend purchasing as part of the Swift By Tutorials bundle, as we did!

UPDATES: #18, Games: Scene Kit

kconner / KMCGeigerCounter: Make your app click like a geiger counter every time it drops a frame.

Example: A Nice First Person Shooter Control Scheme For SceneKit Games

Merry Swiftmas from InfoQ

A Simple SceneKit Material Editor in Swift

SceneKit for Absolute Beginners has a number of SceneKit articles

Depth of Field in SceneKit

New in iOS 9: Filtering SceneKit Nodes with Core Image Filters

Continue Reading →


Gotta hand it to those Facebook engineers, they just keep coming up with cool stuff these days, and they’ve downright outdone themselves with AsyncDisplayKit:


AsyncDisplayKit is an iOS framework that keeps even the most complex user interfaces smooth and responsive. It was originally built to make Facebook’s Paper possible, and goes hand-in-hand with pop’s physics-based animations — but it’s just as powerful with UIKit Dynamics and conventional app designs.

AsyncDisplayKit Nodes are a thread-safe abstraction layer over UIViews and CALayers…

“Thread-safe” and “UIViews”? Cool beans!

Yup. All those things. Go do them!


AsyncDisplayKit Tutorial: Achieving 60 FPS scrolling

Continue Reading →

Resource Management: xcres

Well, this is the handy-dandiest resource helper we’ve seen in a while:

mrackwitz/xcres: xcres searches your Xcode project for resources

xcres searches your Xcode project for resources and generates an index as struct constants. So you will never have to reference a resource, without knowing already at compile time if it exists or not.

It includes loose images, .bundles, asset catalogs (.xcasset) and even .strings in the index.

It gives you code autocompletion for resources and localized string keys, without the need of an Xcode plugin.

Especially if your app is a bit more complex, this will greatly improve your workflow. It ensures a better quality and gives you more safety. You will see directly when a resource is missing, when you renamed it, or you moved it around.

Furthermore it won’t even bother you for trivial name changes like change capitalization or converting name scheme from train-case or snake_case to camelCase and vice versa.

It will warn you in Xcode on build, if certain resources or string keys can’t be references, because their name contain invalid chars, duplicates in the camelCase variant with another key, or would be equal to a protected compiler keyword…

We tend to keep our resource references pretty much in order by reflex when writing them actually, but looks like this might make that more streamlined. And looks like it would be downright invaluable the next time we’re handed some mess to make sense of written by someone who regarded the concept of ‘maintainability’ with fear and loathing apparently…

h/t: CocoaControls!


Working with Localization in iOS 8 and Xcode 6 describes new string functionality

Continue Reading →
0’s Functional Programming In Swift

As you’ve probably noticed us gushing over here and there, is the highest-quality programming journal in the history of ever for us epicurean iOS-centric types; so when we noticed that the good folk over there have branched out into books,

Functional Programming in Swift

  • Thinking Functionally: Get to know the functional 
programming paradigm
  • Functional APIs: Designing functional, composable, and type-safe APIs
  • Purity: Benefits of value types and immutability
  • Purely Functional Data Structures: Use recursive enums to write simple data structures
  • Parsing & Evaluating: A functional parsing library and a simple spreadsheet app as example
  • Map, Filter, Reduce: Higher-order functions and functional manipulation of collections
  • Optionals: How Swift solves the “missing value” problem, and why that’s a good idea
  • Enums: Create your own data types with Swift’s enums for clarity and type safety
  • Generators and Sequences: Understand the machinery underlying Swift’s collection types
  • Applicative Functors and Monads: Common patterns underlying functional code

we figured the least we could do in thanks was go buy it … especially since the last time we did any real functional programming was a course so way back in the day that it used a pre-1.0 Haskell version. So y’know, a little help here to catch up on the last two and a half decades, probably in order, yes. Besides, we were immensely amused with Messr. Florian’s blog post about floundering around during the writing process.

And our evaluation is, they’ve done an absolutely wonderful job here. If you’re not fluent in functionalese, it gets the GO BUY IT RIGHT NOW rating; and if you are, there’s still enough Swift specificities and useful code right up to the complete spreadsheet implementation mentioned above that we’re completely confident you’ll find it more than worth the read!


Non-Swift intros: An introduction to functional programming; Functors, Applicatives, And Monads In Pictures

7 Habits For a More Functional Swift

Swift Functional Programming Tutorial; Getting into functional programming with Swift

What is Functional Reactive Programming?; SimpleSwiftFRP: What Is It All About?

Enough About Swift Closures to Choke a Horse; Instance Methods are Curried Functions in Swift; Swift Function Currying; Closure Expressions in Swift; First Class Functions and Delayed Evaluation in Swift; Functions are Just Named Closures; Handling Multiple Closure Parameters; Curry take-out with a side of Image Processing

Introduction to Function Currying in Swift; Function Currying in Swift

Adopting map() & reduce() in Swift; Function Composition in Swift; Swift: The Tao of Mappage; Maps… Wait, They Don’t Love You Like I Love You; Flattenin’ Your Mappenin’; What do map() and flatMap() really do?; map() can be taxing

Functor and Monad in Swift; Monads; Swift Adventures In Monad Land; Functor and Monad in Swift; Monads in Swift; Paragons Of Perfunctory Programs; Swift Functors, Applicatives, and Monads in Pictures; Three Useful Monads; What The Heck Is A Monad; Let’s talk about Monads

Tail Recursion Explained

Immutable Types with Changing State in Swift; Conveniently Transforming Immutable Types in Swift; Mutating Functions in Swift Structs

Proof in Functions

Functional Wish Fulfillment

A straw man argument for trying more functional-style programming in Swift

Efficient JSON in Swift with Functional Concepts and Generics; SwiftyJSON; Nice Web Services, Swift Edition

TypeLift: “Libraries to simplify development of Swift programs by utilising the type system.”

Basis: “Pure Declarative Programming in Swift, Among Other Things.”

Swiftz: “functional data structures, functions, idioms, and extensions that augment the Swift standard library.”

LlamaKit: “Collection of must-have functional Swift tools.”

Going Global: A Peek At Swift’s Global Functions

Creating ASCII art in functional Swift is very stylistically functional.

A Swift Spelling Corrector

Zip, Map and Generics: The Evolution of a Swift Function; A Test Driven Custom Swift Zip Function Using Generics;

Generics in Swift, Part 1 and Part 2

Functional Programming: Understanding the Beauty of Custom Operators in Swift

Swift currying in practice

Swift Optionals, Functional Programming, and You

Continue Reading →
Page 3 of 99 12345...»