Skip to content

Commit ab0a7b4

Browse files
committed
app compiles. bug still present
1 parent e7a0e4e commit ab0a7b4

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

differentListConstruction/ContentView.swift

+39-39
Original file line numberDiff line numberDiff line change
@@ -73,53 +73,53 @@ struct ContentView: View {
7373
@State private var editMode: EditMode = .inactive // Add an EditMode variable
7474

7575

76-
// var body: some View {
77-
//
78-
// NavigationView {
79-
//
80-
// List {
81-
// ForEach(vm.folderSource) { (folder: Folder) in
82-
// return Section(header: Text(folder.title)) {
83-
// FolderView(folder: folder,onDelete: {
84-
//// print("bug")
85-
//// FolderView(folder: folder, unusedArg: 5)
86-
// if self.editMode == .active {
87-
// self.editMode = .inactive // quickly change edit mode off
88-
//
89-
// self.editMode = .active // quickly change edit mode off
90-
// }
91-
// })
92-
// }
93-
// }
94-
// }.listStyle(GroupedListStyle())
95-
// .navigationBarItems(trailing: EditButton())
96-
// .environment(\.editMode, self.$editMode) // bind the List editMode to your variable
97-
//
98-
// }
99-
// }
100-
101-
var body: some View {
76+
var body: some View {
10277

103-
NavigationView {
78+
NavigationView {
10479

105-
List {
106-
ForEach(vm.folderSource) { (folder: Folder) in
107-
Section(header: Text(folder.title)) {
108-
// FolderView(folder: folder)
109-
ForEach(self.vm.projects.filter{$0.folder == folder}) { (project: Project) in
110-
Text(project.title.uppercased())
111-
}.onDelete{index in
112-
self.vm.delete()
80+
List {
81+
ForEach(vm.folderSource) { (folder: Folder) in
82+
return Section(header: Text(folder.title)) {
83+
FolderView(folder: folder,onDelete: {
84+
// print("bug")
85+
// FolderView(folder: folder, unusedArg: 5)
86+
if self.editMode == .active {
87+
self.editMode = .inactive // quickly change edit mode off
88+
89+
self.editMode = .active // quickly change edit mode off
11390
}
114-
.onMove(perform: {(index, int) in print("sdf")})
115-
}
91+
})
11692
}
11793
}
118-
.listStyle(GroupedListStyle())
94+
}.listStyle(GroupedListStyle())
11995
.navigationBarItems(trailing: EditButton())
120-
}
96+
.environment(\.editMode, self.$editMode) // bind the List editMode to your variable
97+
12198
}
99+
}
122100

101+
// var body: some View {
102+
//
103+
// NavigationView {
104+
//
105+
// List {
106+
// ForEach(vm.folderSource) { (folder: Folder) in
107+
// Section(header: Text(folder.title)) {
108+
// // FolderView(folder: folder)
109+
// ForEach(self.vm.projects.filter{$0.folder == folder}) { (project: Project) in
110+
// Text(project.title.uppercased())
111+
// }.onDelete{index in
112+
// self.vm.delete()
113+
// }
114+
// .onMove(perform: {(index, int) in print("sdf")})
115+
// }
116+
// }
117+
// }
118+
// .listStyle(GroupedListStyle())
119+
// .navigationBarItems(trailing: EditButton())
120+
// }
121+
// }
122+
//
123123

124124

125125

0 commit comments

Comments
 (0)