Articles
In-depth articles about iOS programming, techniques, language features, architectual patterns, and beyond.
In-depth articles about iOS programming, techniques, language features, architectual patterns, and beyond.
We can group related data in a SwiftUI list using Section view. We can also optionally add a header and footer to describe a particular section. Let's learn how to do that.
SwiftUI Divider has some limitations, but you can overcome that with modifiers. Let's explore its limitation and capability.
In this tutorial, we will learn how to create a circular progress bar in SwiftUI using just three SwiftUI views.
There are two ways to set a font size for Text view in SwiftUI. Let's see what they are and how to set them.
At the beginning of a project, there are a lot of changes and uncertainty. You might want to start modularizing your code in the later phase, where the scope is clearer. Let's see how to prepare your single module project to support future modularizing.
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).
Learn how to make derived variables observable in GetX.
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.
Many things can go wrong when you write an asynchronous function in Dart. Let's learn how to use Future, async, and await properly.
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.
I couldn't initiate IntelliSense for a long time because I couldn't find any Keyboard shortcuts for "IntelliSense". If you are in the same situation, I have a solution for you.
We have no way to set the minimum lines of Text in SwiftUI, but you can have that with this bit of hack.
There might be several reasons that cause this error. I will share the solution that works for me.
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.
If you use Proxyman with a Flutter app, you might not see any traffic from your Flutter Project. Here is how to fix it.
Modular programming is a software design technique that breaks your project into a smaller maintainable module which promotes separation of concern and reusability. Let's see how easy it is to modularize an iOS app with Swift Package.
As your team and project grow, you might need to enforce some coding rules to make your code go the same direction. Luckily, adding custom lint rules in Flutter is very easy. Let's learn how to do it.
Learn how to use a launch argument to override UserDefaults value and test your apps.
Learn what launch configuration is and how to use it.
Not every website got a search function. If you found an interesting site and want to explore more topics within that site, you can do it with the help of a search engine of your choice.
A transparent navigation bar is quite popular among the design community. It is just a matter of time before you have to do it. We will explore different ways to do that in this article.
In iOS, we can control a button enabled/disabled state by setting an isEnabled property. In Flutter, you won't find such attributes. Let's learn how to do it.
Find out where we can get information about the iOS version market share.
Reset push notification permission on macOS isn't as straightforward as how we do it on iOS. Let's see how to do it.
When you run a Flutter app for the first time, you probably notice a debug banner in the upper right of the screen. Learn what it is and how to remove it.
If you prefer to review pull requests with an editor but hate the clone or checkout process, you can enjoy the review process without the hassle with new github.dev web-based editor.
Learn how to apply gradient colors to a SwiftUI text view.
Learn how to make notification permission dialog popup again like the first time you run the app.
Learn how to make hexagon-shaped profile pictures in SwiftUI.
Align text within a container view in SwiftUI isn't a straightforward operation as you might think. Let's learn how to do it.
Each language has its own characteristic. Some are more verbose than others. Some have special characters that take up vertical spaces. Some even read and lay out from right to left. Let's see how to make sure your layout is ready for this.
Learn what we can customize when relying on automatic synthesizing Codable for enums with associated values.
A tip for creating multiple schemes to quickly run your app in different languages.
A label might seem trivial, but it plays an important role in SwiftUI. Let's learn about this simple view.
Swift 5.5 extends the support for the automatic synthesis to enums with associated values. Learn what can be expected from the synthesis code.
Xcode has a feature to generate code coverage since version 7. Let's see how to enable it and what you can expect from this feature.
Learn how to write custom XCTest assertions that match the behavior of the built-in ones.
When using an image in iOS, you have an opportunity to control how you want the image to be rendered. Most of the time, you don't need to care about this, but when images do not render the way you want, make sure you know how to customize them.
iOS introduces a new concept to SF Symbols, SymbolVariants. Let's see how this improves the way we interact with symbols.
If you are not ready to make your app support dark mode, you can opt-out of that. You can do disable it for an entire app or partially. Learn different ways to disable dark mode in iOS.
When you start a new project, you would see either of these attributes in an AppDelegate file. Let's find out its functionality.
By default, when you set an image to an UIButton, it will position on the leading edge of the text. Let's learn how to put it on the trailing edge instead.
Initializing an NSViewController without nib isn't straightforward as UIViewController. Trying to do so would result in a runtime error. Let's learn how to do that.
There is no way to add a custom font for each language. Luckily, we can indirectly set that with fallback fonts. Let's learn how to do it.
Learn how to use local custom fonts that bundle with your application in WKWebView. It isn't hard, but not very obvious how to do it.
macOS is tightly coupled with storyboard and xib than iOS. To build your UI entirely in code, we have to do some initial setup.
Both Xcode and Simulator can simulate location, but they serve different purposes. The Simulator provided a quick and easy way to simulate location and movement. On the other hand, Xcode offers more customization. Let's learn the differences so you can pick the right tool for your needs.
In iOS, you can add and use a custom font to your app and use it like other assets. The process is not hard, but it might not be straightforward as adding an image. Let's learn how to do it.
When you convert HTML string to NSAttributedString, sometimes, you will get an extra unwanted bottom padding. Learn what is causing this and how to mitigate the problem.
We can use a frame modifier to make a view appear to be full width and height, but the result might not be what you expected.
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.
Every switch statement has a default case. Every do-catch statement has a catch clause. Should every if statement has an else clause?
Learn the difference between all-new alert APIs in iOS 15.
?? is an operator that has one specific use case. Let's find out what it is.
In iOS 15, we finally have native UI for a bottom sheet. Let's explore its behavior and limitation.
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.
Learn how to create an outline button style.
The thing you should know before using the convertFromSnakeCase decoding strategy.
It might not be obvious that we can create a custom environment value, but we can do that. The steps to create one are not as straightforward as we usually do, but it isn't hard if you know how to do it.
Trying to reference two methods with the same name and parameters will cause an ambiguous compile error. Learn how to resolve it.
If you have ever worked with an app with multiple alerts, please beware that the system can present only the latest or outermost one. Let's see how we can mitigate this.
Learn how to show an alert (UIAlertController) in SwiftUI.
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 how to make UIScrollView, UITableView, and UICollectionView ignore safe area insets and put their content behind that navigation bar.
Learn a workaround to specify a type for your generic functions.
Once the sidebar is collapsed, there is no way to get it back. Learn how to mitigate the situation.
Learn how to change button configuration, e.g., title and color, based on the internal and external changes.
In UISearchController, we can set search bar hiding behavior with hidesSearchBarWhenScrolling property. But how to control this behavior isn't obvious in SwiftUI. Learn how to control search bar hiding behavior in SwiftUI.
Working on your MacBook without an external monitor can be troublesome due to the small screen size. I will show you 4 Xcode shortcuts that might mitigate the situation.
The idea that you can use one codebase for multiple platforms and cut development time by half is tempting, but what do you trade for this time saved?
SwiftUI finally got native search support in iOS 15. We can add search functionality to any navigation view with the new searchable modifier. Let's explore its capability and limitation.
Learn how to import .cer and p12 to Fastlane match without nuke or creating a new one.
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 how to create, export, and import certificate without any third-party tools.
Asking for sensitive data like location is hard. Learn how Apple makes it easier with the new Location Button.
New in iOS 15, SwiftUI has finally support preview in landscape orientation. Let's find out how to do it.
Each Xcode version comes with a specific Swift toolchain. If you want to prepare your app for a new feature and make it work with CI, you want to make your tools, e.g., Fastlane and xcodebuild know about the new toolchain. Let's see how we can switch between different Swift toolchains with command-line tools.
The first part in the series "What's new in UIKit button". An introduction to a new button configuration, a struct that is shaping and styling your button. You no longer need to subclass UIButton ever again with button configuration.
Each Xcode version comes with a specific Swift toolchain, but you don't have to wait for a new Xcode version to try the new Swift features. Let's see how we can switch between different Swift toolchains in Xcode.
SwiftUI got a native way to add UIRefreshControl in iOS 15. Let's find out how to add it in the list view and even your custom view.
Learn different ways to change status bar text color in Flutter.
Learn different ways to change the back button color in Flutter.
Learn how to make a transparent app bar in Flutter.
Learn an easy way to read the information in Info.plist.
Learn how to create a separate environment for your app with the help of Configuration and Scheme. Create a different app and variables for each environment on the same codebase.
We can make a simple bevel effect using two inner shadows. SwiftUI has a built-in way to add a drop shadow with the shadow modifier. But if you want to add an inner shadow effect, you need to be a bit creative.
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.
Leaning tips and tricks about the tool will help you down the road. Today, I will show you 4 Xcode shortcuts that I find helpful when dealing with SwiftUI.
Setting background color in SwiftUI is not as straightforward as UIKit. Let's learn how to do it.
Learn how to fit an image view to any container.
In UIKit, we have various ways to control an image's position and behavior in UIImageView with a help contentMode property. In SwiftUI, we only have fit and fill content mode. Let's see how we can replicate the rest.
Learn how hard or easy it is to add a background view in SwiftUI.
SwiftUI doesn't have a built-in way to preview for a device in landscape orientation at the moment, but we can simulate that with a few modifiers.
Learn thirteen ways to position and resize UIImage in UIImageView.
@StateObject is an essential property wrapper in SwiftUI, but I found the way to initialize them is not obvious.
A brief summary of init and scaffold commands.
Learn how to use aspect fit and aspect fill content mode to fit your image to its bounds.
Learn how the scaffold command helps you to bootstrap new components or features such as a new VIPER module or a new framework for your new feature.
Show and hide transition animation in ZStack can be glitchy. Learn how to fix it with a simple trick.
Learn how to use, and limitations of tuist init, a command that bootstrap a new project.
The template is a way to group repetitive code structure into a reusable component. You will learn how to create them in this article.
Apple announced the App Store Connect API back in WWDC18. It provides an official way to interact with App Store Connect, and Fastlane already supports this. With a recent 2FA enforcement from Apple, it is time for you to adopt it.
There might be several reasons that cause this error. I will share one that just happened to me.
Learn how tuple can help you in sorting.
Learn the way to create the UISegmentedControl equivalent in SwiftUI.
We will see how hard (or easy) it is to add a new unit testing bundle target to your Xcode project with Tuist.
In iOS, if you want to delete the app's UserDefaults, you can simply delete the app. But that is not the case for macOS and Catalyst app.
An easy question that you might overlook. Learn this simple fact together in this article.
Xcode 12.5 brings many great updates and features. One of them is the ability to record a video of the app directly from the Simulator app.
Part 4 in the series "Building Lists and Navigation in SwiftUI". We will explore a NavigationView, UINavigationController equivalent in SwiftUI.
A brief introduction to Tuist, a command-line tool that helps you generate Xcode projects.
Learn how to fit image view to any container by changing Content Hugging Priority and Content Resistance Priority.
Learn how to sort an array of objects with multiple criteria.
Part 3 in the series "Building Lists and Navigation in SwiftUI". We will explore a List, UITableView equivalent in SwiftUI.
Learn how to overload existing operators such as +, -, *, / or create a custom one (such as .^.).
Part 2 in the series "Building Lists and Navigation in SwiftUI". We will explore a ScrollView, UIScrollView equivalent in SwiftUI.
Learn how SwiftUI shares application settings and preference values across the app.
Part 1 in the series "Building Lists and Navigation in SwiftUI". We visit the first building block of any list view, content, and how to create them.
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.
SF symbols are icon sets that Apple design to work with their system font. Learn how to change its color and how to show them in multicolor style.
There might be several reasons that cause this error. Here are the solutions that fix it for me.
Learn a proper way to sort an array of strings in each circumstance.
Learn how to format a Float and Double string.
There might be several reasons that cause this error. I will share one solution that fixes the one that happened to me the most.
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.
Learn a lesser-known API to create a custom UIStackView spacing without nested them together.
Font is an essential part of an app. A good selection of font would make your app stand out from the crowd. But whatever fonts you choose, you have to make sure it doesn't lose its core function, readability. You might feel reluctant to use a custom font in the past because you might lose the benefit of dynamic type goodness that Apple provides with their system font. Since iOS 11, this is no longer the case. You can easily use your custom font dynamic type.
It is a hidden gem in Xcode that can save up your coding time. Learn what it is, how to use it, and some use cases.
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.
Print debugging is the simplest form of debugging technique, but it possesses some drawbacks. Let's see how we can make it better by using Xcode breakpoints.
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.
Learn how to lets users save an image outside of your app’s sandbox.
Three language features around Swift enumeration that you might not aware of.
Learn how to write unit tests for delegate/protocol methods.
SwiftUI provides an easy way to convert to render any view into a placeholder style by redacting its content.
In the past, the way I test a custom URL scheme is to go to Safari and open up any of my custom URLs. If you are still doing that, there is a better alternative.
Fastlane Match saves us a lot of time managing certificates and provisioning profiles, but there is one thing that we have to do it manually. That is a renewal expired certificate. Luckily, we have to do it once a year. Let's learn how to do it.
In iOS 14, we have a new way to put images along with texts.
Learn how to create protocols that constrain their conforming types to a given class.
Apple adds a new way to control where the back button will pick up its title. Let's see how this make thing a lot easier going forward.
We finally get SVG supported and the best thing is it is backward compatible with some limitations.
In iOS 14, long-press on the back button will bring up a history stack. Learn what you should consider with this new behavior.
SKOverlay is a new tool from Apple for doing apps cross-promotion.
In iOS 14, we finally have a way to set a toolbar for a view in a navigation view.
Learn how to set a navigation bar title view in SwiftUI.
This modifier can interpolate position and size between two views. This is one of the most exciting features for me. Let's see what is capable of in this beta.
The most popular question since the introduction of SwiftUI. Here is my thought after WWDC20.
A new way to create a reusable view.
A view controller is one component where memory leak usually takes place since it holds many pieces together. One of the easiest ways to detect them is to see if a view controller is not being deallocated. Let's see how Xcode breakpoint can help you find a leak.
I can't tell it is a stupid or genius algorithm, but it sure got a beauty in it.
Explore how delay and repeatForever affect an animation.
To set a custom image for the back button, we need to set an image to both backIndicatorImage and backIndicatorTransitionMaskImage, but what does backIndicatorTransitionMaskImage really mean?
Learn how UIStackView can help to make your UI adapt to size change.
Learn how to set shadow spread and blur from a Sketch design.
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 to round specific corners, e.g., top-left and top-right.
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.
When you work with an API, there would be a time when your backend wants to control a text style, and HTML is the most common format for the job. Do you know that WKWebView is not the only way to present HTML string? Learn how to render it in UILabel and UITextView.
There are a lot of hacky ways to modify or remove a back button title. This tip will show you how to do it properly.
Testing is a process we do along with our development. Knowing shortcuts would help you save some time, which will add up in the long run.
Introduce you to one of an essential part of iOS theming. What is tintColor and its benefit.
Introduction of SF Symbols, learn the basics, and how to use them.
Create a reusable boilerplate snippet that you can use in the project.
If you are still declaring class-only protocols by inheriting them from class, you might need to revise your knowledge.
Neumorphism or Neomorphism is a new design trend of UI recently. We are going to see how to implement this in SwiftUI.
Swift Package Manager is getting better every day. It is a matter of time before everyone supports it. When the time comes, make sure you know how to say goodbye to this old friend.
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.
Modify AppDelegate or SceneDelegate to support a non-storyboard approach.
A guide to creating an activity-ring-like circular progress bar in SwiftUI. An in-depth tutorial of what I think when making a custom view. At the end of this article, you will be able to create the Activity ring used in the Activity app on Apple Watch.
A new and easier way to test Apple push notification on iOS simulator.
SwiftUI has built-in ways to apply gradient color to its view. We are going to explore all three types of gradients provided, LinearGradient, RadialGradient, and AngularGradient.
Most complex custom views can be made by composing many basic shapes together. Today we will learn basic operations that we can do with them. It may seem trivial, but knowing these basics will benefit you in the future.
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.
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.
A guide to decode a gibberish crash report to a human readable format.
How to cache Pods, Ruby gem, and Carthage in your iOS project.
A cheat sheet that tells you what colors to use to support dark mode. This is a guide for those who want to adopt dark mode, but too lazy to figure out which color to use.
Learn how to do all of this without any external tools.
Revisit of navigation bar appearance — this time with a UISearchController. If you have a search bar in your navigation bar, you might need to recheck when you build your app against iOS13.
The last part in a series on understanding data in SwiftUI. See all tools SwiftUI provided to declare different types of data and dependency. Learn when and how to use @State, @Binding, ObservableObject, @ObservedObject, @EnvironmentObject, and @Environment.
Part 2 in a series on understanding data in SwiftUI. We will talk about the key that makes principles in part 1 possible in SwiftUI. And how this resulting in a reduction of the complexity of UI development.
Part 1 in a series on understanding data in SwiftUI. In the first part, we will try to understand the importance of data and how they play an essential role in SwiftUI.
Required modifications to make your newly created project work in iOS 12 or lower.
Apple brings a lot of appearance changes in iOS13, and the navigation bar is one of them. Cover everything you should know once you build your app against iOS13 (Xcode11).
A long-awaited feature has finally come to iOS. Join it or not is your choice to make. This article will guide you through it.
In iOS13, the modal presentation gets a new look and dismissal gesture. This article will talk about what you can do with these new welcoming changes.
Learn how to create a custom subclass of UIHostingController and its benefit.
Learn a crucial concept in SwiftUI, view modifier, and a guide of how to create your custom modifier.
Say goodbye to optional properties in your view controllers. In iOS13, you can inject those properties at a time of view controller creation.
WWDC session shows us a way to create UISplitViewController with NavigationView in SwiftUI. It finally works in Xcode 11 Beta 3.
SF Symbols contain over 1,500 icons. It would be hard if you don't know the existence of SF Symbols App.