changeset 11:f7f9067934ef

Merge pull request #4 from denniscm190/development Release app committer: GitHub <noreply@github.com>
author Dennis C. M. <dennis@denniscm.com>
date Thu, 05 Aug 2021 15:35:19 +0100
parents bc493fd6c0a2 (current diff) b9f78c6eeea0 (diff)
children 83585aec70c8
files
diffstat 16 files changed, 673 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Thu Aug 05 12:03:19 2021 +0100
+++ b/README.md	Thu Aug 05 15:35:19 2021 +0100
@@ -1,1 +1,6 @@
 # trades-demo
+
+**Trades** is a demo app fully written in SwiftUI to demostrate some uses cases of the [StockCharts framework](https://github.com/denniscm190/stock-charts).
+
+## Screenshots
+![Image 1](repo-resources/image1.jpeg)
--- a/Trades.xcodeproj/project.pbxproj	Thu Aug 05 12:03:19 2021 +0100
+++ b/Trades.xcodeproj/project.pbxproj	Thu Aug 05 15:35:19 2021 +0100
@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 50;
+	objectVersion = 52;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -13,6 +13,17 @@
 		95189E0226BBF70C0024C858 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95189E0126BBF70C0024C858 /* Preview Assets.xcassets */; };
 		95189E0A26BBF8870024C858 /* Explorer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E0926BBF8870024C858 /* Explorer.swift */; };
 		95189E0C26BBF89E0024C858 /* Details.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E0B26BBF89E0024C858 /* Details.swift */; };
+		95189E0F26BBFD4A0024C858 /* StockCharts in Frameworks */ = {isa = PBXBuildFile; productRef = 95189E0E26BBFD4A0024C858 /* StockCharts */; };
+		95189E1526BC01580024C858 /* CompanyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E1426BC01580024C858 /* CompanyModel.swift */; };
+		95189E1826BC01BD0024C858 /* JsonManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E1726BC01BD0024C858 /* JsonManager.swift */; };
+		95189E1A26BC02360024C858 /* Company.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E1926BC02360024C858 /* Company.swift */; };
+		95189E1C26BC0A930024C858 /* RandomDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E1B26BC0A930024C858 /* RandomDataManager.swift */; };
+		95189E1E26BC0DC70024C858 /* MostActive.json in Resources */ = {isa = PBXBuildFile; fileRef = 95189E1D26BC0DC70024C858 /* MostActive.json */; };
+		95189E2226BC0E080024C858 /* Gainers.json in Resources */ = {isa = PBXBuildFile; fileRef = 95189E2126BC0E080024C858 /* Gainers.json */; };
+		95189E2426BC0E170024C858 /* Losers.json in Resources */ = {isa = PBXBuildFile; fileRef = 95189E2326BC0E170024C858 /* Losers.json */; };
+		95189E2626BC0E4A0024C858 /* Popular.json in Resources */ = {isa = PBXBuildFile; fileRef = 95189E2526BC0E4A0024C858 /* Popular.json */; };
+		95189E2826BC0EBE0024C858 /* CompanyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E2726BC0EBE0024C858 /* CompanyRow.swift */; };
+		95189E2A26BC21230024C858 /* Popular.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95189E2926BC21230024C858 /* Popular.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -24,6 +35,16 @@
 		95189E0326BBF70C0024C858 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		95189E0926BBF8870024C858 /* Explorer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Explorer.swift; sourceTree = "<group>"; };
 		95189E0B26BBF89E0024C858 /* Details.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Details.swift; sourceTree = "<group>"; };
+		95189E1426BC01580024C858 /* CompanyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyModel.swift; sourceTree = "<group>"; };
+		95189E1726BC01BD0024C858 /* JsonManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonManager.swift; sourceTree = "<group>"; };
+		95189E1926BC02360024C858 /* Company.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Company.swift; sourceTree = "<group>"; };
+		95189E1B26BC0A930024C858 /* RandomDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomDataManager.swift; sourceTree = "<group>"; };
+		95189E1D26BC0DC70024C858 /* MostActive.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = MostActive.json; sourceTree = "<group>"; };
+		95189E2126BC0E080024C858 /* Gainers.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = Gainers.json; sourceTree = "<group>"; };
+		95189E2326BC0E170024C858 /* Losers.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = Losers.json; sourceTree = "<group>"; };
+		95189E2526BC0E4A0024C858 /* Popular.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = Popular.json; sourceTree = "<group>"; };
+		95189E2726BC0EBE0024C858 /* CompanyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyRow.swift; sourceTree = "<group>"; };
+		95189E2926BC21230024C858 /* Popular.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Popular.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -31,6 +52,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				95189E0F26BBFD4A0024C858 /* StockCharts in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -59,9 +81,13 @@
 				95189DFA26BBF70B0024C858 /* TradesApp.swift */,
 				95189DFC26BBF70B0024C858 /* ContentView.swift */,
 				95189E0926BBF8870024C858 /* Explorer.swift */,
