Changing tab bar font in Swift

The UITextAttributeFont was deprecated in iOS 7. You should use the NS variant instead:

import UIKit

let appearance = UITabBarItem.appearance()
let attributes = [NSFontAttributeName:UIFont(name: "American Typewriter", size: 20)]
appearance.setTitleTextAttributes(attributes, forState: .Normal)

Swift 4.2

UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "FontName", size: 10)!], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "FontName", size: 10)!], for: .selected)

Swift 4

UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.font: UIFont(name: "FontName", size: 10)!], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.font: UIFont(name: "FontName", size: 10)!], for: .selected)

Swift 3

UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Font-Name", size: 10)!], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Font-Name", size: 10)!], for: .selected)

Note: Use setTitleTextAttributes for both .normal and .selected to have changes persist selection state changes.