---
title: "#268: What's New in Tab Bar Customization 🎨"
url: https://littlebitesofcocoa.com/268-what-s-new-in-tab-bar-customization
author: Jake Marsh
date: 2016-09-23
published: 2016-09-23
topics: ["UIKit"]
description: "Tab Bars have been around since the very first iPhone. They are a fantastic way to organize the top level screens in our app, and give users a quick way to..."
---

# #268: What's New in Tab Bar Customization 🎨

By Jake Marsh, September 23, 2016. HTML: https://littlebitesofcocoa.com/268-what-s-new-in-tab-bar-customization

_Tab Bars_ have been around since the very first **iPhone**. They are a fantastic way to organize the top level **screens** in our **app**, and give users a quick way to get to each. Today we'll check out the latest improvements to how e can customize the look and feel of _UITabBars_ in our **app**. Let's begin.

First up: _Badge Customization_.

For years we've had to resort to custom drawing or other methods to change how the badge would appear on a tab bar in our app.

In iOS 10, Apple has added a couple of features to allow us to completely customize how this looks with only a few lines of code. 

Let's try this out. First, we'll set a **badge value** on one of the **tabs**:

``` swift
func configureTabBar() {
  guard let tabBarItem = self.tabBarItem else { return }
  
  tabBarItem.badgeValue = "268"
}
```

<img src="https://media.littlebitesofcocoa.com/268-1.png" style="max-width: 375px;" />

Nice. Now let's customize that **badge**. All we need is one **function** and some **attributes**:

``` swift
tabBarItem.setBadgeTextAttributes([
  NSFontAttributeName : UIFont(name: "AvenirNextCondensed-Medium", size: 14.0)
], for: .normal)
```

<img src="https://media.littlebitesofcocoa.com/268-2.png" style="max-width: 375px;" />

Neat.

Next, we can now easily change the **background color** of the **badge**:

<img src="https://media.littlebitesofcocoa.com/268-3.png" style="max-width: 375px;" />

Lastly, we'll customize the **tabs** themselves using one final new feature, `unselectedItemTintColor` (<i>[Finally](https://twitter.com/applefinally)</i>):

``` swift
guard let tabBar = self.tabBarController?.tabBar else { return }

tabBar.tintColor = UIColor(white: 0.1, alpha: 1.0)
tabBar.unselectedItemTintColor = UIColor.lightGray
```

<img src="https://media.littlebitesofcocoa.com/268-4.png" style="max-width: 375px;" />

Success!

<p></p>