+				95189E2926BC21230024C858 /* Popular.swift */,
 				95189E0B26BBF89E0024C858 /* Details.swift */,
 				95189DFE26BBF70C0024C858 /* Assets.xcassets */,
 				95189E0326BBF70C0024C858 /* Info.plist */,
+				95189E1626BC01AB0024C858 /* Helpers */,
+				95189E1326BC01460024C858 /* Models */,
+				95189E1026BC01240024C858 /* Resources */,
 				95189E0026BBF70C0024C858 /* Preview Content */,
 			);
 			path = Trades;
@@ -75,6 +101,36 @@
 			path = "Preview Content";
 			sourceTree = "<group>";
 		};
+		95189E1026BC01240024C858 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				95189E1D26BC0DC70024C858 /* MostActive.json */,
+				95189E2126BC0E080024C858 /* Gainers.json */,
+				95189E2326BC0E170024C858 /* Losers.json */,
+				95189E2526BC0E4A0024C858 /* Popular.json */,
+			);
+			path = Resources;
+			sourceTree = "<group>";
+		};
+		95189E1326BC01460024C858 /* Models */ = {
+			isa = PBXGroup;
+			children = (
+				95189E1426BC01580024C858 /* CompanyModel.swift */,
+			);
+			path = Models;
+			sourceTree = "<group>";
+		};
+		95189E1626BC01AB0024C858 /* Helpers */ = {
+			isa = PBXGroup;
+			children = (
+				95189E1726BC01BD0024C858 /* JsonManager.swift */,
+				95189E1926BC02360024C858 /* Company.swift */,
+				95189E1B26BC0A930024C858 /* RandomDataManager.swift */,
+				95189E2726BC0EBE0024C858 /* CompanyRow.swift */,
+			);
+			path = Helpers;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -91,6 +147,9 @@
 			dependencies = (
 			);
 			name = Trades;
+			packageProductDependencies = (
+				95189E0E26BBFD4A0024C858 /* StockCharts */,
+			);
 			productName = Trades;
 			productReference = 95189DF726BBF70B0024C858 /* Trades.app */;
 			productType = "com.apple.product-type.application";
@@ -118,6 +177,9 @@
 				Base,
 			);
 			mainGroup = 95189DEE26BBF70B0024C858;
+			packageReferences = (
+				95189E0D26BBFD4A0024C858 /* XCRemoteSwiftPackageReference "stock-charts" */,
+			);
 			productRefGroup = 95189DF826BBF70B0024C858 /* Products */;
 			projectDirPath = "";
 			projectRoot = "";
@@ -133,7 +195,11 @@
 			buildActionMask = 2147483647;
 			files = (
 				95189E0226BBF70C0024C858 /* Preview Assets.xcassets in Resources */,
+				95189E2626BC0E4A0024C858 /* Popular.json in Resources */,
+				95189E2426BC0E170024C858 /* Losers.json in Resources */,
+				95189E2226BC0E080024C858 /* Gainers.json in Resources */,
 				95189DFF26BBF70C0024C858 /* Assets.xcassets in Resources */,
+				95189E1E26BC0DC70024C858 /* MostActive.json in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -144,10 +210,16 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				95189E1C26BC0A930024C858 /* RandomDataManager.swift in Sources */,
+				95189E2A26BC21230024C858 /* Popular.swift in Sources */,
 				95189E0A26BBF8870024C858 /* Explorer.swift in Sources */,
+				95189E2826BC0EBE0024C858 /* CompanyRow.swift in Sources */,
 				95189DFD26BBF70B0024C858 /* ContentView.swift in Sources */,
 				95189E0C26BBF89E0024C858 /* Details.swift in Sources */,
+				95189E1826BC01BD0024C858 /* JsonManager.swift in Sources */,
+				95189E1A26BC02360024C858 /* Company.swift in Sources */,
 				95189DFB26BBF70B0024C858 /* TradesApp.swift in Sources */,
+				95189E1526BC01580024C858 /* CompanyModel.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -336,6 +408,25 @@
 			defaultConfigurationName = Release;
 		};
 /* End XCConfigurationList section */
+
+/* Begin XCRemoteSwiftPackageReference section */
+		95189E0D26BBFD4A0024C858 /* XCRemoteSwiftPackageReference "stock-charts" */ = {
+			isa = XCRemoteSwiftPackageReference;
+			repositoryURL = "https://github.com/denniscm190/stock-charts.git";
+			requirement = {
+				branch = development;
+				kind = branch;
+			};
+		};
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+		95189E0E26BBFD4A0024C858 /* StockCharts */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = 95189E0D26BBFD4A0024C858 /* XCRemoteSwiftPackageReference "stock-charts" */;
+			productName = StockCharts;
+		};
+/* End XCSwiftPackageProductDependency section */
 	};
 	rootObject = 95189DEF26BBF70B0024C858 /* Project object */;
 }
