Posts

Swift Design Patterns in Practice: the Decorator Pattern

Welcome to the first publication of “Swift Design Patterns in Practice," a series of concrete use-cases of design patterns in real-world iOS applications. Today we will cover the Decorator Pattern and how it may be used when implementing the…
clean-style-code

How to Keep Clean Style Code in Swift

Let's talk about how to keep a clean style code in Swift. You've just finished your new app, and you go to show it off to a friend, and they say "Those red buttons look kind of harsh. What if you changed them all to be blue instead?" Your heart…

Server APIs Work Group: Building a Solid Foundation for Swift

When Apple announced that Swift would be open-sourced and available for Linux, developers immediately began writing server software and frameworks in Swift with Vapor, Kitura and Perfect emerging as the top three. With very little provided…
prevent-memory-leaks-In-Swift-closures

How To Prevent Memory Leaks In Swift Closures

A memory leak occurs in an iOS app when memory that is no longer in use is not properly cleared and continues taking up space. This can hurt app performance, and eventually, when the app runs out of available memory, will cause a crash. In order…
swift

Would Async/Await Work In Swift/iOS?

In this post, we will discuss if Async/Await work in Swift/iOS. Today, Swift doesn't have a language-level solution to writing asynchronous code. If it did, this is the article I'd write to explain how it works. (Probably in Swift 7 - after…

Creating A Custom UICollectionViewLayout in Swift

UICollectionView in iOS is a very useful and powerful class for displaying large sets of data. However, with great power comes great configurability, and this configurability can make it tedious for simple use cases. A common use case for a…
Value-Types-and-Reference-Types-in-Swift

When to Use Value Types and Reference Types in Swift

Let's talk about Value Types and Reference Types in Swift. Since Apple released Swift, there has been a lot of attention paid to value types. Especially coming from Objective-C where almost everything is a class (reference type), the fact that…
array and arrayslice in swift

Swift Subarrays: Array and ArraySlice

Swift has a nice syntax for grabbing subarrays: let array = [1, 2, 3, 4, 5, 6] let subarray = array[0...2] // Yields [1, 2, 3] However, subarray here isn't an Array like you may expect, it is an ArraySlice. For the most part, this doesn't…
protocol methods in swift

How Do I Implement Optional Delegate Protocol Methods In Swift Without @objc ?

Optional protocols methods in Swift - right now - don't exist unless the protocol is tagged with @objc. So far, this has been an acceptable solution for providing optional method functionality. I will argue that this is a poor way…
swift

Three Features That'd Be Real Swifty

So far, I have enjoyed Swift. I'm still a bit curmudgeonly about having to explain - in great detail - what I want to the compiler like it was a small child that keeps asking "Why?," but there is value to it. There are some nuances…

Implications of Apple Swift for Developers

Every June, anyone involved in the software world celebrates the 'Apple New Year' -- the World Wide Developer Conference. WWDC. It is, of course, a time for celebration. Applications that were once impossible become possible. Improvements…