Skip to content

Commit

Permalink
Fix toolbar items not displaying for iOS target (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
rizwankce authored Oct 7, 2021
1 parent be019e9 commit 4345fa4
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions Shared/App/SwiftUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ struct ContentView: View {
@State var searchString: String = ""

var body: some View {
VStack {
NavigationView {
VStack(spacing: .zero) {
HStack {
Image(systemName: "magnifyingglass")
.foregroundColor(.gray)
.padding(.leading)
TextField("Search", text: $searchString).padding()
TextField("Search", text: $searchString).padding()
if(searchString != "") {
Button(action: {
searchString = ""
Expand All @@ -32,28 +33,34 @@ struct ContentView: View {
}
}
}
List {
ForEach(balanceSheet) {
if(searchString == "") {
Text("\($0.title )")
.foregroundColor($0.action.color)
} else if($0.title.lowercased().contains(searchString.lowercased())){
Text("\($0.title )")
.foregroundColor($0.action.color)
List {
ForEach(balanceSheet) {
if(searchString == "") {
Text("\($0.title )")
.foregroundColor($0.action.color)
} else if($0.title.lowercased().contains(searchString.lowercased())){
Text("\($0.title )")
.foregroundColor($0.action.color)
}
}
#if os(iOS)
.onDelete(perform: deleteRow(at:))
#endif
}
#if os(iOS)
.onDelete(perform: deleteRow(at:))
#endif
.navigationBarHidden(true)
}
}
.toolbar {
#if os(iOS)
EditButton()
#endif
.toolbar {
ToolbarItem(placement: .bottomBar) {
#if os(iOS)
EditButton()
#endif
}

Button(action: addItem) {
Label("Add Item", systemImage: "plus")
ToolbarItem(placement: .bottomBar) {
Button(action: addItem) {
Label("Add Item", systemImage: "plus")
}
}
}
}
}
Expand Down

0 comments on commit 4345fa4

Please sign in to comment.