Articles

In-depth articles about iOS programming, techniques, language features, architectual patterns, and beyond.

Animating number changes in SwiftUI

iOS 17 bring a new trick to animate number in SwiftUI. Let's learn how to do it.

How to create custom view modifiers in SwiftUI

Learn how to create reuse styles using ViewModifier.

How to request users to review your app in SwiftUI

Learn how and when you should ask for a user's review.

How to copy text to the clipboard in iOS

Learn how to copy and paste text from clipboard in iOS.

How to request users to review your app in UIKit

Learn how and when you should ask for a user's review.

How to dismiss Keyboard in SwiftUI

Learn how to programmatically dismiss a keyboard in SwiftUI.

How to break multiple nested loops in Swift

Learn how to break out of the outer loop from the inner loop.

Create Button with Rounded Corner Border in SwiftUI

Learn different ways to create a Button with a Rounded corner Border in SwiftUI.

How to get Root view controller in Swift

In this article, I will show you a quick and dirty way to get a root view controller in an iOS app.

iOS
Different ways to map over Dictionary in Swift

Learn how to map function work with Swift dictionary.

How to convert Degrees to Radians in Swift

In this article, we will learn different ways to convert Degrees to Radians in iOS.

How to fix "libobjc.A.dylib is being read from process memory" error

If your app takes forever to run on a device and you get this error in the console log. I will share what works for me in this article.

How to convert between NSAttributedString and AttributedString

SwiftUI lacks the support for the old NSAttributedString but fully supports this new type. On the other hand, UIKit supported NSAttributedString but lacked the support of AttributedString in most APIs. Learn how to convert between the two, so you can use any of them in the platform you want.

Better print for AnyKeyPath in Swift 5.8

Swift 5.8 improve the information that is printed out for a keypath.

How to convert Radians to Degrees in Swift

In this article, we will learn different ways to convert Radians to Degrees in iOS.

Default Value in Swift Dictionary

Learn how to set and get value from a dictionary with a default value.

How to hide a Navigation Back button in SwiftUI

Learn a simple way to hide a back button in SwiftUI. And whether we should hide it or not.

ContentUnavailableView in SwiftUI

A dedicated SwiftUI view to present an empty state for your app.

How to fix "dyld: Library not loaded @rpath" error

You probably get this error when you try to add a third-party framework to your project. Let's learn one way to fix it.

How to add a Toolbar in UINavigationController

Learn how easy it is to add a toolbar on a view controller in UIKit.

Observation Framework in iOS 17

In iOS 17, Apple introduced a new and simpler way to make a view response to data changes.

Floating Action Button in SwiftUI

iOS doesn't have a Floating Action Button, but we can easily recreate it using what we have in SwiftUI.

How to Filter an Array in Swift

Swift Array has an instance method, filter(_:), that removes unwanted elements from the resulting array.

Bookmark in Xcode 15

Xcode 15 brings one of the great features of Xcode, the ability to bookmark your code.

How to use NSAttributedString in SwiftUI

Learn how to use an old NSAttributedString inside a SwiftUI app.

Built-in symbol animations in UIKit controls

In iOS 17, we can enable symbols animation in UIKit controls using the new property. Let's learn how to do it.

SwiftUI Plain Button Style cannot tap on an Empty space

The plain button style has behavior and appearance different from the other styles. Let's learn how this affects a tappable area.

Animate SF Symbols with symbolEffect

In iOS 17, you can animate SF Symbols with the new modifier. Let's learn how to do it.

Access Images and Colors with Enum in Xcode 15

Xcode 15 can automatically create Swift symbols for your resources without any third party. Let's learn how to do it.

Apply Small Caps for unsupported language in SwiftUI

You might want to use small caps to make your UI more interesting, but not all languages and typography support small caps. Let's learn how to solve this in iOS 17.

How to test In-App purchases in Development

You can't use your Apple ID when making an in-app purchase during the development. Let's learn how to do it.

Little big improvements in Xcode 15

Small improvements that make a big difference in day-to-day coding.

How to preview UIViewController in Xcode Previews

You might not be aware that you can enjoy the benefit of Xcode Previews even though you are still using UIKit. In this article, I will show you how to preview a view controller using Xcode Previews.

What's new in SF Symbols 5

In iOS 17, we can animate SF Symbols with the symbolEffect modifier.

Xcode Previews with UIKit and AppKit in Xcode 15

Learn about the Xcode Previews improvement in Xcode 15.

How to preview UIView in Xcode Previews

If you use UIKit, you can preview your view using Interface Builder. But you can also preview a custom view that is created programmatically using Xcode Previews.

SwiftUI Button can't tap on a background

Learn how to make the whole area of a button tappable.

How to Disable swipe down to dismiss Sheet in SwiftUI

By default, you can dismiss a sheet presentation using a swipe-down gesture. But you might don't want this behavior on every sheet. Learn how to disable it in SwiftUI.

Allow implicit self for weak self captures, after self is unwrapped

Swift allows implicit self in many places. It removes visual noise and allows developers to focus on things that matter. In Swift 5.8, Swift expands the case, which enables the implicit self to be used.

Back deploy Swift Function

Does this mean we can finally enjoy the new SwiftUI feature while still supporting old versions of iOS? Let's find out.

Find Callers of methods or variables in Xcode

Callers or Call Hierarchy shows you all the places where a method, function, or variable is used. You can easily find callers in Xcode.

What is contentInset in a scroll view

Learn the importance of content inset.

#file behavior change in Swift 5.8

In Swift 6.0, the behavior of the #file will change. Prepare yourself for the change.

How to make Empty Space Tappable in SwiftUI

If you have ever added a tap gesture to a VStack or HStack, you might notice that space between content in a stack isn't tappable. Learn the reason and how to mitigate the problem.

How to use AttributedString in UIKit

Learn how to use the new AttributedString inside UIKit components.

How to set ContentInsets on SwiftUI List

In iOS 15, SwiftUI can indirectly set content inset using the safeAreaInset modifier. Let's learn how to do it.

How to check if code is in DEBUG or RELEASE build in Swift

Learn how to compile code only on a specific build configuration.

Xcode Previews: What is it, and how to use it

Xcode Preview has been through many updates and iterations. Learn what we can do in the latest version.

Remove all limitations on variables in result builders

Swift 5.8, we have more flexibility in declaring local variables inside a result builder.

Detecting if SwiftUI app is in Xcode Previews

Learn how to detect whether an app is running in Xcode Previews.

How to make Large size ProgressView in SwiftUI

