Mercurial > public > lazybear
diff LazyBear/Views/Search/Helpers/SearchedCompanyItem.swift @ 393:0a4c399170c4
Implementing WatchlistCreator
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 02 May 2021 12:41:20 +0200 |
parents | 8ec37b2baafd |
children | 4c90e5b18632 |
line wrap: on
line diff
--- a/LazyBear/Views/Search/Helpers/SearchedCompanyItem.swift Sat May 01 13:11:32 2021 +0200 +++ b/LazyBear/Views/Search/Helpers/SearchedCompanyItem.swift Sun May 02 12:41:20 2021 +0200 @@ -10,9 +10,6 @@ struct SearchedCompanyItem: View { var company: SearchResponse - // Only unseful when it's called from Profile View - var calledFromProfileView: Bool? - @Environment(\.managedObjectContext) private var moc @FetchRequest(entity: WatchlistCompany.entity(), sortDescriptors: []) var watchlistCompany: FetchedResults<WatchlistCompany> @@ -22,20 +19,18 @@ var body: some View { let watchlistSymbols = watchlistCompany.map { $0.symbol } HStack { - if !(calledFromProfileView ?? false) { - Button(action: { self.showingActionSheet = true }) { - if watchlistSymbols.contains(company.symbol!) { - Image(systemName: "star.fill") - .foregroundColor(.yellow) - .imageScale(.large) - } else { - Image(systemName: "star") - .foregroundColor(.yellow) - .imageScale(.large) - } + Button(action: { self.showingActionSheet = true }) { + if watchlistSymbols.contains(company.symbol!) { + Image(systemName: "star.fill") + .foregroundColor(.yellow) + .imageScale(.large) + } else { + Image(systemName: "star") + .foregroundColor(.yellow) + .imageScale(.large) } - .buttonStyle(PlainButtonStyle()) } + .buttonStyle(PlainButtonStyle()) VStack(alignment: .leading) { Text(company.symbol!.uppercased())