--- a/Trades/ContentView.swift	Thu Aug 05 12:03:19 2021 +0100
+++ b/Trades/ContentView.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -8,9 +8,30 @@
 import SwiftUI
 
 struct ContentView: View {
+    @State private var tab: Tab = .explorer
+    
+    private enum Tab {
+        case explorer, popular, details
+    }
+    
     var body: some View {
-        Text("Hello, world!")
-            .padding()
+        TabView(selection: $tab) {
+            Explorer()
+                .tabItem {
+                    Label("Explorer", systemImage: "magnifyingglass")
+                }
+                .tag(Tab.explorer)
+            
+            Popular()
+                .tabItem {
+                    Label("Popular", systemImage: "eyes")
+                }
+            
+            Details(company: CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL"))
+                .tabItem {
+                    Label("Details", systemImage: "chart.pie")
+                }
+        }
     }
 }
 
--- a/Trades/Details.swift	Thu Aug 05 12:03:19 2021 +0100
+++ b/Trades/Details.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -6,15 +6,87 @@
 //
 
 import SwiftUI
+import StockCharts
 
 struct Details: View {
+    var company: CompanyModel
+    let randomDataManager = RandomDataManager()
+    
+    @State private var dates = ["1D", "5D", "1W", "3M", "6M", "1Y"]
+    @State private var selectedDate = "3M"
+    
     var body: some View {
-        Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
+        NavigationView {
+            ScrollView {
+                VStack(alignment: .leading) {
+                    RoundedRectangle(cornerRadius: 25)
+                        .foregroundColor(Color(.secondarySystemBackground))
+                        .frame(height: 300)
+                        .overlay(
+                            VStack(alignment: .leading) {
+                                Text("\(company.symbol) is trading at \(company.price, specifier: "%.2f")")
+                                    .font(.title2)
+                                    .fontWeight(.semibold)
+                                    .padding()
+                                
+                                let data = randomDataManager.create()
+                                let lineChartStyle = LineChartStyle(
+                                    labelColor: Color(.systemBlue),
+                                    indicatorPointColor: Color(.systemTeal),
+                                    showingIndicatorLineColor: Color(.systemBlue),
+                                    flatTrendLineColor: Color(.systemTeal),
+                                    uptrendLineColor: Color(.systemGreen),
+                                    downtrendLineColor: Color(.systemRed)
+                                )
+                                
+                                LineChartView(
+                                    data: data,
+                                    dates: nil,
+                                    hours: nil,
+                                    dragGesture: true,
+                                    style: lineChartStyle
+                                )
+                                .padding(.bottom)
+                            }
+                            ,alignment: .leading
+                        )
+                    
+                    Picker("Please choose a date", selection: $selectedDate) {
+                        ForEach(dates, id: \.self) {
+                            Text($0)
+                        }
+                    }
+                    .pickerStyle(SegmentedPickerStyle())
+                    
+                    Divider()
+                    Text("\(company.name)")
+                        .font(.title2)
+                        .fontWeight(.semibold)
+                    
+                    let description = """
+                    Apple Inc. is an American multinational technology company that specializes in consumer electronics, computer software, and online services.Apple is the world's largest technology company by revenue (totaling $274.5 billion in 2020) and, since January 2021, the world's most valuable company. As of 2021, Apple is the world's fourth-largest PC vendor by unit sales, and fourth-largest smartphone manufacturer. It is one of the Big Five American information technology companies, along with Amazon, Google, Microsoft, and Facebook.
+
+                    Apple was founded by Steve Jobs, Steve Wozniak, and Ronald Wayne in 1976 to develop and sell Wozniak's Apple I personal computer. It was incorporated by Jobs and Wozniak as Apple Computer, Inc. in 1977, and sales of its computers, including the Apple II, grew quickly. They went public in 1980 to instant financial success. Over the next few years, Apple shipped new computers featuring innovative graphical user interfaces, such as the original Macintosh, announced with the critically acclaimed advert "1984". However, the high price of its products and limited application library caused problems, as did power struggles between executives. In 1985, Wozniak departed Apple amicably,[15] while Jobs resigned to found NeXT, taking some Apple co-workers with him.
+                    """
+                    
+                    Text(description)
+                        .multilineTextAlignment(.leading)
+                }
+                .padding()
+            }
+            .navigationTitle("Details")
+        }
     }
 }
 
 struct Details_Previews: PreviewProvider {
     static var previews: some View {
-        Details()
+        Details(
+            company: CompanyModel(
+                name: "Apple Inc.",
+                price: 120.30,
+                symbol: "AAPL"
+            )
+        )
     }
 }
--- a/Trades/Explorer.swift	Thu Aug 05 12:03:19 2021 +0100
+++ b/Trades/Explorer.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -8,8 +8,22 @@
 import SwiftUI
 
 struct Explorer: View {
+    let jsonManager = JsonManager()
+    
     var body: some View {
-        Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
+        NavigationView {
+            List {
+                let mostActive: [CompanyModel] = jsonManager.read("MostActive.json")
+                CompanyRow(companies: mostActive, title: "Most Active")
+                
+                let gainer: [CompanyModel] = jsonManager.read("Gainers.json")
+                CompanyRow(companies: gainer, title: "Gainers")
+                
+                let losers: [CompanyModel] = jsonManager.read("Losers.json")
+                CompanyRow(companies: losers, title: "Losers")
+            }
+            .navigationTitle("Explorer")
+        }
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Helpers/Company.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,74 @@
+//
+//  Company.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+import StockCharts
+
+struct Company: View {
+    var company: CompanyModel
+    let randomDataManager = RandomDataManager()
+    
+    var body: some View {
+        RoundedRectangle(cornerRadius: 25)
+            .foregroundColor(Color(.secondarySystemBackground))
+            .frame(width: 170, height: 230)
+            .overlay(
+                VStack(alignment: .leading) {
+                    Group {
+                        Text(company.symbol)
+                            .font(.title3)
+                            .fontWeight(.semibold)
+                            .padding(.top)
+                        
+                        Text(company.name)
+                            .foregroundColor(.secondary)
+                            .padding(.bottom, 10)
+                        
+                        Text("\(company.price, specifier: "%.2f")")
+                            .font(.title2)
+                            .fontWeight(.semibold)
+                            .padding(.bottom)
+                    }
+                    .padding(.horizontal)
+                    
+                    Spacer()
+                    
+                    let data = randomDataManager.create()
+                    let lineChartStyle = LineChartStyle(
+                        labelColor: Color(.systemBlue),
+                        indicatorPointColor: Color(.systemTeal),
+                        showingIndicatorLineColor: Color(.systemBlue),
+                        flatTrendLineColor: Color(.systemTeal),
+                        uptrendLineColor: Color(.systemGreen),
+                        downtrendLineColor: Color(.systemRed)
+                    )
+                    
+                    LineChartView(
+                        data: data,
+                        dates: nil,
+                        hours: nil,
+                        dragGesture: false,
+                        style: lineChartStyle
+                    )
+                    .padding(.bottom, 5)
+                }
+                , alignment: .leading
+            )
+    }
+}
+
+struct Company_Previews: PreviewProvider {
+    static var previews: some View {
+        Company(
+            company: CompanyModel(
+                name: "Apple Inc.",
+                price: 120.30,
+                symbol: "AAPL"
+            )
+        )
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Helpers/CompanyRow.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,48 @@
+//
+//  CompanyRow.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+
+struct CompanyRow: View {
+    var companies: [CompanyModel]
+    var title: String
+    
+    var body: some View {
+        VStack(alignment: .leading) {
+            Text(title)
+                .font(.title2)
+                .fontWeight(.semibold)
+                .padding(.horizontal)
+            
+            ScrollView(.horizontal, showsIndicators: false) {
+                HStack(spacing: 20) {
+                    ForEach(companies, id: \.self) { company in
+                        Company(company: company)
+                    }
+                }
+                .padding(.horizontal)
+            }
+        }
+        .padding(.vertical)
+        .listRowInsets(EdgeInsets())
+    }
+}
+
+struct MostActiveRow_Previews: PreviewProvider {
+    static var previews: some View {
+        CompanyRow(
+            companies: [
+                CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL"),
+                CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL"),
+                CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL"),
+                CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL"),
+                CompanyModel(name: "Apple Inc.", price: 120.30, symbol: "AAPL")
+            ],
+            title: "Most Active"
+        )
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Helpers/JsonManager.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,32 @@
+//
+//  JsonManager.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+
+class JsonManager {
+    func read<T: Decodable>(_ filename: String) -> T {
+        let data: Data
+        
+        guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
+        else {
+            fatalError("Couldn't find \(filename) in main bundle.")
+        }
+        
+        do {
+            data = try Data(contentsOf: file)
+        } catch {
+            fatalError("Couldn't load \(filename) from main bundle:\n\(error)")
+        }
+        
+        do {
+            let decoder = JSONDecoder()
+            return try decoder.decode(T.self, from: data)
+        } catch {
+            fatalError("Couldn't parse \(filename) as \(T.self):\n\(error)")
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Helpers/RandomDataManager.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,21 @@
+//
+//  RandomDataManager.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+import GameplayKit
+
+class RandomDataManager {
+    func create() -> [Double] {
+        let distribution = GKGaussianDistribution(lowestValue: 10, highestValue: 100)
+        var prices: [Double] = []
+        for _ in (1..<80) {
+            prices.append(Double(distribution.nextInt()))
+        }
+        
+        return prices
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Models/CompanyModel.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,14 @@
+//
+//  CompanyModel.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+
+struct CompanyModel: Codable, Hashable {
+    var name: String
+    var price: Double
+    var symbol: String
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Popular.swift	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,67 @@
+//
+//  Popular.swift
+//  Trades
+//
+//  Created by Dennis Concepción Martín on 5/8/21.
+//
+
+import SwiftUI
+import StockCharts
+
+struct Popular: View {
+    let jsonManager = JsonManager()
+    let randomDataManager = RandomDataManager()
+    
+    var body: some View {
+        NavigationView {
+            List {
+                let popular: [CompanyModel] = jsonManager.read("Popular.json")
+                ForEach(popular, id: \.self) { company in
+                    HStack(alignment: .top) {
+                        VStack(alignment: .leading) {
+                            Text(company.symbol)
+                                .fontWeight(.semibold)
+                            
+                            Text(company.name)
+                                .foregroundColor(.secondary)
+                                .lineLimit(1)
+                        }
+                        .padding(.trailing)
+                        
+                        let data = randomDataManager.create()
+                        let lineChartStyle = LineChartStyle(
+                            labelColor: Color(.systemBlue),
+                            indicatorPointColor: Color(.systemTeal),
+                            showingIndicatorLineColor: Color(.systemBlue),
+                            flatTrendLineColor: Color(.systemTeal),
+                            uptrendLineColor: Color(.systemGreen),
+                            downtrendLineColor: Color(.systemRed)
+                        )
+                        
+                        Spacer()
+                        
+                        LineChartView(
+                            data: data,
+                            dates: nil,
+                            hours: nil,
+                            dragGesture: false,
+                            style: lineChartStyle
+                        )
+                        .frame(width: 150)
+                        
+                            Text("\(company.price, specifier: "%.2f")")
+                                .fontWeight(.semibold)
+                                .padding(.leading)
+                    }
+                }
+            }
+            .navigationTitle("Popular")
+        }
+    }
+}
+
+struct Popular_Previews: PreviewProvider {
+    static var previews: some View {
+        Popular()
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Resources/Gainers.json	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,52 @@
+[
+    {
+        "name": "Jaxnation",
+        "price": 48,
+        "symbol": "NTES"
+    },
+    {
+        "name": "Jamia",
+        "price": 51,
+        "symbol": "PSCH"
+    },
+    {
+        "name": "Thoughtbeat",
+        "price": 26,
+        "symbol": "WVVIP"
+    },
+    {
+        "name": "Browsezoom",
+        "price": 41,
+        "symbol": "AFAM"
+    },
+    {
+        "name": "Skinder",
+        "price": 6,
+        "symbol": "CSL"
+    },
+    {
+        "name": "Skimia",
+        "price": 82,
+        "symbol": "HABT"
+    },
+    {
+        "name": "Blogpad",
+        "price": 35,
+        "symbol": "TRNO^A.CL"
+    },
+    {
+        "name": "Brainlounge",
+        "price": 87,
+        "symbol": "ZUMZ"
+    },
+    {
+        "name": "Thoughtbridge",
+        "price": 10,
+        "symbol": "AMBC"
+    },
+    {
+        "name": "Myworks",
+        "price": 75,
+        "symbol": "CRT"
+    }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Resources/Losers.json	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,52 @@
+[
+    {
+        "name": "Tagpad",
+        "price": 78,
+        "symbol": "JMM"
+    },
+    {
+        "name": "Bubbletube",
+        "price": 54,
+        "symbol": "FWONA"
+    },
+    {
+        "name": "Zoombox",
+        "price": 83,
+        "symbol": "LEN.B"
+    },
+    {
+        "name": "Tagtune",
+        "price": 79,
+        "symbol": "CRS"
+    },
+    {
+        "name": "Zoonoodle",
+        "price": 61,
+        "symbol": "NRP"
+    },
+    {
+        "name": "Zoombeat",
+        "price": 100,
+        "symbol": "GAIN"
+    },
+    {
+        "name": "Skiba",
+        "price": 37,
+        "symbol": "JASNW"
+    },
+    {
+        "name": "Zoomdog",
+        "price": 70,
+        "symbol": "DRNA"
+    },
+    {
+        "name": "Thoughtsphere",
+        "price": 96,
+        "symbol": "NXEO"
+    },
+    {
+        "name": "Dablist",
+        "price": 10,
+        "symbol": "ATTO"
+    }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Resources/MostActive.json	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,52 @@
+[
+    {
+        "name": "Jazzy",
+        "price": 64,
+        "symbol": "BTZ"
+    },
+    {
+        "name": "Kwinu",
+        "price": 8,
+        "symbol": "OACQ"
+    },
+    {
+        "name": "Ooba",
+        "price": 18,
+        "symbol": "NIHD"
+    },
+    {
+        "name": "Linktype",
+        "price": 54,
+        "symbol": "EACQ"
+    },
+    {
+        "name": "Mydeo",
+        "price": 65,
+        "symbol": "SO"
+    },
+    {
+        "name": "Yamia",
+        "price": 74,
+        "symbol": "REXR"
+    },
+    {
+        "name": "Camido",
+        "price": 37,
+        "symbol": "NTG"
+    },
+    {
+        "name": "Mudo",
+        "price": 96,
+        "symbol": "ARL"
+    },
+    {
+        "name": "Realblab",
+        "price": 67,
+        "symbol": "IMRNW"
+    },
+    {
+        "name": "Skipstorm",
+        "price": 19,
+        "symbol": "DORM"
+    }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Trades/Resources/Popular.json	Thu Aug 05 15:35:19 2021 +0100
@@ -0,0 +1,52 @@
+[
+    {
+        "name": "Tagpad",
+        "price": 68,
+        "symbol": "HRB"
+    },
+    {
+        "name": "Kare",
+        "price": 25,
+        "symbol": "ARCW"
+    },
+    {
+        "name": "Mita",
+        "price": 98,
+        "symbol": "TICCL"
+    },
+    {
+        "name": "Skaboo",
+        "price": 35,
+        "symbol": "CTAA"
+    },
+    {
+        "name": "Demimbu",
+        "price": 81,
+        "symbol": "NSH"
+    },
+    {
+        "name": "Fliptune",
+        "price": 53,
+        "symbol": "TNXP"
+    },
+    {
+        "name": "Wikido",
+        "price": 25,
+        "symbol": "LNC.WS"
+    },
+    {
+        "name": "Tanoodle",
+        "price": 98,
+        "symbol": "BLRX"
+    },
+    {
+        "name": "Jaxbean",
+        "price": 99,
+        "symbol": "HIX"
+    },
+    {
+        "name": "Babbleset",
+        "price": 71,
+        "symbol": "ALL^B"
+    }
+]
Binary file repo-resources/image1.jpeg has changed