In iOS 16, we can also set the size of a ProgressView, but it isn't straightforward as we do in UIKit. Let's learn how to do it.

How to use SFSafariViewController in SwiftUI

In this article, I will teach you what I think is the proper way to present SFSafariViewController in a SwiftUI app.

Configure Launch screen in UIKit without Storyboard

In Xcode 12 and iOS 14, we got a new way to configure an app launch screen without a Storyboard. Let's learn how to do it.

How to open URL in Safari in SwiftUI

In SwiftUI, there are two ways to open a URL in Safari, Link view, and openURL environment value.

Conditional compilation for Attributes in Swift 5.8

Let's learn about the new conditional directive, hasAttribute.

How to initialize @Binding in SwiftUI

Learn how to implement a custom init that accepts a @Binding variable.

Stable Sort in Swift

Is Swift sorting stable or not?

WebView in SwiftUI

Learn how to open a URL or a web view in SwiftUI.

Getting All cases of Enum with Swift CaseIterable

There will be a time when you want to get an array of all enum cases, such as when you want to present them in a list or picker. CaseIterable protocol is what you are looking for.

Configure Different Launch screens based on URL Scheme

Since iOS 14, you can have multiple launch screens responding to different URL schemes. Let's learn how to define it.

iOS
SwiftUI Form Styling

At the moment (iOS 16), there is no specific way to style a Form. But you can style it based on the style that SwiftUI chooses for that platform. In iOS, Form uses a List view style.

How to Open using Rosetta in Xcode 14.3

If you are using Xcode 14.3 or later, you might notice that the option to open Xcode in Rosetta is no longer available. Let's find out what changes.

What's New in Swift 5.8

Learn about all the Swift 5.8 updates.

How to Hide Navigation Bar on Tap in UIKit

Since iOS 8, we can easily add a tap gesture to show and hide a navigation bar and toolbar. Let's learn why and how to do it.

Create Button with Image in SwiftUI

Learn how to use an image as a button's label and how to adjust its color.

How to pop view from Navigation stack in iOS 16

Let's learn how easy it is to pop or dismiss a view from a NavigationStack, a new navigation view in iOS 16.

Custom Back button in SwiftUI

Learn how to create a custom back button in SwiftUI.

How to Reload view in SwiftUI

Learn how to refresh a view with new data in SwiftUI.

How to fix "You are not authorized to make purchases of this InApp in Sandbox at this time" error

You might encounter this error when testing an In-app purchase in Sandbox mode. Let's learn how to fix it.

What are Character and Run in AttributedString

Learn about the two important views in AttributedString, characters, and run.

How to Hide Toolbar on Scroll in iOS

Since iOS 8, we can easily hide a toolbar when users scroll. Let's learn why and how to do it.

How to remove the First row separator in SwiftUI List

Learn how to remove the topmost separator in any List view.

How to pop View programmatically in SwiftUI

Learn how to pop a view from a navigation view in SwiftUI.

How to create SwiftUI Picker from Enum

An Enum is one of the data structures that best represents options for the Picker view. Let's learn what we need to do to make an enum usable in a Picker.

AttributedString in iOS 15

Learn a new improvement struct of an NSAttributedString.

How to set Info.plist Values based on Build Configuration in Xcode

Learn how to configure Info.plist value per build configuration.

Configure Launch screen in SwiftUI using Storyboard

Configure a launch screen via Info.plist is quite limited. If you want greater control and flexibility, you can use a Storyboard as a launch screen instead.

How to preview SwiftUI Layout without device frame

Learn how to preview SwiftUI view without a distraction of a device frame.

How to Hide Navigation Bar when Keyboard is shown in UIKit

Since iOS 8, we can easily hide a navigation bar when we show the keyboard.

Swift fileprivate vs private

Learn the difference between two similar access levels in Swift, private and fileprivate.

How to add Launch Screen in SwiftUI

If you create a new SwiftUI project, you won't see a launch screen storyboard anymore. Learn how to configure a launch screen in the SwiftUI world.

How to whitelist files in .gitignore

Learn how to re-include an ignored file in .gitignore.

How to Deprecate old API in Swift

In Swift, we have many options to mark a method deprecated. Let's explore all of them.

How to Play Haptic Feedback or Vibrate using UIFeedbackGenerator

Learn what Haptic feedback is and how to use it.

How to change Command + Click behavior in Xcode

Command + click is my go-to shortcut when coding. Let's learn how to modify its behavior.

How to Run code in Release build in Xcode

Learn how to run it on the Release build configuration, which is the one Xcode used for the App Store.

How to Hide Navigation Bar on Scroll in UIKit

Since iOS 8, we can easily hide a navigation bar when users scroll. Let's learn why and how to do it.

Allow users to manage In-App Subscription in SwiftUI

In iOS 15, we finally got a way for users to manage their subscriptions right within the app.

Swift In-Out (inout) Parameters

Learn what is an inout parameter and how to use it.

How to remove Back button title in SwiftUI

Learn a proper way to remove a back button title in SwiftUI.

How to fix "No exact matches in call to initializer" error in Swift

This error can happen in many places. Based on the message, it might not be obvious what is causing it and how to solve it. Let's learn how to fix it.

4 Picker styles in SwiftUI Form

Explore all possible picker styles, so you can choose the one that suits your needs.

What's new in Xcode 14.3 and iOS 16.4

In this article, we will quickly go through some of the new features in Xcode 14.3 and iOS 16.4 that I find interesting.

SwiftUI ProgressView

Learn what progress view is and how to use it.

Computed property vs Method: Which one to use

A read-only computed property can use interchangeability with a method with no arguments. The question is, which one to use?

SwiftUI TabView

Learn how to use a tab view in SwiftUI.

Timer in SwiftUI

The ability to run some code periodically is an important task in iOS development. Let's learn how to do it in SwiftUI.

Swift Ternary operator (?:)

The Ternary operator is quite similar to if-else statements, but it isn't the same. Let's learn what it is and how to use it.

What is SwiftUI Form

Learn what Form is, how to use it, and the difference from a List view.

Swift private access level change in Swift 4

In Swift 4, there is a change in the private access level that means to end the use of fileprivate. Let's learn what it is all about.

Easy way to Format Date in SwiftUI Text

Since iOS 14, SwiftUI Text has had many initializers dedicated to presenting dates. Let's explore all of them.

Adding and Removing Swift Package dependencies in Xcode

Since Xcode 11, we can easily integrate Swift Package dependencies into our project. Let's learn how to do it.

SwiftUI Checkbox

