Hi, useful answers here but I still have some difficulty to understand the logic behind these behaviors
Why when we put onDisappear on the ContentView , this handler/modifier is not called ?
Regards
Post
Replies
Boosts
Views
Activity
Hi,
Usually I develop with the AVP on my head and the virtual display and yes you can develop run test debug directly with it
Did you enable Develop mode in the setting of the AVP in Privacy section ?
Well my own answer, can be useful for others.I hesitated to use my own button style ... but this is the solution here in my casestruct SimpleButtonStyle: ButtonStyle {
func pressColor(isPressed: Bool) -> Color{
if isPressed {
return Color.gray
}
else {
return Color.white
}
}
func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.padding([.trailing, .leading], 10)
.padding([.top, .bottom], 1)
.background(
RoundedRectangle(cornerRadius: 5)
.fill(pressColor(isPressed: configuration.isPressed))
.overlay(RoundedRectangle(cornerRadius: 5)
.stroke(lineWidth: 1)
.foregroundColor(Color.gray)
)
)
}
}
struct SomeButton : View {
var body: some View {
HStack{
Button(action: {
print("Pressed")
}) {
Text("Press")
}
}
.buttonStyle(SimpleButtonStyle())
.font(.headline)
.padding(.trailing, 10)
}
}Take care