# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1612540285 -3600 # Node ID 2070372fea684bda9aeb329b62c84c3c262ca6d4 # Parent c05ce3dfd489b2aff04c621b91093391fd129c76 Bugs fixed diff -r c05ce3dfd489 -r 2070372fea68 LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Network/Request.swift --- 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 diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/Company.swift --- 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") diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/CompanyHeader.swift --- 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]) } } diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/InsiderTransactions.swift --- 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) + } + } } } diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/Price.swift --- 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) diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/Stock.swift --- 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() diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/TransactionRow.swift --- 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) } diff -r c05ce3dfd489 -r 2070372fea68 lazybear/Views/WatchlistRow.swift --- 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()