Learn how to create a checkbox in iOS with SwiftUI.

What is Info.plist in Xcode

Learn what it is and where to find it.

How to use SwiftUI as UIView in Storyboard

Learn how to use SwiftUI view as a UIView in a UIKit project that uses a Storyboard.

How to Pop to the Root view in SwiftUI

In IOS 16, SwiftUI comes up with a better way to manipulate a navigation path. This makes it possible to pop a navigation stack to the root view.

How to remove duplicate items from Array in Swift

Learn how to do that using the Swift Algorithms module and without it.

How to manage Safe Area insets in Flutter

Learn what Safe area insets are and how to utilize it.

Custom Back button Action in SwiftUI

Learn how to have custom logic for a navigation view back button.

How to use SwiftUI in Storyboard using UIHostingController subclass

We can create a view controller that represents a SwiftUI view by subclassing a UIHostingController. Let's learn how to do it.

How to use SwiftUI as UIViewController in Storyboard

Learn how to use SwiftUI view as a UIViewController in a UIKit project that uses a Storyboard.

How to change Background color of Rounded Corner Border Button in SwiftUI

Having both background and border in SwiftUI isn't straightforward. Let's learn how to do it.

Where is Info.plist in Xcode 13

If you create a new SwiftUI project, you will no longer see Info.plist file. Let's learn about this change.

What is Swift Guard Case

The guard-case is a syntax to allow us to precondition check for one specific enum case.

Using SwiftUI in UIKit as UIView

Learn how to use a SwiftUI view as a UIView in a UIKit project.

How to Hide Navigation bar in SwiftUI

Learn how to hide a navigation bar in SwiftUI.

Splash screen vs Launch screen in iOS

Learn the difference between a launch screen and a splash screen in iOS.

How to Disable and Enable Button in SwiftUI

Learn how to disable a SwiftUI button.

How to Save and Read Array in UserDefaults in Swift

Learn how to store an array in UserDefaults.

Using SwiftUI in UIKit as UIViewController

We can use SwiftUI view in UIKit by wrapping it in UIViewController. Let's learn how to do it.

Enable and Disable SwiftUI List rows reordering on a specific row

The onMove modifier enables item reordering on every row. Let's learn how to disable this on particular rows.

Unwrap Swift optional value in Switch case

Learn how to test for unwrapped optional values in a switch statement.

How to change Background Color of Button in SwiftUI

Learn how to change the background color of a SwiftUI Button.

How to join an Array of strings into a Single string in Swift

Learn how to turn ["John", "Alice", "Bob"] into "John, Alice, Bob".

Enable and Disable SwiftUI List rows deletion on a specific row

The onDelete modifier enables item deletion on every row. Let's learn how to disable this on particular rows.

How to initialize final variables in Dart

Learn four different ways to initialize final variables in Dart.

How to change SwiftUI Button Size

Learn how to control the size of a button in SwiftUI.

How to check if an Element is in an Array in Swift

Learn two ways to check if an array contains a given element.

How to organize Flutter import directives in VSCode

Learn how to Remove unused imports and Sort import packages by their name.

How to remove the Last row separator in SwiftUI List

Learn how to remove the bottom separator in any List view.

What is Swift Computed Property

There are two kinds of properties in Swift, Stored, and computed. Let's learn the difference.

How to make Swift Enum conforms to Identifiable protocol

Learn how to make Swift Enum become Identifiable.

What is the difference between #available and @available

#available and @available are features related to the availability of APIs. They are tools that mean to use together. Let's learn the difference and when to use them.

How to Reorder List rows in SwiftUI List

Learn how to enable/disable the reorder ability in SwiftUI List.

Swift mod operator (%)

There might be several reasons that cause this error. I will share the solution that works for me.

What is Button Role in SwiftUI

Learn what it is and how it affects a button.

How to declare Multiline String in Swift

If you need a string that spans several lines, Swift has a multiline string literal that you can use.

How to change Status Bar text color in SwiftUI

Learn how to change a status bar text color in SwiftUI.

How to Delete List rows from SwiftUI List

Learn how to enable/disable the delete ability in SwiftUI List.

What is Swift If Case

Learn how to match a single case of an enum with an if-case syntax.

SwiftUI Button Style Examples

In this article, I will show you all 5 button styles you can use with SwiftUI Button in iOS.

How to fix "The compiler is unable to type-check this expression in reasonable time" error

There might be several reasons that cause this error. I will share the solution that works for me.

SwiftUI Dynamic List View

Learn how to create a list from a collection of data.

How to make parts of Text view Bold in SwiftUI

Learn how to style some parts of SwiftUI Text view.

How to fix preferredStatusBarStyle not getting called

Two common reasons make the preferredStatusBarStyle not getting called.

How to change SwiftUI List section separator color

Learn how to colorize a list section separator.

How to remove List Section separators in SwiftUI

Some list style has section separators. Let's learn how to remove them.

Multiple rows Selection in SwiftUI List

Learn how to allow multiple row selection in SwiftUI List.

SwiftUI Button: Basic usage

SwiftUI made it incredibly easy to create a button compared to how we do it in UIKit. Let's learn how to do it.

How to make equal height subviews in HStack

Learn how to make all subviews in HStack have an equal height.

How to make a Horizontal List in SwiftUI

A list view doesn't support horizontal scrolling, but we can fake it using ScrollView and LazyHStack. Let's learn how to do it.

How to find a font name of a custom font in iOS

When you use a custom font in your iOS app, the font name that you use to initialize UIFont or Font isn't the file name.

Supporting SwiftUI List Selection

Learn how to add list row selection in SwiftUI List.

How to change Status Bar text color in iOS

Learn how to change a status bar text color in UIKit app.

Create SwiftUI List from an Array

It is very common to populate a list view from an array of data. Let's learn how to do it in SwiftUI.

How to dismiss fullScreenCover in SwiftUI

SwiftUI has many ways to dismiss a modal view based on how you structure your view and the minimum iOS version you support.

How to use custom fonts with SwiftUI

Learn how to use a custom font in your SwiftUI app.

What is the difference between List and ForEach in SwiftUI

Even though ForEach and List have similar syntax, they serve different purposes. Let's learn about their differences.

Should we manually call @StateObject initializer

Is it OK to manually initialize @StateObject? Let's find out.

@State variable initialization in SwiftUI

Learn how to initialize a state variable and discuss whether you should do it or not.

How to change List Row separator color in SwiftUI

Learn how to colorize a list row separator.

How to Get Push Notification while iOS App is in Foreground

