comparison LazyBear/Views/Company/CompanyView.swift @ 448:f71761f166f2

Handle when data is empty
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Wed, 23 Jun 2021 11:47:14 +0200
parents 8621ba6fd457
children
comparison
equal deleted inserted replaced
447:8621ba6fd457 448:f71761f166f2
42 company.request(url, .refresh) 42 company.request(url, .refresh)
43 }) 43 })
44 44
45 ChartHelper(company: company) 45 ChartHelper(company: company)
46 if let keyStats = company.data.keyStats { 46 if let keyStats = company.data.keyStats {
47 KeyStatsHelper(keyStats: keyStats) 47 KeyStatsHelper(keyStats: keyStats)
48
48 } 49 }
49 50
50 if let latestNews = company.data.latestNews { 51 if let latestNews = company.data.latestNews {
51 NewsHelper(latestNews: latestNews) 52 if !latestNews.isEmpty {
52 .padding([.horizontal, .bottom]) 53 NewsHelper(latestNews: latestNews)
54 .padding([.horizontal, .bottom])
55 }
53 } 56 }
54 57
55 if let insiderRoster = company.data.insiderRoster { 58 if let insiderRoster = company.data.insiderRoster {
56 InsiderRosterHelper(insiderRoster: insiderRoster) 59 if !insiderRoster.isEmpty {
57 .padding([.horizontal, .bottom]) 60 InsiderRosterHelper(insiderRoster: insiderRoster)
61 .padding([.horizontal, .bottom])
62 }
58 } 63 }
59 64
60 if let insiderTransactions = company.data.insiderTransactions { 65 if let insiderTransactions = company.data.insiderTransactions {
61 InsiderTransactionsHelper(insiderTransactions: insiderTransactions) 66 if !insiderTransactions.isEmpty {
62 .padding([.horizontal, .bottom]) 67 InsiderTransactionsHelper(insiderTransactions: insiderTransactions)
68 .padding([.horizontal, .bottom])
69 }
63 } 70 }
64 } 71 }
65 } 72 }
66 .background(Color("customBackground").edgesIgnoringSafeArea(.all)) 73 .background(Color("customBackground").edgesIgnoringSafeArea(.all))
67 } else { 74 } else {