MVVM -> Avoiding the “Imperative Soup”

The Setup After working with MVC and MVP in cocoa touch for the last few years, I think it’s time to take a step back and consider the MVVM approach. Recently, I watched a talk given my Ben DiFrancesco where he discusses how and why you should adopt MVVM in your projects. Ben explains how adding … [Read more…]

Victor – a SiriKit Case Study

Lately I’ve been toying with the idea of making a connected garden assistant device. The device itself would be an Arduino like MCU node with an array of sensors that all relay information back to an app. Ultimately, the data provided by these sensors would help you take better care of your plants. This is … [Read more…]

Using Closures in Xcode Playgrounds

When starting to learn Swift, you will eventually want to explore creating Swift closures as asynchronous completion handlers. Naturally, you’ll try and fire up a Playground and wire up a function that takes another function as an argument. But when you want to test your completion execution, you might have noticed that the debug console … [Read more…]

Hacking with Swift -> Lazy Initialization

All hail Lazy Initialization     Lazy initialization, also known as lazy loading, is one of those tools every developer should know. When lazy loading, we don’t need to instantiate the property on class initialization time. This is great if you have a bunch of expensive objects you need to create in your view controller, but not … [Read more…]

How to Create a Swift CocoaPod swiftly

Credit: xkcd CocoaPods are an incredibly helpful tool for incorporating dependencies into your Xcode projects. But what if you want to create your own pod to share as an open-source project or for internal use? This is exactly where I am today and I decided to document my findings as a reference to myself and … [Read more…]

Swift in-out variables – passing by reference

Passing by reference is sometimes convenient depending on your needs. Luckily, if you’re using Swift, it’s pretty simple. In Swift, you can add the inout keyword in place of var. Here’s an example:

 

What the heck is a Monad?

  Credit: xkcd Lately, I’ve been attempting to transition more of my code from Objective-C to Swift. Consequently, I’ve also been trying to wrap my head around some of Swifts functional aspects like Functors and Monads. Knowing that functional programming can sometimes seem overtly academic and less practical, I was somewhat reluctant to begin my studies. … [Read more…]