[ad_1]
I’m attempting to alter the indicator picture of the DisclosureGroup in SwiftUI. Ideally I might desire a customized picture. I’ve tried to attain that utilizing my very own ButtonStyle
struct TestButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
HStack {
Spacer()
Picture(systemName: "pencil")
}
}
}
struct DropDownMenu2 : View {
var gadgets: [String]
@State var broaden = false
@State var selectedItem: String
init(gadgets: [String]) {
self.gadgets = gadgets
self.selectedItem = gadgets[0]
}
var physique: some View {
VStack(alignment: .main) {
DisclosureGroup("(selectedItem)", isExpanded: $broaden) {
VStack {
ForEach(gadgets, id: .self) { merchandise in
Textual content("(merchandise)")
.onTapGesture {
self.selectedItem = merchandise
withAnimation {
self.broaden.toggle()
}
}
}
}
}
.padding(.all)
.buttonStyle(TestButtonStyle()).accentColor(.grey)
.background(Shade.grey)
.cornerRadius(8)
}
Spacer()
}
}
I would love that pencil icon parallel to Filter 1 textual content as is the case with commonplace DisclosureGroup. How can I obtain that?
[ad_2]

