comparison LazyBear/Views/Profile/Helpers/WatchlistCreatorList.swift @ 430:c78d5b5b3bda

Minor updates
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 19 Jun 2021 16:21:26 +0200
parents 5f21f7c23c5e
children 4b8031e696e8
comparison
equal deleted inserted replaced
429:e4ca9898b79b 430:c78d5b5b3bda
12 @ObservedObject var watchlistCreatorClass: WatchlistCreatorClass 12 @ObservedObject var watchlistCreatorClass: WatchlistCreatorClass
13 13
14 @State private var searchedCompany = String() 14 @State private var searchedCompany = String()
15 @State private var companies = [SearchResponse]() 15 @State private var companies = [SearchResponse]()
16 16
17 @Environment(\.presentationMode) private var presentationMode 17 @Environment(\.presentationMode) private var watchlistCreatorListPresentation
18 @Environment(\.managedObjectContext) private var moc 18 @Environment(\.managedObjectContext) private var moc
19 19
20 var body: some View { 20 var body: some View {
21 NavigationView { 21 NavigationView {
22 VStack { 22 VStack {
23 WatchlistCreatorSearchBar(searchedCompany: $searchedCompany) 23 WatchlistCreatorSearchBar(searchedCompany: $searchedCompany)
24 24
25 List(companies, id: \.self) { company in 25 List(companies, id: \.self) { company in
26 WatchlistCreatorRow(company: company, presentationMode: presentationMode, watchlistCreatorClass: watchlistCreatorClass) 26 WatchlistCreatorRow(company: company, watchlistCreatorListPresentation: watchlistCreatorListPresentation, watchlistCreatorClass: watchlistCreatorClass)
27 .environment(\.managedObjectContext, self.moc) 27 .environment(\.managedObjectContext, self.moc)
28 } 28 }
29 } 29 }
30 .navigationTitle("Search") 30 .navigationTitle("Search")
31 .navigationBarTitleDisplayMode(.inline) 31 .navigationBarTitleDisplayMode(.inline)
33 encodeAndRequest(searchedCompany) 33 encodeAndRequest(searchedCompany)
34 }) 34 })
35 35
36 .toolbar { 36 .toolbar {
37 ToolbarItem(placement: .navigationBarLeading) { 37 ToolbarItem(placement: .navigationBarLeading) {
38 Button("Cancel", action: { presentationMode.wrappedValue.dismiss() }) 38 Button("Cancel", action: { watchlistCreatorListPresentation.wrappedValue.dismiss() })
39 } 39 }
40 } 40 }
41 } 41 }
42 } 42 }
43 43