By default, if an iOS app gets a notification while the app is in the Foreground, the notification banner won't show up. Since iOS 10, you can change this behavior. Let's learn how to do it.

Best Free Fonts for iOS app

A curated list of websites which you can find a free font for your iOS app.

How to remove the SwiftUI List Row separators

In iOS 15, we can remove a List row separator. Let's learn how to do it.

Using ForEach in SwiftUI List

You can use ForEach inside a List view in SwiftUI, but when should we use it? Let's learn in which cases we should use ForEach.

Disable scrolling in SwiftUI ScrollView and List

In iOS 16, SwiftUI finally got a new modifier to disable scrolling in ScrolView and List.

How to show badge on List Row in SwiftUI

Learn how to add and remove a badge on List rows.

How to change a Tab Bar item color in SwiftUI

By default, the selected tab bar item will use the iOS default blue color. Let's learn how to change this in SwiftUI.

How to Upload dSYM to Firebase using upload_symbols_to_crashlytics and SPM

Learn how to upload a dSYM file to Firebase with Fastlane.

Set SwiftUI app theme with AccentColor

An accent color is a simple and unified way to theming your app. This article will teach you how to set a global accent color for your app.

How to scale margin and padding with @ScaledMetric Property Wrapper

Dynamic Type automatically scales a font size according to Accessibility settings. In iOS 14, we also have a way to scale numeric values like padding and margin.

Missing dSYM download link in App Store Connect

You can no longer download dSYM from the App Store Connect.

Building Static List in SwiftUI

Let's learn the easiest way to create a list in SwiftUI.

How to use Non Uppercase in SwiftUI List section header

Most of those styles use uppercase text for the section header. In this article, we will learn how to opt-out of this behavior.

How to adjust List row separator insets in SwiftUI

In iOS 16, we can adjust a List row separator insets with the new alignment, listRowSeparatorLeading.

How to remove nil elements from an array in Swift

Learn how to filter out nil values from a Swift array.

How to change TabView color in SwiftUI

In iOS 16, SwiftUI got a way to change the bottom tab bar background color with the new modifier, toolbarBackground.

How to show badge on Tab Bar Item in SwiftUI

Learn how to add and remove a badge on Tab Bars.

SwiftUI List Style examples

In this article, I will show you all 6 list styles you can use with SwiftUI List view in iOS.

How to dismiss sheet in SwiftUI

SwiftUI has many ways to dismiss a sheet view based on how you structure your view and the minimum iOS version you support.

How to scale custom fonts with Dynamic Type in SwiftUI

Learn how to make your custom font scale automatically like the system one.

How to add Keyboard Shortcuts in SwiftUI

You can easily add keyboard shortcuts to Mac, iPhone, and iPad with the keyboardShortcut modifier.

How to change SwiftUI Font Width

In Xcode 14.1, SwiftUI finally got new APIs to set the font width.

How to create Rounded Corners View in SwiftUI

There are many ways to create a rounded corners button in SwiftUI. Let's learn how to do it.

How to use UIView in SwiftUI

Learn how to use UIView as a SwiftUI view.

How to create Rounded Corners Button in UIKit

There are many ways to create a rounded corners button in UIKit based on the minimum iOS version you want to support. Let's learn how to do it.

How to check if String is Number in Swift

Learn different ways to check if a string is a number.

viewDidLoad() in SwiftUI

Learn how to simulate the viewDidLoad() behavior in SwiftUI using the onAppear modifier.

For loop in SwiftUI using ForEach

When creating an app, there is a time when you want to create a repetitive view or a collection of views from an array of data. We can do that in SwiftUI with ForEach.

How to get index and value from for loop in Swift

Swift has many ways to retrieve an index of an array, but it might not be obvious. Let's learn how to do it.

SwiftUI zIndex: Everything you need to know

zIndex is a modifier that controls the display order of overlapping views in SwiftUI. Let's learn how it works.

How to Show/hide whitespace characters in Xcode

Learn how to make whitespace characters visible in the Xcode editor and why we need them.

SwiftUI List: Basic usage

SwiftUI made it incredibly easy to create a list or table view compared to how we do it in UIKit. Let's learn how to use it.

How to use UIViewController in SwiftUI

Learn how to use UIViewController as a SwiftUI view.

How to add button to navigation bar in SwiftUI

Learn how to add navigation bar buttons in SwiftUI.

SF Font Expanded, Condensed, and Compressed: Three New font width styles in iOS 16

In iOS 16, Apple introduces three new width styles to the SF font family. Let's see what they look like and how to use them.

How to use UIFont in SwiftUI Font

Learn how to convert UIKit UIFont to SwiftUI Font.

How to make SwiftUI button with buttonStyle expand to full width

SwiftUI got many beautiful built-in button styles. One problem you might get is it isn't obvious how to control the size of it. Let's learn how to do it.

Loop n times in Swift

There are many ways to loop in Swift. In this post, I will show you how I do when I want to loop for a specific number of times.

SwiftUI AnyLayout - smooth transitions between layout types

In iOS 16, SwiftUI got a new tool, AnyLayout, that makes it possible to transition between layouts while maintaining the identity of the views.

How to capitalize the first letter in Swift

Learn how to uppercase to only the first letter of a word and sentence.

SwiftUI Gauge

iOS 16 brings a new view to SwiftUI, Gauge. Let's see what it is and how to use it.

How to save enum with associated value in UserDefaults using Swift

Let's learn how to read/write enum with associated value to UserDefaults.

Custom Layout in SwiftUI

If you have a layout that the built-in layout like VStack and HStack can't serve, you can create a custom one in iOS 16. Let's learn how to do it.

How to save enum in UserDefaults using Swift

Enumeration is a type that I think is perfect for representing options for users, but we can't save it directly to UserDefaults. Let's learn how to read/write enum to UserDefaults.

Responsive layout in SwiftUI with ViewThatFit

Making SwiftUI views responsive usually involves a lot of GeometryReaders and if-else. In iOS 16, SwiftUI got a new view that makes it easier. Let's learn how to do it.

What is the fixedSize modifier in SwiftUI

When you read SwiftUI tutorials, you might stumble on the fixedSize() modifier. Let's see what it is and why we need it.

How to change a navigation bar color in SwiftUI on iOS 16

A navigation bar is an essential part of iOS apps. It is a part where we usually apply color to match our branding. In iOS 16, we can customize a navigation bar purely in SwiftUI.

Improve numbers readability with underscores

A tip to prevent error and improve readability when dealing with numbers.

Move the most recent commits to a new branch with git

