Tips

A collection of bite-size iOS and programming tips easy to digest.

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.

How to change a back button image

Learn how to change a UINavigationBar back button indicator.

Match a view's shadow to the Sketch shadow

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

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.

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

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

Testing Remote Push Notification in iOS simulator

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

Intrinsic content size in SwiftUI

How to define intrinsic content size in SwiftUI

Print unescaped string output in Swift

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

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.

Manually symbolicate crash reports

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

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.

if let

How not to use it

Take a screenshot and record a video in iOS Simulator

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

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.