@@ -54,6 +54,7 @@ struct tweaksection: Identifiable {
5454 var id : String { name }
5555 var name : String
5656 var icon : String
57+ var isexpanded : Bool = true
5758 var tweaks : [ tweak ]
5859}
5960
@@ -110,21 +111,9 @@ struct MiscView: View {
110111 revert ( )
111112 }
112113 }
113- ForEach ( Array ( tweaks. enumerated ( ) ) , id: \. offset) { sectionindex, section in
114- Section ( header: HeaderLabel ( text: section. name, icon: section. icon) ) {
115- ForEach ( Array ( section. tweaks. enumerated ( ) ) , id: \. offset) { tweakindex, tweak in
116- if let tweakinfo = tweak. info {
117- PlainToggle ( text: tweak. name, infoType: . info, infoTitle: " Tweak infomation " , infoMessage: tweakinfo, isOn: $tweaks [ sectionindex] . tweaks [ tweakindex] . state. enabled)
118- . disabled ( tweak. readfailed)
119- } else {
120- PlainToggle ( text: tweak. name, isOn: $tweaks [ sectionindex] . tweaks [ tweakindex] . state. enabled)
121- . disabled ( tweak. readfailed)
122- }
123- }
124- }
125- }
114+ tweaksui
126115 }
127- . navigationTitle ( " Miscellaneous " )
116+ . navigationTitle ( " Title " )
128117 . refreshable {
129118 load ( )
130119 }
@@ -134,6 +123,22 @@ struct MiscView: View {
134123 }
135124 }
136125
126+ private var tweaksui : some View {
127+ ForEach ( $tweaks) { $section in
128+ Section ( header: HeaderDropdown ( text: section. name, icon: section. icon, isExpanded: section. isexpanded, useItemCount: true , itemCount: section. tweaks. count) ) {
129+ ForEach ( $section. tweaks) { $tweak in
130+ if let tweakinfo = tweak. info {
131+ PlainToggle ( text: tweak. name, infoType: . info, infoTitle: " Tweak infomation " , infoMessage: tweakinfo, isOn: $tweak. state. enabled)
132+ . disabled ( tweak. readfailed)
133+ } else {
134+ PlainToggle ( text: tweak. name, isOn: $tweak. state. enabled)
135+ . disabled ( tweak. readfailed)
136+ }
137+ }
138+ }
139+ }
140+ }
141+
137142 private func load( ) {
138143 checkplists ( )
139144 var errormsg = " "
0 commit comments