Sometimes I forget to create a new branch for a new feature and commit changes directly to the develop branch. Let's learn one way to correct this mistake in git.

Variable Color in SF Symbols 4

Variable Color is a new feature of SF Symbols that allows you to change the appearance of a symbol based on a percentage value. Let's learn what it is and how to use it.

Hide keyboard when scrolling in SwiftUI with scrollDismissesKeyboard

In iOS, we have dedicated built-in ways to dismiss the keyboard in scrollable content. Let's learn how to set that in SwiftUI.

Bottom Sheet in SwiftUI on iOS 16 with presentationDetents modifier

In iOS 16, we got a native way to present a bottom sheet in SwiftUI. Let's explore its behavior and limitation.

New way to control number of lines of SwiftUI Text in iOS 16

In iOS 16, we got a big improvement over lineLimit modifiers. Let's see what we can do with it.

UIPasteBoard's privacy change in iOS 16

In iOS 16, Apple allows users to grant or deny pasteboard reading permission before it happens. Let's see what that means to users.

Better way to get paths to system directories in iOS 16

In iOS 16, the URL got a whole pack of type properties that reference a different path within a user domain, e.g., URL.documentsDirectory.

How to change SwiftUI list background color

In iOS 16, we finally got a native way to change the background color of a list view in SwiftUI.

New if let shorthand for optional binding

Swift 5.7 introduced a new syntax for optional binding. Let's see what it is and how it can improve our code.

How to change status bar color in SwiftUI

In SwiftUI, we have no direct way to change a status bar style. But we can indirectly control it through two view modifiers.

How to get AppStore Connect Team ID and Developer Portal Team ID for Fastlane actions

If your Apple account belongs to multiple teams, this can cause Fastlane confusion. Learn how to fix it.

Calendar view in SwiftUI with MultiDatePicker

In iOS 16, we have a new view to select multiple dates. Let's explore its capabilities.

How to create multiline TextField in SwiftUI

In iOS 16, we can create a multiple text field with new initializers and a little help from the .lineLimit(_:) modifier.

Create a mac menu bar app in SwiftUI with MenuBarExtra

In iOS 16, we can create a mac menu bar app without a need for AppKit. Let's learn how to do that.

SwiftUI Grid

iOS 16 add a new Grid view to SwiftUI. A Grid view arranges child views in rows and columns. This table-like structure makes a layout that is hard to do in vertical and horizontal stacks become easier.

How to initialize variables in constructor body in Dart

Initialize instance variable is not as straightforward as you think. Let's learn how to do it.

How to add a TextField to Alert in SwiftUI

iOS 16 add the ability to integrate a text field in an alert.

Little big improvements in Xcode 14

Small improvements that make a big difference in day-to-day coding.

First impressions of SwiftUI in WWDC22

An overview of what's new in SwiftUI.

How to change SwiftUI list row background color

Learn a dedicated modifier to change a list row background color in SwiftUI.

CollectionView in SwiftUI with LazyVGrid and LazyHGrid

Learn the difference between a horizontal and vertical grid and everything you need to know to use them.

Dart initializing formal parameters

Dart has a special syntax for a constructor to initialize all instance variables. It is convenient but also confusing for a newcomer. Let's learn what it is and how to use it.

Dart Parameters

Learn three ways to declare parameters for a Dart function.

7 Xcode shortcuts for a large iOS project

This article will share seven Xcode shortcuts that will help you on a large iOS project. The tricks you are about to learn will help you find and navigate to a file/class/symbol in your large and small project.

How to add section header and footer to SwiftUI list

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.

Divider in SwiftUI - Everything you need to know

SwiftUI Divider has some limitations, but you can overcome that with modifiers. Let's explore its limitation and capability.

How to style SwiftUI text Font

Learn how to set font size, design, weight, and color in SwiftUI.

How to create SwiftUI circular progress bar

In this tutorial, we will learn how to create a circular progress bar in SwiftUI using just three SwiftUI views.

How to change SwiftUI font size

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.

How to prepare your iOS project to support modular architecture

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.

How to handle API Changes with @available

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).

How to create observable variables from other observable variables in GetX

Learn how to make derived variables observable in GetX.

How to handle API Changes with #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.

How to use async/await in Flutter

Many things can go wrong when you write an asynchronous function in Dart. Let's learn how to use Future, async, and await properly.

Swift Type placeholder: What is it and when to use it

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.

How to change the keyboard shortcut for IntelliSense in VS Code

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.

How to force two lines of Text in SwiftUI

We have no way to set the minimum lines of Text in SwiftUI, but you can have that with this bit of hack.

How to fix "Unable to boot the iOS simulator" error

There might be several reasons that cause this error. I will share the solution that works for me.

Swift typealias: What is it and when to use it

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.

How to use Proxyman with Flutter

If you use Proxyman with a Flutter app, you might not see any traffic from your Flutter Project. Here is how to fix it.

How to modularize existing iOS projects using Swift Package

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.

How to add Lint rules in Flutter

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.

How to set UserDefaults value with Launch Arguments

Learn how to use a launch argument to override UserDefaults value and test your apps.

How to run a Flutter app with arguments in VS Code with launch configuration

Learn what launch configuration is and how to use it.

How to search on a website that doesn't have a search function

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.

How to make a transparent navigation bar in iOS

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.

How to disable a button in Flutter

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.

What is the iOS version global market share

Find out where we can get information about the iOS version market share.

How to reset push notification permission on macOS

Reset push notification permission on macOS isn't as straightforward as how we do it on iOS. Let's see how to do it.

How to remove a DEBUG banner in Flutter App

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.

Review Github PR with a web-based editor

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.

How to render text with a color gradient in SwiftUI

Learn how to apply gradient colors to a SwiftUI text view.

How to parse ISO 8601 date in Swift

Learn how to parse ISO 8601 date with ISO8601DateFormatter.

How to reset push notification permission on iOS

Learn how to make notification permission dialog popup again like the first time you run the app.

How to use Label in SwiftUI custom view

A guideline on how to embrace a label in your custom view.

How to draw custom paths and shapes in SwiftUI

Learn how to make hexagon-shaped profile pictures in SwiftUI.

How to align text center/leading/trailing 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.

How to test UI layout for different languages with Pseudolanguages

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.

How to customize automatic synthesizing Codable for enums with associated values

Learn what we can customize when relying on automatic synthesizing Codable for enums with associated values.

How to quickly test apps in other languages with an Xcode scheme

A tip for creating multiple schemes to quickly run your app in different languages.

