All Apps   Steps+   Twitter   Contact   RSS  

Migrating UserDefaults to App Group
June 23, 2019

Recently, I decided to work on a few features for Steps+ that essentially require a lot of my the App's data be in an App Group.

I began the endeavor by doing a quick Google search, which led me to a solution that I ended up modifying slightly and shipping. Here is the snippet I found.

As for the code I ended up shipping to solve this problem, It ended up looking like this:

final class Migrator: NSObject {
    private let from: UserDefaults
    private let to: UserDefaults
    private var hasMigrated = false
    init(from: UserDefaults, to: UserDefaults) {

Read more

Default Protocol Implementations are Dangerous
February 26, 2017

This problem has been written about and discussed briefly in a few forums, so I will only go over it as briefly as I can here; and then I will jump into a way the Swift language and/or compiler could potentially mitigate this issue. Because of this, I am gonna use a pretty simple and relatively contrived example. Let's get into it.

The Problem

Default implementations in Swift protocols are a fundamental part of how the Swift Standard Library works, as well as many other systems in our applications. They can be useful for adding behavior to existing types, or providing default behavior for...

Read more

Speeding Up Compile Times of Swift Projects
December 30, 2016

There are a couple of long-winded articles around about how to do this specific technique, however I have not seen anything quick and to the point.

The first thing you are going to want to do is turn on Whole Module Optimization in Debug (by default, it is only on in Release).

Here are the optimization settings:



The next thing you want to do is specify -Onone in Other Swift Flags in Debug like so:

This will allow Whole Module Optimization compile the whole module at once while also not doing any optimization of the code.

By using this technique, I have seen...

Read more

October 15, 2016

I recently released a new open source project that allows you to automatically comment on stale GitHub pull requests - it's called RemindBot.

Check it out and let me know how you like it!

January 31, 2016

I released an Xcode plugin in the InitializeMe repo - called Phoenix.

This allows you to select a couple properties and create a custom initializer filling out those properties. My main uses for this are for creating initializers for classes that only hold data, and for constructor based dependency injection.

Phoenix supports both Objective-C and Swift.

Installation instructions are available on the GitHub repo.

If you do not want to install a custom Xcode plugin - you can simply download the Cocoa app (currently called InitializeMe), in the same repo.

Preventing subclassing in Objective-C
January 9, 2016

For those of you still using Objective-C, I found a cool attribute that allows you to basically define final classes.
The attribute is __attribute__((objc_subclassing_restricted))

For example:

@interface MyClass : NSObject

The compiler now will prevent any subclassing of MyClass!

December 22, 2015

I opened source a framework called Fission the other day.

The best way for me to describe it, and the reasons for it are on the Github page, so I will simply quote it here:
Mostly an attempt to consolidate my most used/useful functions/operators into one place that has all of these things, as well as provide more flexibility than similiar frameworks.
Feel free to use the framework and let me know what you think!

My case for garbage collection in Swift
December 4, 2015

Now that Swift thas been open sourced - the ability to make a backend in Swift is much most accessible (since you can now run it on Linux).

Something I think Apple should do, is implement garbage collection for Swift. Even though the recent history of Apple with regards to garbage collection, didn't end well for Objective-C.

First here are the higher level reasons I think a garbage collector should be added by Apple:
  1. Memory leaks become a much larger problem in server side software
  2. I believe someone will have a fork of Swift that implements garbage collection
The reason I think memory...

Read more

Common Model Antipattern
November 19, 2015

In the vast majority of native client side software, it is common to create client-side model objects from a server representation (most commonly JSON).

This is the flow that see the most:
  1. Request an API endpoint and download JSON response
  2. Convert JSON to a Dictionary
  3. Initialize/update a model directly with the dictionary itself
The antipattern I see here, is number 3.

Here are the reasons I believe this to be a problem:
  1. Ties creation of your model to a specific dictionary format, and at some level the API endpoint (and clients have to know this fact AND the format)
  2. Creates...

Read more

Steps+ 2.0
November 12, 2015

I released a new version of Steps+.

What I added:

1. Floor counting
2. Themes
3. Support for iPhone 6s and iPhone 6s Plus

This was long overdue, let me know how you like it!

Page 1 of 2 Next page