Target's iOS and macOS as well.
I have this very general code to draw an Image and some text:
let dynamicScale = 1.2 // here just static but will be !!calculated!!
...
VStack (alignment: .leading){
Image(user.imageName)
.resizable()
.frame(width: 60, height: 60)
.clipped()
.clipShape(Circle())
.overlay(Circle()
.scale(dynamicScale) // with some calculation
.stroke(Color.red, lineWidth: 2))
Text(user.username).font(.headline)
Text(user.message).font(.subheadline)
}.padding(.init(top: 10, leading: 5, bottom: 10, trailing: 5))
}
for now the size is static, but later, its size will be depend on-screen size and rotation. So will the stroke be depended of that, size and some more settings.
How can I get dynamically the circle size ( frame ) in SwiftUI, so I can us it to draw a second Circle() stroke/border at a offset of the Image.
I want .scale(dynamicScale) dynamically calculated depending of the size of the image
As far as I understand I can't insert any Swift code to read that size, like 'let size = Image().frame.width'. Logical, there are no values there yet.
Somebody has some suggestions?