4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【SwiftUI】可変SFSymbolsを試してみた

Last updated at Posted at 2022-11-27

はじめに

SFSymbols4から部分的に色を変更できる機能が提供されました。
今回はそれを試してみます。

サンプルアプリ

Simulator Screen Recording - iPhone 14 - 2022-11-27 at 18.14.12.gif

実装

import SwiftUI

struct ContentView: View {
    @State var value: Double = 0.0
    var body: some View {
        VStack(spacing: 50) {
            Image(systemName: "speaker.wave.3.fill", variableValue: value)
                .resizable()
                .scaledToFit()
                .frame(width: 100)
            Slider(value: $value, in: 0...1)
        }
        .padding(20)
    }
}

注意
variableValueのMAXは1.0です。
10.0100.0にするとあっという間にMAXになってしまいます。

使用できるシンボル

「可変」の欄にある175個
スクリーンショット 2022-11-27 18.15.18.png

おわり

これかなり便利です

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?