Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Alamofire vs URLSession: a comparison for networking in Swift

Alamofire and URLSession both help you to make network requests in Swift. The URLSession API is part of the foundation framework, whereas Alamofire needs to be added as an external dependency. Many developers doubt whether it's needed to include an extra dependency on something basic like networking in Swift. In ...
Swift

How to use for loop, for each, while, and repeat in Swift (in-depth)

For loop, for each, and repeat are examples of control flow statements in Swift. Although most of them look similar, there are differences. Let's go over them one by one and see when you should use which. For loop usage in Swift The for loop might be the most well-known ...
Swift

QR Code generation with a custom logo and color using Swift

A QR Code is used a lot to share content or to add a new user in apps like Twitter and Snapchat. Since iOS 11 it's possible for users to scan a QR code with the built-in camera app. This makes it even nicer to integrate a QR code in ...
Swift

SwiftLee 2018 in review: Top Swift Development blog posts

With 2019 coming closer it's time to review SwiftLee in 2018 and list the top swift development blog posts of this year. The best thing about this all is that I can say that I've reached thousands of fellow Swift developers and possibly inspired or taught them with something they ...
GeneralSwift

Implementing Siri support using NSUserActivity, intents and shortcuts

Siri support can be added using an Intent and an IntentUI extension. This adds quite some overhead and is not always the easiest way in a big project, as you need shared logic between the main app and the extension. A much easier way to implement Siri support is by ...
Swift

Measure the performance of code in Swift

It's important in any type of programming language to know how to measure the performance of code as there are many different ways to write solutions and not every solution is as performant as the other. If a piece of code turns out to be slow in, for example, the ...
OptimizationSwift

Performance, functional programming and collections in Swift

Functional programming is often done in Swift and so easy that it could easily hit performance. Iterating over large collections and performing actions like filter or map is common and should be used wisely. Performance is often decreasing when these methods are combined, like a filter followed by first. A ...
OptimizationSwift

SwiftLint valuable opt-in rules to improve your code

SwiftLint is a tool by Realm to enforce Swift style and conventions. It's proven to be adopted by a lot of developer with over 10.000 stars on Github. 149 Rules are available for you to use from which a lot are enabled by default. In this post, we're going over ...
OptimizationSwift

Updating to Swift 4.2

Swift 4.2 is a major release and shipped with Xcode 10. It comes with a lot of code improvements for which the best way to start is to watch the WWDC 2018: What’s New in Swift session. Some of the improvements are easy to implement in your existing code. Replace ...
Swift

Defer usage in Swift

Although the defer keyword was already introduced in Swift 2.0, it's still quite uncommon to use it in projects. Its usage can be hard to understand, but using it can improve your code a lot in some places. The most common use case seen around is opening and closing a ...
Swift

CompactMap vs flatMap: The differences explained

CompactMap and flatMap, what are the differences and when do you use each? Swift 4.1 introduced this new method with the proposal 0187: Introduce Filtermap to gain more clarity in flatMap use cases. When to use compactMap Use this method to receive an array of nonoptional values when your transformation ...
Swift

Compiler Diagnostic Directives using a hashtag in Swift

The Swift standard library brings quite some compiler diagnostic directives by default. Although this might not ring a bell at all, a lot of them are quite known and listed in the Swift repository. Warning Warning can be used to manually trigger a warning on the given line. This can ...
DebuggingSwift