SwiftUI Label: A standard way to label user interface items

A label might seem trivial, but it plays an important role in SwiftUI. Let's learn about this simple view.

2021: Year in review

A look back at 2021.

Codable synthesis for enums with associated values in Swift 5.5

Swift 5.5 extends the support for the automatic synthesis to enums with associated values. Learn what can be expected from the synthesis code.

How to generate code coverage reports in Xcode

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.

How to change UIImage color in Swift

Learn different ways to color an UIImage in Swift.

How to make custom XCTest assertions show an error at the call site

Learn how to write custom XCTest assertions that match the behavior of the built-in ones.

What is image rendering mode in iOS

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.

What is a variant in SF Symbols

iOS introduces a new concept to SF Symbols, SymbolVariants. Let's see how this improves the way we interact with symbols.

How to decode enums ignoring case in Swift Codable

Learn how to make a case insensitive enum.

How to disable dark mode in iOS

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.

What do @main, @UIApplicationMain, and @NSApplicationMain mean

When you start a new project, you would see either of these attributes in an AppDelegate file. Let's find out its functionality.

How to position an UIButton image to the right side of the text

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.

How to make a macOS menu bar app

Let's learn how to make a simple menu bar app in this article.

How to initialize NSViewController programmatically without nib

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.

How to use different fonts for different languages in an iOS application

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.

How to use custom fonts in WKWebView

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.

How to create a macOS app without storyboard or xib files

macOS is tightly coupled with storyboard and xib than iOS. To build your UI entirely in code, we have to do some initial setup.

How to simulate location in Xcode and Simulator

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.

How to add custom fonts to iOS app

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.

How to remove extra padding when converting HTML to NSAttributedString

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.

How to make a SwiftUI view to fill its container width and height

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.

How to make a custom button style supports leading dot syntax in SwiftUI

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.

What is a KeyPath in Swift

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.

Should every if statement has an else clause

Every switch statement has a default case. Every do-catch statement has a catch clause. Should every if statement has an else clause?

How to present an alert in SwiftUI in iOS 15

Learn the difference between all-new alert APIs in iOS 15.

What does the ?? operator mean in Swift

?? is an operator that has one specific use case. Let's find out what it is.

How to present a Bottom Sheet in iOS 15 with UISheetPresentationController

In iOS 15, we finally have native UI for a bottom sheet. Let's explore its behavior and limitation.

7 ways to pass a closure as an argument in Swift

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.

How to make a custom button style with UIButton.Configuration in iOS 15

Learn how to create an outline button style.

How to set custom CodingKey for the convertFromSnakeCase decoding strategy

The thing you should know before using the convertFromSnakeCase decoding strategy.

How to define custom Environment Values in SwiftUI

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.

How to reference a method with the same name and parameters but a different return type in Swift

Trying to reference two methods with the same name and parameters will cause an ambiguous compile error. Learn how to resolve it.

How to show multiple alerts on the same view in SwiftUI

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.

How to present an alert in SwiftUI in iOS 13/14

Learn how to show an alert (UIAlertController) in SwiftUI.

How to do print debugging in SwiftUI

Learn how to add a print() in a SwiftUI view.

Pop-Up Buttons in SwiftUI

Learn how to create macOS pop-up buttons in SwiftUI.

Different ways to catch throwing errors from Swift do-catch

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.

How to ignore safe area insets in UIKit

Learn how to make UIScrollView, UITableView, and UICollectionView ignore safe area insets and put their content behind that navigation bar.

Spell checking in Xcode

Did you know that you have an option to enable spell checking in Xcode?

How to explicitly specialize a generic function in Swift

Learn a workaround to specify a type for your generic functions.

How to show and hide a sidebar in a SwiftUI macOS app

Once the sidebar is collapsed, there is no way to get it back. Learn how to mitigate the situation.

Dynamic button configuration in iOS 15

Learn how to change button configuration, e.g., title and color, based on the internal and external changes.

Always show search bar in a navigation bar in SwiftUI

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.

4 Xcode shortcuts to get back your screen space

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.

Flutter: How much time do you save, and at what cost

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?

Searchable modifier in SwiftUI: A UISearchController and UISearchBar equivalent

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.

How to manually add existing certificates to the Fastlane match

Learn how to import .cer and p12 to Fastlane match without nuke or creating a new one.

New Formatters in iOS 15: Why do we need another formatter

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.

How to share an iOS distribution certificate

Learn how to create, export, and import certificate without any third-party tools.

A better way to ask for a one-time user's location with the Location Button

Asking for sensitive data like location is hard. Learn how Apple makes it easier with the new Location Button.

Preview a device in landscape orientation with previewInterfaceOrientation

New in iOS 15, SwiftUI has finally support preview in landscape orientation. Let's find out how to do it.

How to use a pre-release Swift version with command-line tools

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.

A new way to style UIButton with UIButton.Configuration in iOS 15

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.

How to use a pre-release Swift version in Xcode

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.

Pull to refresh in SwiftUI with refreshable

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.

How to change status bar text color in Flutter

Learn different ways to change status bar text color in Flutter.

How to change a back button color in Flutter

Learn different ways to change the back button color in Flutter.

How to make AppBar/Navigation Bar transparent in Flutter

Learn how to make a transparent app bar in Flutter.

How to read App Name, Version, and Build Number from Info.plist

Learn an easy way to read the information in Info.plist.

How to set up iOS environments: develop, staging, and production

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.

How to make a simple bevel effect using inner shadows in SwiftUI

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.

What is a Property Wrapper in Swift

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.

4 Xcode shortcuts to boost your productivity for SwiftUI

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.

How to set a screen's background color in SwiftUI

Setting background color in SwiftUI is not as straightforward as UIKit. Let's learn how to do it.

How to resize an image view to fit a container view in SwiftUI

Learn how to fit an image view to any container.

Replicate 12 UIKit's contentMode options in SwiftUI

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.

How to add background to your view in SwiftUI

Learn how hard or easy it is to add a background view in SwiftUI.

How to preview a device in landscape orientation with SwiftUI Previews

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.

NSAttributedString in SwiftUI

Find out what is the SwiftUI way of styling portions of text.

How to resize and position an image in UIImageView using contentMode

Learn thirteen ways to position and resize UIImage in UIImageView.

How to initialize @StateObject with parameters in SwiftUI

@StateObject is an essential property wrapper in SwiftUI, but I found the way to initialize them is not obvious.

What is the difference between Tuist init and scaffold

A brief summary of init and scaffold commands.

How to resize a SwiftUI Image and keep its aspect ratio

