タイトル : ボタンにアイコンを使う Playgroundの勉強 2026
更新日 : 2026-03-11
カテゴリ : プログラミング
タグ :
ソース
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Button(action:{
speak("フォースと共にあらんことを")
}) {
// テキストのボタン
// Text("hello")
// 画像のボタン。 systemNameで組み込みのアイコンの名前を指定して使えます
Image(systemName: "speaker.wave.3.fill")
// プロジェクトに追加した画像を使う
// Image("画像アセット")
// .resizable().scaledToFit()
// .frame(width:100, height: 100)
}
}
}
}