Adding a Dash of Color

It's great to put your own stamp on your app. An easy way to start is with simple color changes. You may have noticed a StyleConstants.swift file that we never once discussed.

Now is the time to finally have a look! Drum Roll, please!

struct StyleConstants {
  static let defaultBlueColor = UIColor(red: 54/255.0, green: 103/255.0, blue: 138/255.0, alpha: 1.0)

So that might have been anti-climactic. However, we are going to use this defaultBlue in our App styling. You can of course change it to be whatever RGB color value you like. A nice mauve, perhaps?

Time to venture into AppDelegate.swift. Tread lightly. Modify it to read as follows:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

  UINavigationBar.appearance().barTintColor = StyleConstants.defaultBlueColor
  UINavigationBar.appearance().tintColor = UIColor.whiteColor()
  UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
  UINavigationBar.appearance().translucent = false

  UIToolbar.appearance().barTintColor = StyleConstants.defaultBlueColor
  UIToolbar.appearance().tintColor = UIColor.whiteColor()
  UIToolbar.appearance().translucent = false

  return true


However, there is no need to feel blue.


Now is the time to explore the app. Find places to style or play with Layouts and/or anything you wish.


If you have feedback on this tutorial or find any mistakes, please open issues on the GitHub Repository or comment below.

Summer academy

An iOS Development Summer Course

Design, code and launch your own app. Locations in San Francisco and Asia

Find your location

Product College

A computer science college

Graduate into a successful career as a founder or software engineer.

Learn more