StyleManager for your iOS App With Swift

Jesus Nieves
Sep 29 · 3 min read
Photo by Caleb Lucas on Unsplash

When we are developing an application, there are many important things to consider, such as architecture, libraries, and language.

But as a developer and graphic designer at the same time, I think one of the most important aspects of the application is how it looks. The user appreciates a good-looking app. That’s why we have UX teams that take care of this incredible task, and they provide us with interfaces designed for better user experiences.

So I think it’s a good idea for my first post to be focused on a tool to help us better complete this task.

This class is going to handle two fundamental visual aspects of the app color and typography.


Handling the Color

First, we need an extension that can handle hexadecimal colors. Let’s be honest: Most of the time the designer sends us the colors in this format #f5f5f5 instead of a color of the type UIColor (red: 0.96, green: 0.96, blue: 0.96, alpha: 1.0).

UIColor+Extension.swift

First of all, we will create our enum to have a group of related colors and then a function that processes the selected color and returns a UIColor object.

AppStyleManager.swift

How to use it:


Handling Text Style

For the accounts, we need to establish the style and size.

So first we create the enum with the styles.

AppStyleManager.swift

We also need to manage the sizes.

AppStyleManager.swift

Then we create the function with which we will obtain the desired font with its size.

And we are done!

Now enjoy your style manager, and set color and typography consistently.

Better Programming

Jesus Nieves

Written by

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade