How to Add a Notification Label to an Image in SwiftUI

Adding a Notification Style Labels on Images

Sarah
The Startup

--

Notification Label on Image in SwiftUI
Project Examples Made using SwiftUI

SwiftUI

SwiftUI is an innovative, easy way to build user interfaces across every Apple platform. Develop user interfaces for any of Apple’s devices using just one kit and API. With a Swift syntax, that’s clear to read.

Project

The goal of this xCode project is to add a label to an image. The result will mimic the look of a notification label on top of an icon. You can use this method for showing a friend request within the app, a comment received on a post, or any other cases that where you need to notify the user of an event.

Let’s start with the image. You can find a list of all the system icons that can be used in iOS in a program made by apple called SF Symbols. These are clean looking icons that can be used in many sizes.

Below I’m using a system image called envelopeGive your image a foreground color, and your view background a different color. To change the size of the system image, you can add a font size.

struct ContentView: View {

--

--