Skip to content

Instantly share code, notes, and snippets.

@takoikatakotako
Created October 24, 2024 01:46
Show Gist options
  • Select an option

  • Save takoikatakotako/b3d337885f3245f306a4b1598d5dfc3f to your computer and use it in GitHub Desktop.

Select an option

Save takoikatakotako/b3d337885f3245f306a4b1598d5dfc3f to your computer and use it in GitHub Desktop.
SwiftUIでButton内の画像やテキストの色を変えない
import SwiftUI
struct ContentView: View {
@State var bool = true
var body: some View {
VStack {
Text(bool ? "Snorlax" : "Forever")
Button(action: {
bool.toggle()
}) {
HStack {
Image(.icon)
.resizable()
.scaledToFill()
.frame(width: 50, height: 50)
Text("Tap Me!!")
}
.padding()
.border(Color.gray, width: 2)
}
.buttonStyle(PlainButtonStyle())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment