# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1610369388 0 # Node ID 3bd2e5d6e89df7cc7243de74207fa2c50efb9904 # Parent 9f11c3e32bad9f27cd0047d9997ec5be56584da2 New Readme file diff -r 9f11c3e32bad -r 3bd2e5d6e89d Company.swift --- a/Company.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/Company.swift Mon Jan 11 12:49:48 2021 +0000 @@ -8,18 +8,18 @@ import SwiftUI struct Company: View { - @State public var showingInsiders: Bool = false - @State public var showingMain: Bool = true + // Company arguments + var cik: Int + var symbol: String + var name: String - // Company - @State var cik: Int - @State var symbol: String - @State var name: String + @State public var showingInsiders: Bool = false + @State public var showingStocks: Bool = true var body: some View { GeometryReader { geo in VStack { - if showingMain { + if showingStocks { Stock(cik: cik, symbol: symbol, name: name) } else { @@ -32,7 +32,7 @@ .edgesIgnoringSafeArea(.bottom) .frame(height: geo.size.height * 0.1) .overlay( - Selection(showingInsiders: $showingInsiders, showingMain: $showingMain) + Selection(showingInsiders: $showingInsiders, showingStocks: $showingStocks) ) } .background(Color(.systemGray6).edgesIgnoringSafeArea(.all)) @@ -42,6 +42,6 @@ struct Company_Previews: PreviewProvider { static var previews: some View { - Company(cik: 123, symbol: "Symbol", name: "Name") + Company(cik: 320193, symbol: "aapl", name: "apple inc") } } diff -r 9f11c3e32bad -r 3bd2e5d6e89d ContentView.swift --- a/ContentView.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/ContentView.swift Mon Jan 11 12:49:48 2021 +0000 @@ -46,9 +46,8 @@ if showingSearch == false { Companies() - .transition(.move(edge: .bottom)) - .animation(.default) - + .transition(.move(edge: .bottom)) + .animation(.default) } else { if searchedCompany.count > 2 { diff -r 9f11c3e32bad -r 3bd2e5d6e89d Insiders.swift --- a/Insiders.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/Insiders.swift Mon Jan 11 12:49:48 2021 +0000 @@ -9,12 +9,12 @@ import SwiftUICharts struct Insiders: View { - @ObservedObject var transaction = Transaction() + // Company arguments + var cik: Int + var symbol: String + var name: String - // Company - @State var cik: Int - @State var symbol: String - @State var name: String + @ObservedObject var transaction = Transaction() // Picker var dateFormatter: DateFormatter { @@ -104,6 +104,6 @@ struct Insiders_Previews: PreviewProvider { static var previews: some View { - Insiders(cik: 123, symbol: "Symbol", name: "Name") + Insiders(cik: 320193, symbol: "aapl", name: "apple inc") } } diff -r 9f11c3e32bad -r 3bd2e5d6e89d LazyBearApp.swift --- a/LazyBearApp.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/LazyBearApp.swift Mon Jan 11 12:49:48 2021 +0000 @@ -10,10 +10,11 @@ @main struct LazyBearApp: App { + var body: some Scene { WindowGroup { NavigationView { - ContentView() + Env1() } .navigationViewStyle(StackNavigationViewStyle()) } diff -r 9f11c3e32bad -r 3bd2e5d6e89d README.md --- a/README.md Sun Jan 10 11:45:14 2021 +0000 +++ b/README.md Mon Jan 11 12:49:48 2021 +0000 @@ -1,2 +1,35 @@ -# Lazybear iOS App -This is the source code of my app Lazybear. You can download it from here https://apps.apple.com/es/app/lazybear-datos-financieros/id1534612943 +# Lazybear iOS +Lazybear is a free, open source, minimalist stock market data app for finance enthusiasts. +[Download it from the App Store](https://apps.apple.com/es/app/lazybear-datos-financieros/id1534612943) + +#Questions? +Visit our [Website](https://lazybear.app) + +#Contact us +[Personal Twitter](https://twitter.com/dennisconcep) +[Business Twitter](https://twitter.com/LazybearApp) + +#License +Repository under MIT LICENSE + +MIT License + +Copyright (c) 2021 Dennis Concepción Martín + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff -r 9f11c3e32bad -r 3bd2e5d6e89d Stock.swift --- a/Stock.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/Stock.swift Mon Jan 11 12:49:48 2021 +0000 @@ -9,15 +9,13 @@ import SwiftUICharts struct Stock: View { - @ObservedObject var price = Price() - @State var isFavourite = UserDefaults.standard // Save favourite company in default settings + // Company arguments + var cik: Int + var symbol: String + var name: String - // Company - @State var cik: Int - @State var symbol: String - @State var name: String - - + @ObservedObject var price = Price() + var body: some View { if price.showingView { GeometryReader { geo in @@ -33,11 +31,8 @@ .foregroundColor(whichColor()) Spacer() - - - - } - .padding([.leading, .top, .trailing]) + } + .padding([.leading, .top, .trailing]) HStack { Text(String(price.result.last!.date) + " last price") @@ -71,6 +66,7 @@ Spacer() } .onAppear { + print(symbol) price.request(symbol: symbol) } .alert(isPresented: $price.showingAlert) { @@ -89,17 +85,6 @@ return Color(.green) } } - - func favourite() { - if isFavourite.bool(forKey: String(cik)) { - isFavourite.set(false, forKey: String(cik)) - - } - else { - isFavourite.set(true, forKey: String(cik)) - - } - } } extension Image { func favouriteIcon() -> some View { @@ -112,6 +97,6 @@ struct Stock_Previews: PreviewProvider { static var previews: some View { - Stock(cik: 123, symbol: "Symbol", name: "Name") + Stock(cik: 320193, symbol: "aapl", name: "apple inc") } } diff -r 9f11c3e32bad -r 3bd2e5d6e89d Supply/Companies.swift --- a/Supply/Companies.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/Supply/Companies.swift Mon Jan 11 12:49:48 2021 +0000 @@ -23,7 +23,7 @@ ScrollView { LazyVGrid(columns: columns, spacing: 20) { // Create ScrollView with two columns per row ForEach((0...9), id: \.self) { index in - NavigationLink(destination: Company(cik: ciks[index], symbol: symbols[index], name: names[index]) + NavigationLink(destination: Company(cik: 796343, symbol: symbols[index], name: names[index]) .navigationBarTitle(names[index].capitalized) ) { VStack { diff -r 9f11c3e32bad -r 3bd2e5d6e89d Supply/Selection.swift --- a/Supply/Selection.swift Sun Jan 10 11:45:14 2021 +0000 +++ b/Supply/Selection.swift Mon Jan 11 12:49:48 2021 +0000 @@ -9,7 +9,7 @@ struct Selection: View { @Binding var showingInsiders: Bool - @Binding var showingMain: Bool + @Binding var showingStocks: Bool var body: some View { // Buttons @@ -30,7 +30,7 @@ // Stock Button(action: {toggle(type: "stock")}) { - if showingMain { + if showingStocks { Image(systemName: "dollarsign.square.fill") .resizable() .frame(width: 35, height: 35) @@ -41,23 +41,24 @@ .frame(width: 35, height: 35) } } - }.padding().padding().padding() + } + .padding().padding().padding() } } func toggle(type: String) { if type == "insider" { - self.showingMain = false + self.showingStocks = false self.showingInsiders = true } if type == "stock" { - self.showingMain = true + self.showingStocks = true self.showingInsiders = false } if type == "description" { - self.showingMain = false + self.showingStocks = false self.showingInsiders = false } } @@ -65,7 +66,7 @@ struct Selection_Previews: PreviewProvider { static var previews: some View { - Selection(showingInsiders: .constant(false), showingMain: .constant(true)) + Selection(showingInsiders: .constant(false), showingStocks: .constant(true)) } }