Mercurial > public > lazybear
comparison LazyBear/Views/Profile/Helpers/WatchlistSheet.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 | 8c58ce834d95 |
children | 3ca32ff79630 |
comparison
equal
deleted
inserted
replaced
429:e4ca9898b79b | 430:c78d5b5b3bda |
---|---|
9 | 9 |
10 struct WatchlistSheet: View { | 10 struct WatchlistSheet: View { |
11 var listName: String | 11 var listName: String |
12 var apiCompanies: [CompanyModel] | 12 var apiCompanies: [CompanyModel] |
13 | 13 |
14 @Environment(\.presentationMode) private var watchlistSheetPresentationMode | 14 @Environment(\.presentationMode) private var watchlistSheetPresentation |
15 @Environment(\.managedObjectContext) private var moc | 15 @Environment(\.managedObjectContext) private var moc |
16 @FetchRequest(entity: WatchlistCompany.entity(), sortDescriptors: []) | 16 @FetchRequest(entity: WatchlistCompany.entity(), sortDescriptors: []) |
17 var watchlistCompanies: FetchedResults<WatchlistCompany> | 17 var watchlistCompanies: FetchedResults<WatchlistCompany> |
18 | 18 |
19 @State private var showDeleteListAlert = false | 19 @State private var showDeleteListAlert = false |
32 } | 32 } |
33 .navigationTitle(listName) | 33 .navigationTitle(listName) |
34 .navigationBarTitleDisplayMode(.inline) | 34 .navigationBarTitleDisplayMode(.inline) |
35 .toolbar { | 35 .toolbar { |
36 ToolbarItem(placement: .navigationBarLeading) { | 36 ToolbarItem(placement: .navigationBarLeading) { |
37 Button(action: {watchlistSheetPresentationMode.wrappedValue.dismiss()}) { | 37 Button(action: {watchlistSheetPresentation.wrappedValue.dismiss()}) { |
38 Image(systemName: "multiply") | 38 Image(systemName: "multiply") |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 ToolbarItem(placement: .navigationBarTrailing) { | 42 ToolbarItem(placement: .navigationBarTrailing) { |
84 moc.delete(company) | 84 moc.delete(company) |
85 } | 85 } |
86 do { | 86 do { |
87 try moc.save() | 87 try moc.save() |
88 print("List deleted") | 88 print("List deleted") |
89 watchlistSheetPresentationMode.wrappedValue.dismiss() /// Dismiss view | 89 watchlistSheetPresentation.wrappedValue.dismiss() /// Dismiss view |
90 } catch { | 90 } catch { |
91 print(error.localizedDescription) | 91 print(error.localizedDescription) |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |