How to customize dark mode in iOS app with iOS 13 [iOS Tutorial]

Amit Makhija
4 min readAug 5, 2019

In this iOS 13 tutorial, we’re going to learn how to customize color scheme for your iPhone app for light and dark mode.

What you will learn in this tutorial:

  1. What is iOS Dark Mode and what it does
  2. Benefits of using Dark Mode in iOS
  3. Key considerations while implementing Dark Mode in an iPhone app.

Before we step ahead with the tutorial, let’s check some basic information about the dark mode in iOS 13.

What is iOS Dark Mode? What does it do?

Dark Mode is a dark system-wide appearance that uses a darker color palette for all screens, menus, and controls. Similar to Android Dark Mode, it changes a bright theme to a darker one. It also maintains vibrancy and contrast to make foreground content stand out against the darker background.

Benefits of Dark Mode

  • Dark mode is very helpful when the surrounding is dark. Thus, it puts less strain on eyes compared to the light mode.
  • You can choose the Dark Mode as default interface style.
  • You can also use Settings to make your device select the Dark Mode automatically when the ambient light is low.
  • Dark Mode supports all accessibility features.

As announced by Apple during the developers’ conference 2019, Apple’s preinstalled apps like Notes, News, TV, Music, Reminders, Mail, and others will be already having it.

However, iPhone developers will be able to use Apple’s new tools to add dark mode to their apps. Being an iPhone app development company, we had a lot of our clients looking to integrate the dark mode feature to their iOS apps.

Our experienced iPhone app developers decided to help other developers by describing the dark mode feature with a simple iOS example. Before we see how to integrate the dark mode feature, let us know which are the important considerations that one should keep in mind during feature integration.

Important considerations for Dark Mode in iPhone, while implementing in an app

  • Put the focus on content: Make sure that your content stands out and surrounding UI recedes into the background. The purpose of the Dark Mode is to put the focus on the content areas of the interface.
  • Test for both- light and dark appearances: Check how the interface looks in both appearances. You may need to adjust designs to accommodate each one as designs working well in one appearance might not work in another.
  • Test with changes in contrast and transparency: You need to test the content when Increase Contrast and Reduce Transparency is turned on. Ensure that your content is distinct in Dark Mode when you adjust contrast and transparency settings.

Now that you are clear about considerations, let’s customize the color scheme for your iOS application for different themes.

For that, we need to create a demo project in Xcode.

Step 1: Create a new project in Xcode

Step 2: Add a new color set in assets.xcassets folder as shown in the images

Step 3: Go to Storyboard and drag & drop controls that you would like to add to your project.

Step 4: Go to the view controller and create outlet(s) for UI Controls.

Step 5: Create employee struct and create an array of employee struct

Step 6: Append the data in arrEmployee to bind with UITableView

Step 7: Assign data source for the table view

Step 8: Create a UITableViewCell class for employee

Step 9: Implement the UITableView data source method

Step 10: Create switch event to set theme ( light or dark ) for UILable

Step 11: Set default behavior for controls in viewdidload

Step 12: compare assets folder with below images

And done!

Outcome

We hope that this iPhone tutorial will be useful to you and your concepts about iPhone Dark Mode are clear. You can download the source code of this iOS 13 Dark Mode example on github.

Here, in this iPhone app tutorial, we covered about customizing the iOS app theme for both ios dark mode and light mode. If you have any suggestions or queries in this tutorial or any questions regarding iPhone app development, we would be happy to answer you.

--

--

Amit Makhija

Digital Marketing Analyst, with a demonstrated history of working in the information technology and service industry since 2015.