Category Archives for Swift

swift extensions

Swift: Extensions

Like categories in Objective-C, extensions in Swift give you the opportunity to add functionality to a type. This is not only possible for your own types, but also for types for which you don’t have access to the source code.

Continue reading
state of swift

March 2017: The Current State Of Swift

In February 2016, I published a post that discussed the state of Swift at that date. Time to look what has changed since then.

Continue reading
sorting arrays

Sorting Arrays in Swift

Sorting arrays is a very common task. Swift has a built-in feature that is fast and easy to use. In this article you’ll learn all the details.

Continue reading
retain cycles

Retain Cycles, Weak and Unowned in Swift

Memory management, retain cycles and the usage of the keywords weak and unowned are a little bit confusing. On the other hand it’s very important to understand this topic properly because retain cycles are one of the major reasons for memory problems. But don’t worry! In this article you will learn everything you need to know.

Continue reading
filter

Swift: filter

Swift provides you some handy functions like filter and map for manipulating arrays. In this post we will take a look at filter and how you can combine it with map.

Continue reading
use cases for guard

Swift: Use Cases For Guard

The keyword guard has been introduced in Swift 2. It was a little bit inconspicuous at the first sight, but it has a lot of power. In this article we will take a look at three uses cases for guard.

Continue reading
try!

try!

Error handling is a very important topic and I’ve written already a blog post about that topic. You can also check out my talk about that topic on the Swift Summit in San Francisco. In this post we will discuss when you should use try!. Hint: This post has been updated to Swift 3, iOS 10 […]

Continue reading
Nil Coalescing Operator

Swift: The Nil Coalescing Operator

The so-called Nil Coalescing Operator is an interesting operator, that you can use for working with optionals.

Continue reading
c-style for-loops

Swift: Avoiding C-Style For-Loops

C-style for-loops will be removed in Swift 3. This may seem a little bit strange at first sight. But Swift has some features that allow better loop structures. C-style for-loops Let’s start by looking at the following C-style for-loop:

It works, but it’s neither very handy nor very “swifty”. In fact, it’s not so easy […]

Continue reading
state of swift

February 2016: The Current State Of Swift

Recently there were some interesting reports and articles about the state of Swift. In this post we will discuss them and put them in perspective.

Continue reading
Swift and Objective-C

How To Use Both Swift And Objective-C In One Project?

The Swift and Objective-C interoperability is very good so that it is very easy to use both Swift and Objective-C in one project.

Continue reading

Swift: Public Properties With Private Setters

In Swift you can easily create public properties with private setters. It makes your code much safer and shorter.

Continue reading