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.
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...
Speeding Up Compile Times of Swift Projects 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.
December 30, 2016
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...
RemindBot I recently released a new open source project that allows you to automatically comment on stale GitHub pull requests - it's called RemindBot.
October 15, 2016
Check it out and let me know how you like it!
Phoenix I released an Xcode plugin in the InitializeMe repo - called Phoenix.
January 31, 2016
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 For those of you still using Objective-C, I found a cool attribute that allows you to basically define
January 9, 2016
The attribute is
@interface MyClass : NSObject
The compiler now will prevent any subclassing of
Fission I opened source a framework called Fission the other day.
December 22, 2015
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 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).
December 4, 2015
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:
- Memory leaks become a much larger problem in server side software
- I believe someone will have a fork of Swift that implements garbage collection
Common Model Antipattern 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).
November 19, 2015
This is the flow that see the most:
- Request an API endpoint and download JSON response
- Convert JSON to a
- Initialize/update a model directly with the dictionary itself
Here are the reasons I believe this to be a problem:
- 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)
Steps+ 2.0 I released a new version of Steps+.
November 12, 2015
What I added:
1. Floor counting
3. Support for iPhone 6s and iPhone 6s Plus
This was long overdue, let me know how you like it!
Functions As Factories
November 6, 2015
I wrote something over at the Cocoa Tumblr blog, check it out.
Page 1 of 2 Next page