Learn how to use aspect fit and aspect fill content mode to fit your image to its bounds.

Tuist scaffold: How to use the Tuist template to create a new module for an ongoing project

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.

How to fix ZStack's views disappear transition not animated in SwiftUI

Show and hide transition animation in ZStack can be glitchy. Learn how to fix it with a simple trick.

Tuist init: How to use Tuist templates to bootstrap your project

Learn how to use, and limitations of tuist init, a command that bootstrap a new project.

Tuist Template: What is it and how to create them

The template is a way to group repetitive code structure into a reusable component. You will learn how to create them in this article.

Using App Store Connect API with Fastlane Match

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.

How to fix "no identity found - Command CodeSign failed with a nonzero exit code" error in Xcode

There might be several reasons that cause this error. I will share one that just happened to me.

Sort array of objects by multiple properties with Swift Tuple

Learn how tuple can help you in sorting.

How to create segmented control in SwiftUI

Learn the way to create the UISegmentedControl equivalent in SwiftUI.

How to add a unit test target to a Tuist project

We will see how hard (or easy) it is to add a new unit testing bundle target to your Xcode project with Tuist.

How to delete UserDefaults data on macOS and Catalyst

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.

How to use SwiftUI Picker

Learn how to use Picker, a UIPickerView equivalent for SwiftUI.

Does Swift enum retain its associated value

An easy question that you might overlook. Learn this simple fact together in this article.

Record iOS Simulator video as mp4 and GIF with Xcode

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.

Navigation in SwiftUI

Part 4 in the series "Building Lists and Navigation in SwiftUI". We will explore a NavigationView, UINavigationController equivalent in SwiftUI.

Getting Started with Tuist

A brief introduction to Tuist, a command-line tool that helps you generate Xcode projects.

How to resize an UIImageView to fit a container view using auto layout

Learn how to fit image view to any container by changing Content Hugging Priority and Content Resistance Priority.

How to sort by multiple properties in Swift

Learn how to sort an array of objects with multiple criteria.

List view, a UITableView equivalent in SwiftUI

Part 3 in the series "Building Lists and Navigation in SwiftUI". We will explore a List, UITableView equivalent in SwiftUI.

How to create custom operators and do operators overloading in Swift

Learn how to overload existing operators such as +, -, *, / or create a custom one (such as .^.).

How to use ScrollView in SwiftUI

Part 2 in the series "Building Lists and Navigation in SwiftUI". We will explore a ScrollView, UIScrollView equivalent in SwiftUI.

What is @Environment in SwiftUI

Learn how SwiftUI shares application settings and preference values across the app.

Create a list of views in SwiftUI using ForEach

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.

Different ways to check if a string contains another string in Swift

Learn how to check if a string contains another string, numbers, uppercased/lowercased string, or special characters.

Different ways to compare string in Swift

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.

TextField in SwiftUI

How to create and use TextField in SwiftUI.

How to change the color of SF Symbols

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.

How to fix "Skipping duplicate build file" warning in Xcode

There might be several reasons that cause this error. Here are the solutions that fix it for me.

How to convert a String to an Int in Swift

Learn to convert a string "123" to an integer 123.

2020 Review

A look back at 2020.

Different ways to sort an array of strings in Swift

Learn a proper way to sort an array of strings in each circumstance.

How to specify fractional digits for formatted number string in Swift

Learn how to format a Float and Double string.

How to use DateFormatter in Swift

Learn how to use this expensive DateFormatter.

How to loop in Swift

Learn different ways of using for loop for each scenario.

How to fix "Build input file cannot be found" error in Xcode

There might be several reasons that cause this error. I will share one solution that fixes the one that happened to me the most.

How expensive is 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.

How to get the first N elements of array in Swift

Learn a few ways to do it and things you should know when using them.

UIStackView padding

Learn how to add padding to your stack view's content.

Custom UIStackView spacing

Learn a lesser-known API to create a custom UIStackView spacing without nested them together.

Scaling custom fonts automatically with Dynamic Type

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.

Multi-cursor editing in Xcode

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.

Getting the number of days between two dates in Swift

There are a few variations when dealing with counting days. You need to ask yourself some questions beforehand.

Understanding Date and DateComponents

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.

What is @escaping in Swift closures

Learn the meaning of @escaping so you know what to do when you see it or when you need to write one.

Better print debugging with Xcode breakpoints

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.

Reduce boilerplate code with an automatic synthesis of Equatable and Hashable conformance

Equatable and Hashable are two essential protocols in the Swift world. Let's learn an old Swift feature that you might forget.

Setting default values for NSUserDefaults

NSUserDefaults is a go-to database for saving users' preferences. Learn how to populate it with your default values.

How to save/export an image in Mac Catalyst

Learn how to lets users save an image outside of your app’s sandbox.

3 lesser-known ways of using Swift enums

Three language features around Swift enumeration that you might not aware of.

Testing delegates and protocols in XCTest

Learn how to write unit tests for delegate/protocol methods.

Make a placeholder view in SwiftUI with redacted()

SwiftUI provides an easy way to convert to render any view into a placeholder style by redacting its content.

Move your view around with Drag Gesture in SwiftUI

SwiftUI's UIPanGestureRecognizer equivalent.

Quick way to open a Custom URL Scheme in iOS Simulator

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.

How to renew an expired certificate with Fastlane Match

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.

How to Add inline images with text in SwiftUI

In iOS 14, we have a new way to put images along with texts.

How to declare Swift protocol for a specific class

Learn how to create protocols that constrain their conforming types to a given class.

A new way to manage the back button title in iOS 14 with backButtonDisplayMode

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.

SVG image assets supported in Xcode 12

We finally get SVG supported and the best thing is it is backward compatible with some limitations.

What should you know about a navigation history stack in iOS 14

In iOS 14, long-press on the back button will bring up a history stack. Learn what you should consider with this new behavior.

Cross-promote apps with SKOverlay

SKOverlay is a new tool from Apple for doing apps cross-promotion.

UIToolbar in SwiftUI

In iOS 14, we finally have a way to set a toolbar for a view in a navigation view.

Custom navigation bar title view in SwiftUI

Learn how to set a navigation bar title view in SwiftUI.

A first look at matchedGeometryEffect

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.

Should I learn UIKit or SwiftUI

The most popular question since the introduction of SwiftUI. Here is my thought after WWDC20.

Add custom SwiftUI view to View Library with LibraryContentProvider

A new way to create a reusable view.

SwiftUI's Toggle Customization

