# Can I change the size of UIActivityIndicator in Swift?

It is possible to change the size of UIActivityIndicator in swift using some tricks but it’s not recommended to change the size. To change the size of activity indicator let’s first add an indicator on an empty screen and see how it looks. For this example, I’ll also change the color to red.

Let’s see how it looks when we run it without changing the size of the indicator.

Now, we’ll create an outlet of activity indicator in our view controller and in the viewDidLoad method of this class we’ll add the code below.

We’ll use CGAffineTransform to change the scale of our indicator. When we change the scale to 2.5x this is how it looks on the iPhone.

let transfrom = CGAffineTransform.init(scaleX: 2.5, y: 2.5)
activityIndicator.transform = transfrom

This is how it looks on the iPhone, which is blurred and not as perfect as the actual indicator. Hence it is not a recommended way to increase the size of the indicator.

Published on 30-Jan-2019 04:57:47