Hello guys, I want to show a badge on an object in SwiftUI, precisely I want the rectangle to show the badge on it every time I press it. I did some tests, but it isn't working. Can someone help me to build this? Here’s my code: import SwiftUI import PlaygroundSupport struct ContentView: View { var body: some View { Button(action: { badge(9) }, label: { Rectangle() .frame(width: 180, height: 200) .foregroundColor(.blue) }) } } PlaygroundPage.current.setLiveView(ContentView()) Thanks a lot.
2
0
2.2k