Photo by Danielle MacInnes on Unsplash

Hi iOS Developers,

I’m guessing we have all experienced the pain of spending a lot of time implementing a function, only to realize later that Swift has a built-in function that does the same thing. In this article, I will talk about a few useful protocols that can save you much time and take your code to the next level.

1. CaseIterable

The CaseIterable protocol allows you to retrieve all the values of the type. Let’s take a look at an example:

Without CaseIterable:

enum City {
case new_york
case bei_jing
case vancouver
let cities: [City] = [.new_york, .bei_jing, .vancouver…

Photo by Jon Tyson on Unsplash

Hi iOS Developers,

In one of my previous articles, I discussed some powerful protocols to take your code to the next level. Today, I’m going to tell you about some handy keywords to streamline your code. Please check out my previous article if you are interested, Long story short, let’s jump right into it.


In general, the switch statement only executes one case. If we want to continue the execution to the next case, we can use the fallthrough keyword. Here’s an example:

Let’s say we’re developing a weather app. We need to check the authorization status. …

Photo by Sam Dan Truong on Unsplash

Hi iOS Developers,

Building apps is very time-consuming. Knowing the tool to use is critical. Xcode is a great tool that has a lot of built-in features that help developers save lots of time. Today, we are going to talk about some of the great Xcode features you might not be aware of. Let’s get started!


Sometimes, we need to write reusable code in multiple places. Copy and paste are great shortcuts for that but aren’t very efficient. Xcode Snippets allows us to create reusable code snippets that can easily be added to the code.

Photo by lalo Hernandez on Unsplash

Hi iOS Developers,

Building a complex app can take as much time as we might otherwise take to build a small house. Those of you who have done this know that I’m not exaggerating. So finding ways to save time and build the app in a more efficient way is important. One way to save a lot of time is to Integrate with third-party libraries to write cleaner code. Today, I’m going to talk about some popular third-party Swift libraries you can access that can accelerate our development speed.


Although Swift provides a lot of built-in functions and properties, often…

Photo by Mihály Köles on Unsplash

Hi iOS Developers,

Swift has a lot of built-in data structures that allow the program to store a collection of data, such as Array and Set. These two are great, they are very easy to use and have a lot of useful built-in functions and properties. But they are not safe. The elements in Arrays and Sets are randomly accessible. Anyone can access any element at any time, which is insecure in some situations. Here’s where Stack and Queue come in to play.

Unfortunately, Swift doesn’t provide built-in data structures for Stack and Queue, so we need to do that…

Photo by Hannah Tasker on Unsplash

Hi developers,

Reactive programming is getting more and more attention since Apple announced its Combine framework. Unfortunately, however, the Combine framework is only available for iOS 13.0+. In the meantime, we can still install the RxSwift framework. But the RxSwift framework is huge. It may increase the size of the app unnecessarily, especially if we are only using it to accomplish some simple tasks. Here’s when Key-Value Observing comes into play.

In this tutorial, we are going to build a reactive application using Key-Value Observing. …

Photo by KS KYUNG on Unsplash

Hi iOS Developers,

I talked about many types of keywords in my previous stories. Keywords, along with protocols and attributes, are powerful features that can streamline our code. But today, I’m going to talk about a particularly interesting group of keywords, those that begin with a number sign (#), sometimes known as a hashtag. Some of these keywords may not immediately strike you as useful, but it’s worthwhile to know about them in case you ever have a need for them.

I’m going to assume that most of us are already familiar with #available, #else, #elseif, #endif, #if and #selector

Hi iOS Developers,

In the previous stories, I talked about useful keywords and protocols. Today, I’m going to talk about the attributes in Swift that you must know if you want to advance your iOS development skills.


This attribute allows developers to create custom property wrappers with classes, structs, or enumerations. For example, we can create a property wrapper to always convert String values to uppercase.

struct Uppercased {
var wrappedValue: String {
didSet { wrappedValue = wrappedValue.uppercased() }
init(wrappedValue: String) {
self.wrappedValue = wrappedValue.uppercased()

In order to make Uppercased a property wrapper, it must have…

Photo by Dominik Vanyi on Unsplash

Building apps is hard, and it’s even harder to debug. Since Xcode 5.0, Apple introduced the XCTest framework, which allows developers to build test automation for apps. Unit Testing automates the testing process, catches errors before the apps run, and saves developers a lot of time. In this story, let’s talk about all the assertions that are available for writing Unit Tests.

XCTAssert(expression: Bool)

This function generates success when the expression is true.

func testAssertion() {
let number = 2
XCTAssert(number > 1) // success
XCTAssert(number == 1) // failure

XCTAssertTrue(expression: Bool)

This function is very similar to the XCTAssert(expression: Bool), it generates…

Dylan Chen

Senior iOS Engineer. Nothing is better than solving complex problems with clean, elegant code. Buy me a coffee at:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store