Member-only story

Animate Swift’s Labels

Marquee!

Steven Curtis
4 min readJul 5, 2021

Before we start

Difficulty: Beginner | Easy | Normal | Challenging

This article has been developed using Xcode 13, and Swift 5.5.

Keywords and Terminology

UIButton: A control that responds to user interactions

UILabel: A view used by UIKit that displays on or more lines of text

This article

Background

Experimenting with user interfaces? That sounds like fun!

We should know that CABasicAnimation is a concrete representation of a CAAnimation.

The Project

I’ve created a project with several different animated buttons on them. They’re fantastic! If you want to take a closer look, I’d advise you take a look at the accompanying repo.

Adding a target to each of the buttons

Each of these buttons have been added to the storyboard in this example, and the outlets connected up.

Each of these are going to print out a rather attractive “Button Pressed” message to the console when the button is pressed. In fact, each of them is going to hit the following function when pressed:

--

--

No responses yet