spaceotech / SODarkModeDemo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SODarkModeDemo

In this iPhone app tutorial, we will chek for customizing the iOS app theme for both ios dark theme and light.

Things that we will cover,

  1. What iOS Dark Mode is and what it does
  2. The benefits of using Dark Mode
  3. Important considerations while implementing Dark Mode in an app
  4. Customizing the color scheme for your iOS application for different themes – light and dark mode.

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, views, menus, and controls. Basically, like 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 a darker background.

Benefits of Dark Mode

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

Considerations for iPhone Dark Mode while implementing in an app

  1. Put the focus on content
  2. Test for both- light and dark appearances
  3. Test with changes in contrast and transparency

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.

We hope that you found this iPhone tutorial useful and your concepts about iPhone Dark Mode are clear.

About

License:MIT License


Languages

Language:Swift 100.0%