[SWIFT] Display SF Symbols in different sizes and colors

Introduction

By using SF Symbols, you can easily incorporate images that are often seen in genuine Apple apps into the app. How to get started is written in here.

let image = let image = UIImage(systemName: "mic")

With just this, you can easily paste the microphone icon.

Change size and color

let image = UIImage(systemName: "mic", withConfiguration: UIImage.SymbolConfiguration(pointSize: 30, weight: .light, scale: .default))?.withTintColor(.black, renderingMode: .alwaysOriginal)

You can change the size with pointSize and the color with withTintColor. Fine effects when the button is pressed can be tampered with with renderingModel.

Recommended Posts

Display SF Symbols in different sizes and colors
Summary of hashes and symbols in Ruby
Display a loading image in JavaFX and then display another image
Use different TransactionManager for metadata and step in spring-batch