A tip to prevent error and improve readability when dealing with numbers.
Swift 5.7 introduced a new syntax for optional binding. Let's see what it is and how it can improve our code.
The available attribute (@available) is another tool that helps you cope with API changes. Let's see how this is different from the availability condition (#available).
Every year Apple introduces new features to the system, and sometimes they have to deprecate some old APIs to make room for the new ones. Change is an inevitable thing in programming. Let's learn how to handle the changes.
Type placeholders allow us to write a type placeholder (_) in a place where type is expected. A compiler will automatically infer the type of that placeholder. But what is the benefit of it? Let's find out.
A type alias declaration introduces a named alias of an existing type into your app. You can think of it as defining a nickname for an existing type. Let's learn the benefit and when to use them.
Learn how to use a launch argument to override UserDefaults value and test your apps.
Learn how to parse ISO 8601 date with ISO8601DateFormatter.
Learn what we can customize when relying on automatic synthesizing Codable for enums with associated values.
Swift 5.5 extends the support for the automatic synthesis to enums with associated values. Learn what can be expected from the synthesis code.
Learn how to make a case insensitive enum.
When you start a new project, you would see either of these attributes in an AppDelegate file. Let's find out its functionality.
In Swift 5.5, we can apply button style using leading dot syntax, .buttonStyle(.plain), instead of a full name of a concreate type, .buttonStyle(PlainButtonStyle()). Let's see how we can make our custom button style support this.
By learning about the key path, you open up yourself to an opportunity to improve your existing API or even create a new one that you don't aware you can do it.
?? is an operator that has one specific use case. Let's find out what it is.
There are many ways we can satisfy a closure argument. Some of them do not even look like closure. Let's learn all of them in this article.
The thing you should know before using the convertFromSnakeCase decoding strategy.
Trying to reference two methods with the same name and parameters will cause an ambiguous compile error. Learn how to resolve it.
It is tempting to just catch all a throwing error in a single catch clause and call it a day, but not all errors are created equals, and you should treat it as such.
Learn a workaround to specify a type for your generic functions.
We have a new way to format data into a localized string in iOS 15. Why do we need another formatter? How does it differ from the old one? Let's find out.
Learn an easy way to read the information in Info.plist.
As the name implies, a property wrapper is a new type that wraps a property to add additional logic. Let's see what it capable of and the benefit it provided.
Learn how tuple can help you in sorting.
An easy question that you might overlook. Learn this simple fact together in this article.
Learn how to overload existing operators such as +, -, *, / or create a custom one (such as .^.).
Learn how to check if a string contains another string, numbers, uppercased/lowercased string, or special characters.
String comparison is an essential operation for day to day job. Swift provides a few variations for this. We will visit them in this article.
Learn to convert a string "123" to an integer 123.
Learn a proper way to sort an array of strings in each circumstance.
Learn how to format a Float and Double string.
Learn how to use this expensive DateFormatter.
If you are working on iOS for long enough, there is a chance that you might have known that DateFormatter is expensive, but what is costly about DateFormatter? Let's find out in this article.
Learn a few ways to do it and things you should know when using them.
There are a few variations when dealing with counting days. You need to ask yourself some questions beforehand.
Date and time might be among your list of the hardest things in programming (It is for me). Today, I'm going to talk about a basic concept of a Date and its companion DateComponents.
Learn the meaning of @escaping, so you know what to do when you see it or when you need to write one.
Equatable and Hashable are two essential protocols in the Swift world. Let's learn an old Swift feature that you might forget.
NSUserDefaults is a go-to database for saving users' preferences. Learn how to populate it with your default values.
Three language features around Swift enumeration that you might not aware of.
Learn how to write unit tests for delegate/protocol methods.
Learn how to create protocols that constrain their conforming types to a given class.
I can't tell it is a stupid or genius algorithm, but it sure got a beauty in it.
Learn how to get a suffix from a Swift string.
When working with an unstable, legacy, or third party API, you might get a malformed object in an array. Learn how to decode a JSON array with corrupted data in Codable safely.
Learn how to get a prefix from a Swift string.
Learn how to check your app version strings are higher or lower.
Learn different ways to split a string into an array of substrings.
The default appearance of UIButton is a single line text, but it also supports a multi-line text with some minor tweak.
Learn different ways to define Auto Layout constraints programmatically.
A tip to declare a custom initializer without losing a memberwise initializer.
Struct is one of the basic building blocks in your app. Today I'm going to share some tips about memberwise Initializers.
Introduction of SF Symbols, learn the basics, and how to use them.
If you are still declaring class-only protocols by inheriting them from class, you might need to revise your knowledge.
When I want to keep some information or configuration out of a code base and don't want something fancy, I usually save it as Property List file. Let's see how to do it.
Part forth in a series Sign in with Apple. Use Sign in with Apple JS to let users set up accounts and sign in to your website and apps on other platforms.
How to print object (po) in a debugger (lldb) without escape special characters.
Part 3 in a series Sign in with Apple. In this part, we will see how backend can use the token to sign up/sign in users.
Learn about this Swift attribute and its purpose.
Part 2 in a series Sign in with Apple. In this part, we will talk about the anonymous email address. How to make it work and its limitation.
Part 1 in a series Sign in with Apple. In the first part, we will focus on the app part. What we need to do to add Sign in with Apple option in our app.
Learn how you should write a code that shows your true intention.
Learn a crucial concept in SwiftUI, view modifier, and a guide of how to create your custom modifier.
See all tags.