How to make a macOS menu bar app

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


@sarunw.com | 1 year ago

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. | Continue reading


@sarunw.com | 2 years ago

How 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. | Continue reading


@sarunw.com | 2 years ago

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. | Continue reading


@sarunw.com | 2 years ago

How to Loop in Swift

Learn different ways of using for loop for each scenario. | Continue reading


@sarunw.com | 3 years ago

How Expensive Is NSDateFormatter

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. | Continue reading


@sarunw.com | 3 years ago

UIStackView Padding

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


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

Reduce boilerplate code with automatic synthesis of Equatable and Hashable

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


@sarunw.com | 3 years ago

How to save/export an image in Mac Catalyst

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


@sarunw.com | 3 years ago

Lesser-known ways of using Swift enums

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


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

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. | Continue reading


@sarunw.com | 3 years ago

How to declare Swift protocol for a specific class

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


@sarunw.com | 3 years ago

Xcode 12 finally supports SVG image assets, and it is backward compatibility

We finally get SVG supported and the best thing is it is backward compatibility with some limitations. | Continue reading


@sarunw.com | 3 years ago

How to set a navigation bar title view in SwiftUI?

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


@sarunw.com | 3 years ago

Should I learn UIKit or SwiftUI?

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


@sarunw.com | 3 years ago

Make your SwiftUI views reusable in iOS 14

A new way to create a reusable view. | Continue reading


@sarunw.com | 3 years ago

A proper way to set 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? | Continue reading


@sarunw.com | 3 years ago

iOS: How to change back button image

Learn how to change a UINavigationBar back button indicator. | Continue reading


@sarunw.com | 3 years ago

iOS: Different ways to check for String suffix in Swift

Learn how to get a suffix from a Swift string. | Continue reading


@sarunw.com | 4 years ago

iOS Codable: 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. | Continue reading


@sarunw.com | 4 years ago

How to set cornerRadius for only some corners

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


@sarunw.com | 4 years ago

Different ways to check for String prefix in Swift

Learn how to get a prefix from a Swift string. | Continue reading


@sarunw.com | 4 years ago

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

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


@sarunw.com | 4 years ago

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. | Continue reading


@sarunw.com | 4 years ago

History of Auto Layout Constraints

Learn different ways to define Auto Layout constraints programmatically. | Continue reading


@sarunw.com | 4 years ago

iOS: Useful 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. | Continue reading


@sarunw.com | 4 years ago

SwiftUI ButtonStyle – How to create a reusable button style in SwiftUI

How to create a reusable button style in SwiftUI. | Continue reading


@sarunw.com | 4 years ago

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

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


@sarunw.com | 4 years ago

How to create code snippets in Xcode

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


@sarunw.com | 4 years ago

Protocol MyDelegate: class {} is deprecated

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


@sarunw.com | 4 years ago

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. | Continue reading


@sarunw.com | 4 years ago

iOS: 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. | Continue reading


@sarunw.com | 4 years ago

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. | Continue reading


@sarunw.com | 4 years ago

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. | Continue reading


@sarunw.com | 4 years ago

Testing Remote Push Notification in iOS Simulator

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


@sarunw.com | 4 years ago

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. | Continue reading


@sarunw.com | 4 years ago

Sign in with Apple on Website

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. | Continue reading


@sarunw.com | 4 years ago

iOS: Print object (po) without escaped special characters

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


@sarunw.com | 4 years ago

Inset Grouped Lists in SwiftUI

How to make .insetGrouped UITableView style in SwiftUI List | Continue reading


@sarunw.com | 4 years ago

iOS: Learn about DiscardableResult

Learn about this Swift attribute and its purpose. | Continue reading


@sarunw.com | 4 years ago

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

Part 2 in a series on an introduction to Sign in with Apple. In this part, we will talk about the anonymous email address. How to make it work and its limitation. | Continue reading


@sarunw.com | 4 years ago

How to manually symbolicate iOS crash reports

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


@sarunw.com | 4 years ago

iOS: // Mark: – What Is It?

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


@sarunw.com | 4 years ago