I have an image that I'm hard coding the size, but realized it's not scaling for larger size categories. How can I set a preferred size and let it scale up to different sizes automatically?
This is what my code looks like:
HStack(alignment: .top, spacing: 4) {
Text("Some text")
Button(action: { showAlert = true }) {
Image(systemName: "questionmark.circle.fill")
.resizable()
.frame(width: 12, height: 12)
.foregroundColor(.secondary)
}
}
I also have other scenario where it's not using a SF Symbol:
Button(action: action) {
Label(
title: {
Text(title)
.foregroundColor(Color(.label))
},
icon: {
Image("twitter")
.resizable()
.frame(width: 24, height: 24)
}
)
}
This is how it looks in preview in different sizes, but the images are tiny in the larger scales. How do I handle this to achieve accessibility?


