iOS Open Source @ The Distance

iOS Open Source @ The Distance

Here at The Distance we’ve been working hard to consolidate our code bases and create core frameworks that can be reused throughout multiple projects. This helps us to develop faster and write safer code as any bugs identified or introduced with new OS versions can be fixed once and deployed to all apps. Today, we’re really pleased to announce the first open source offerings of this refactoring.

The Distance Core

Our first project is based on convenience code. Key features include:

  • Managing Multiple Storyboards
  • Managing Parallax Scroll
  • Pure Swift Key-Value-Observing and Object Targets

The code is well documented and available now on GitHub to be integrated using Carthage. We’d love for you to get in touch with comments, feedback and suggestions. We will be releasing more frameworks over the coming weeks and can’t wait to share it.

Storyboard Loader

Storyboards can easily become bloated and slow to load, however most can be separated into related parts. Managing which View Controller is in which storyboard can be messy if done throughout the app. The StoryboardLoader protocol simplifies this by allowing you to define enums for your Storyboards and ViewControllers and instantiate them using single call StoryboardLoader.instantiateViewControllerWithIdentifier(_:).

Parallax Scroll

Most modern detail pages contain some background content such as hero images which gets hidden behind the content as the user scrolls. Adding a small parallax scroll adds a nice visual touch. The ParallaxScroll protocol makes it easy to add this functionality – and doesn’t result in any image stretching or squashing.

NotifcationObserver / ObjectObserver / ObjectTarget

Its easy to take observing for granted with Objective-C but it is a feature of NSObject. If you have pure Swift classes that want to interact with in NSObjects using observing you would have to either move your class to inherit from NSObject or implement selector forwarding methods. These three classes wrap up that functionality into simple classes with strongly typed closure interfaces making for neater observing throughout your app.

Coming Soon…

TheDistanceCore is the first project we are opening up to the community. We have other frameworks coming for keyboard management, presenting selections, custom form creation and more. Keep checking back for updates and get in touch via GitHub with comments and requests – we’d love to here from you.