How to create a reusable toggle style in SwiftUI.

Easy way to detect a retain cycle in a view controller

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.

Sleep sort: A sorting algorithm without compare

I can't tell it is a stupid or genius algorithm, but it sure got a beauty in it.

Animation delay and repeatForever in SwiftUI

Explore how delay and repeatForever affect an animation.

How to request a user's location

Learn the proper way of getting user information.

What is backIndicatorTransitionMaskImage

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?

How to change a back button image

Learn how to change a UINavigationBar back button indicator.

Responsive design with UIStackView

Learn how UIStackView can help to make your UI adapt to size change.

Match a view's shadow to the Sketch shadow

Learn how to set shadow spread and blur from a Sketch design.

Different ways to check for String suffix in Swift

Learn how to get a suffix from a Swift string.

Decode an array with a corrupted element

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.

How to set cornerRadius for only some corners

Learn to round specific corners, e.g., top-left and top-right.

How to set status bar style

Learn different ways to control the status bar style.

Different ways to check for String prefix in Swift

Learn how to get a prefix from a Swift string.

How to compare two app version strings in Swift

Learn how to check your app version strings are higher or lower.

How to split a string into an array of substrings in Swift

Learn different ways to split a string into an array of substrings.

How to make multi-line text in UIButton

The default appearance of UIButton is a single line text, but it also supports a multi-line text with some minor tweak.

History of Auto Layout constraints

Learn different ways to define Auto Layout constraints programmatically.

How to preserve a struct memberwise initializer when you have a custom initializer

A tip to declare a custom initializer without losing a memberwise initializer.

Memberwise Initializers for Structure Types

Struct is one of the basic building blocks in your app. Today I'm going to share some tips about memberwise Initializers.

How to display HTML in UILabel and UITextView

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.

How to remove text from a navigation bar back button

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.

Useful Xcode shortcuts for unit testing

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.

tintColor in SwiftUI

We will talk about accentColor, a tintColor equivalent in SwiftUI.

tintColor

Introduce you to one of an essential part of iOS theming. What is tintColor and its benefit.

SwiftUI ButtonStyle

How to create a reusable button style in SwiftUI.

SF Symbols: What is it, and how to use?

Introduction of SF Symbols, learn the basics, and how to use them.

How to create code snippets in Xcode

Create a reusable boilerplate snippet that you can use in the project.

Class-only Protocols: class or AnyObject

If you are still declaring class-only protocols by inheriting them from class, you might need to revise your knowledge.

How to create Neumorphic design in SwiftUI

Neumorphism or Neomorphism is a new design trend of UI recently. We are going to see how to implement this in SwiftUI.

How to remove Cocoapods from your project

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.

How to read a Property List (plist) into the code

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.

How to create a new Xcode project without Storyboard

Modify AppDelegate or SceneDelegate to support a non-storyboard approach.

How to create Activity Ring in SwiftUI

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.

Testing Remote Push Notification in iOS simulator

A new and easier way to test Apple push notification on iOS simulator.

Gradient in SwiftUI

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.

SwiftUI basic Shape operations

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.

Intrinsic content size in SwiftUI

How to define intrinsic content size in SwiftUI

Sign in with Apple Tutorial, Part 4: Web and Other Platforms

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.

Print unescaped string output in Swift

How to print object (po) in a debugger (lldb) without escape special characters.

Sign in with Apple Tutorial, Part 3: Backend – Token verification

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.

Inset grouped List in SwiftUI

How to make .insetGrouped UITableView style in SwiftUI List

What is @discardableResult

Learn about this Swift attribute and its purpose.

Sign in with Apple Tutorial, Part 2: Private Email Relay Service

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.

SwiftUI Animation

Explore how to animate changes in SwiftUI.

Sign in with Apple Tutorial, Part 1: Apps

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.

Manually symbolicate crash reports

A guide to decode a gibberish crash report to a human readable format.

Swift Documentation

How to write documentation comments in your Swift code.

Unwrap optional values in XCTest with XCTUnwrap

No more manual if let and guard let in your tests.

// MARK: - What is it?

If this is just a comment for you, this article might benefit you.

Caching dependencies in Github Actions

How to cache Pods, Ruby gem, and Carthage in your iOS project.

Dark color cheat sheet

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.

Github Actions for iOS projects

How to setup ci for iOS projects with Github Actions.

if let: How not to use it

Learn how you should write a code that shows your true intention.

Dark color

Things you should know about color when adopting dark mode.

Take a screenshot and record a video in iOS Simulator

Learn how to do all of this without any external tools.

UINavigationBar changes in iOS13, Part2: UISearchController

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.

Data in SwiftUI, Part 3: Tools

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.

Data in SwiftUI, Part 2: Views as a function of data

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.

Data in SwiftUI, Part 1: Data

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.

UIRefreshControl with new card style modal

Make sure your refresh control working on iOS 13.

Create a new iOS12 project in Xcode11

Required modifications to make your newly created project work in iOS 12 or lower.

UINavigationBar changes in iOS13

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).

Adopting iOS Dark Mode

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.

Modality changes in iOS13

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.

Custom UIHostingController

Learn how to create a custom subclass of UIHostingController and its benefit.

SwiftUI's ViewModifier

Learn a crucial concept in SwiftUI, view modifier, and a guide of how to create your custom modifier.

SwiftUI changes in Xcode 11 Beta 5

Highlight changes for SwiftUI in beta 5

How to use SwiftUI in UIKit

Using SwiftUI as UIView and UIViewController

SwiftUI changes in Xcode 11 Beta 4

Highlight changes for SwiftUI in beta 4

Better dependency injection for Storyboards in iOS13

Say goodbye to optional properties in your view controllers. In iOS13, you can inject those properties at a time of view controller creation.

UISplitViewController in SwiftUI

WWDC session shows us a way to create UISplitViewController with NavigationView in SwiftUI. It finally works in Xcode 11 Beta 3.

SwiftUI changes in Xcode 11 Beta 3

Highlight changes for SwiftUI in beta 3

How to use UIKit in SwiftUI

Using UIView and UIViewController in SwiftUI

Browse SF Symbols on Mac

SF Symbols contain over 1,500 icons. It would be hard if you don't know the existence of SF Symbols App.

MVC (Missing View Controller)

Where is UIViewController in SwiftUI?

Introduction to Coordinator

iOS flow controller

Enum & custom type from primitive JSON type

Swift Codable

Codable in Swift 4.0

Can it replace JSON encode/decode lib out there?

Where is my getter/setter in Swift?

A missing Objective-C piece