Mercurial > public > lazybear
changeset 120:2070372fea68
Bugs fixed
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 05 Feb 2021 16:51:25 +0100 |
parents | c05ce3dfd489 |
children | c7532d18d6be |
files | LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate lazybear/Network/Request.swift lazybear/Views/Company.swift lazybear/Views/CompanyHeader.swift lazybear/Views/InsiderTransactions.swift lazybear/Views/Price.swift lazybear/Views/Stock.swift lazybear/Views/TransactionRow.swift lazybear/Views/WatchlistRow.swift |
diffstat | 9 files changed, 52 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/lazybear/Network/Request.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Network/Request.swift Fri Feb 05 16:51:25 2021 +0100 @@ -21,7 +21,7 @@ // Decode response with the model passed let decodedResponse = try JSONDecoder().decode(model, from: data) DispatchQueue.main.async { - //print(decodedResponse) + print(decodedResponse) completion(decodedResponse) } return
--- a/lazybear/Views/Company.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/Company.swift Fri Feb 05 16:51:25 2021 +0100 @@ -38,10 +38,8 @@ }.tag(0) // Second view - ScrollView { - InsiderTransactions(symbol: symbol) - .environmentObject(self.apiAccess) - } + InsiderTransactions(symbol: symbol) + .environmentObject(self.apiAccess) .tabItem { Image(systemName: "chart.pie.fill") Text("Insiders")
--- a/lazybear/Views/CompanyHeader.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/CompanyHeader.swift Fri Feb 05 16:51:25 2021 +0100 @@ -14,21 +14,24 @@ var body: some View { VStack(alignment: .leading) { - HStack { - Text(self.symbol.uppercased()) - .font(.title) - .fontWeight(.semibold) - - Spacer() - Button(action: { self.presentationMode.wrappedValue.dismiss() }) { - Image(systemName: "multiply.circle.fill") + Group { + HStack { + Text(self.symbol.uppercased()) + .font(.title) + .fontWeight(.semibold) + + Spacer() + Button(action: { self.presentationMode.wrappedValue.dismiss() }) { + Image(systemName: "multiply.circle.fill") + } + } + Text(self.name.capitalized) } - - Text(self.name.capitalized) + .padding([.leading, .trailing]) + Divider() } - .padding([.leading, .trailing]) } }
--- a/lazybear/Views/InsiderTransactions.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/InsiderTransactions.swift Fri Feb 05 16:51:25 2021 +0100 @@ -19,17 +19,21 @@ // <--------- API Job ---------> var body: some View { - HStack { - Text("Insider transactions") - .font(.title) - .fontWeight(.semibold) - .padding([.leading, .bottom]) - Spacer() - } - .onAppear { getUrl() } + VStack { + HStack { + Text("Insider transactions") + .font(.title) + .fontWeight(.semibold) + .padding([.leading, .bottom]) + Spacer() + } + .onAppear { getUrl() } - ForEach(data, id: \.self) { data in - TransactionRow(data: data) + List { + ForEach(data, id: \.self) { data in + TransactionRow(data: data) + } + } } }
--- a/lazybear/Views/Price.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/Price.swift Fri Feb 05 16:51:25 2021 +0100 @@ -20,7 +20,7 @@ // <--------- API Job ---------> // Set recurrent price request. Real-time prices - let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() + let timer = Timer.publish(every: 5, on: .main, in: .common).autoconnect() var body: some View { VStack(alignment: .trailing) { @@ -28,8 +28,9 @@ Group { Text("\(data[0].latestPrice ?? 0, specifier: "%.2f")") .fontWeight(.semibold) - - Text("\(data[0].changePercent ?? 0 * 100, specifier: "%.2f")%") + + let percent = (data[0].changePercent ?? 0) * 100 + Text("\(percent, specifier: "%.2f")%") .padding(1) .font(.subheadline) .foregroundColor(.white)
--- a/lazybear/Views/Stock.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/Stock.swift Fri Feb 05 16:51:25 2021 +0100 @@ -34,7 +34,6 @@ var body: some View { VStack { - Divider() HStack { Price(symbol: symbol, showVertical: true) Spacer()
--- a/lazybear/Views/TransactionRow.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/TransactionRow.swift Fri Feb 05 16:51:25 2021 +0100 @@ -13,31 +13,25 @@ var body: some View { Button(action: { self.showingDetail.toggle() }) { - VStack { - HStack(alignment: .top) { - VStack(alignment: .leading) { - Text(data.fullName?.capitalized ?? "-") - .fontWeight(.semibold) - - Text(data.transactionDate ?? "-") - .font(.subheadline) - } - Spacer() - VStack { - Text("\(data.transactionShares ?? 0)") - .fontWeight(.semibold) - .foregroundColor(color()) - - Text("Shares") - .font(.subheadline) - } + HStack { + VStack(alignment: .leading) { + Text(data.fullName?.capitalized ?? "-") + .fontWeight(.semibold) + + Text(data.transactionDate ?? "-") + .font(.subheadline) } - .padding([.leading, .trailing]) - - Divider() + Spacer() + VStack(alignment: .trailing) { + Text("\(data.transactionShares ?? 0)") + .fontWeight(.semibold) + .foregroundColor(color()) + + Text("Shares") + .font(.subheadline) + } } } - .buttonStyle(PlainButtonStyle()) .sheet(isPresented: $showingDetail) { TransactionDetail(data: self.data) }
--- a/lazybear/Views/WatchlistRow.swift Fri Feb 05 16:05:16 2021 +0100 +++ b/lazybear/Views/WatchlistRow.swift Fri Feb 05 16:51:25 2021 +0100 @@ -19,7 +19,7 @@ Button(action: { companyView.isShowing.toggle() }) { HStack { let url = apiAccess.results[0].url - let path = "/iex/api/logos/\(company.symbol!).png" + let path = "/iex/api/logos/\(company.symbol ?? "").png" let endpoint = url! + path WebImage(url: URL(string: endpoint)) .resizable()