14 Mar 2016 in Tech
In Swift, I try to use protocols as often as I can. I also like to use enums as often as is appropriate. Often times I find myself with an enum conforming to some protocol or another. For every property I implement, I have to switch self
to get the right value – and this can get really old, really fast.
Luckily, Swift lets you have private types that you can use to make your enums a whole lot shorter! This is just a quick tip that I came across the other day. You won’t believe what comes next!
read more...
07 Mar 2016 in Tech
If you’re developing in Swift and using the Swift Package Manager to manage your dependencies, you may have noticed that you can’t easily use Xcode to write your project. You aren’t able to import any of your dependencies into your package, and so tons of errors appear.
This is how I created a new project and integrated it with my dependencies build with spm.
read more...
09 Feb 2016 in Tech
Swift has reference types and value types. Even within the value types, there are different options to use! It can be kind of confusing to know when to use which. Knowing a little bit about what types work in which situations can really help out.
Here are some of the ways I differentiate the different value types in my own head, and some rules of thumb of when I use which.
read more...
20 Jan 2016 in Tech
Swift is a protocol oriented language, and I’ve found I can really provide a lot of power as well as flexibility by making good use of protocols.
The other day I was chasing down a confusing bug. For some reason my protocol methods weren’t being called!
It turns out protocol extension methods can be unintuitive sometimes.
read more...
23 Sep 2015 in Tech
Pretty much everyone uses the Swipe Back feature that you get for free with UINavigationController. But what happens when you add some awesome animated transitions for your push actions? You can’t swipe back anymore!
I found a way around this! Though, it does feel a bit hacky…
read more...