changeset 76:0ceb65f13839

Implement API structure
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 24 Jan 2021 19:22:46 +0100
parents 883cac235c16
children 9bee37809429
files LazyBear.xcodeproj/project.pbxproj LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate lazybear/API.swift lazybear/Company.swift lazybear/SampleConfig.swift lazybear/Stock.swift lazybear/Supply views/Company.swift lazybear/Supply views/Stock.swift lazybear/Tests/File.swift lazybear/Tests/SomeTests.playground/Contents.swift lazybear/Tests/SomeTests.playground/contents.xcplayground lazybear/Tests/Test.swift lazybear/Tests/Test2.swift lazybear/Tests/Untitled.xcworkspace/contents.xcworkspacedata lazybear/Tests/Untitled.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist lazybear/Tests/Untitled.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate
diffstat 16 files changed, 203 insertions(+), 254 deletions(-) [+]
line wrap: on
line diff
--- a/LazyBear.xcodeproj/project.pbxproj	Sun Jan 24 16:15:17 2021 +0100
+++ b/LazyBear.xcodeproj/project.pbxproj	Sun Jan 24 19:22:46 2021 +0100
@@ -15,12 +15,10 @@
 		954D992525A2123B001F7F60 /* HistoricalPricesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D992425A2123B001F7F60 /* HistoricalPricesModel.swift */; };
 		954D996D25A2461B001F7F60 /* SwiftUICharts in Frameworks */ = {isa = PBXBuildFile; productRef = 954D996C25A2461B001F7F60 /* SwiftUICharts */; };
 		954D997125A253A9001F7F60 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D997025A253A9001F7F60 /* Config.swift */; };
-		9552A61F25B06580001CD0C8 /* SampleConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9552A61E25B0657F001CD0C8 /* SampleConfig.swift */; };
 		95612C512598D48200F7698F /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95612C4F2598D48200F7698F /* SearchBar.swift */; };
 		956FAF7B25AF421E0002B2C1 /* FavCompany+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956FAF7925AF421E0002B2C1 /* FavCompany+CoreDataClass.swift */; };
 		956FAF7C25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956FAF7A25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift */; };
 		95700BC625BD9D12009CEEFE /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95700BC525BD9D12009CEEFE /* API.swift */; };
-		95700BC925BDAF83009CEEFE /* Test2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95700BC825BDAF83009CEEFE /* Test2.swift */; };
 		958E472B25B1CA8B0048E770 /* FavCompanyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958E472A25B1CA8B0048E770 /* FavCompanyList.swift */; };
 		95AB4A7A259DCBAE0064C9C1 /* ReadJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AB4A79259DCBAE0064C9C1 /* ReadJson.swift */; };
 		95AB4A7D259DCC0C0064C9C1 /* CompanyDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AB4A7C259DCC0C0064C9C1 /* CompanyDataModel.swift */; };
@@ -33,7 +31,6 @@
 		95D1BF4925ADCF7700E5D063 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95D1BF4825ADCF7700E5D063 /* Persistence.swift */; };
 		95E0287825B88F0B00020CF2 /* formDescription.json in Resources */ = {isa = PBXBuildFile; fileRef = 95E0287725B88F0B00020CF2 /* formDescription.json */; };
 		95E0287B25B88F3C00020CF2 /* FormDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E0287A25B88F3C00020CF2 /* FormDescription.swift */; };
-		95E68FD625BCC2E4006468EF /* Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E68FD525BCC2E4006468EF /* Test.swift */; };
 		95F6C2DD25BAD394003CF389 /* FavCompanyRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2DC25BAD394003CF389 /* FavCompanyRow.swift */; };
 		95F6C2E425BAD529003CF389 /* RandomColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2E325BAD529003CF389 /* RandomColor.swift */; };
 		95F6C2F025BAE2ED003CF389 /* Company.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F6C2EF25BAE2ED003CF389 /* Company.swift */; };
@@ -55,12 +52,10 @@
 		954D992125A2105F001F7F60 /* companies.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = companies.json; path = lazybear/Data/companies.json; sourceTree = SOURCE_ROOT; };
 		954D992425A2123B001F7F60 /* HistoricalPricesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HistoricalPricesModel.swift; path = lazybear/Models/HistoricalPricesModel.swift; sourceTree = SOURCE_ROOT; };
 		954D997025A253A9001F7F60 /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Config.swift; path = lazybear/Config.swift; sourceTree = SOURCE_ROOT; };
-		9552A61E25B0657F001CD0C8 /* SampleConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SampleConfig.swift; path = lazybear/SampleConfig.swift; sourceTree = SOURCE_ROOT; };
 		95612C4F2598D48200F7698F /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; };
 		956FAF7925AF421E0002B2C1 /* FavCompany+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FavCompany+CoreDataClass.swift"; sourceTree = "<group>"; };
 		956FAF7A25AF421E0002B2C1 /* FavCompany+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FavCompany+CoreDataProperties.swift"; sourceTree = "<group>"; };
 		95700BC525BD9D12009CEEFE /* API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = API.swift; path = lazybear/API.swift; sourceTree = SOURCE_ROOT; };
-		95700BC825BDAF83009CEEFE /* Test2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Test2.swift; path = lazybear/Tests/Test2.swift; sourceTree = SOURCE_ROOT; };
 		958E472A25B1CA8B0048E770 /* FavCompanyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FavCompanyList.swift; path = "lazybear/Supply views/FavCompanyList.swift"; sourceTree = SOURCE_ROOT; };
 		95AB4A79259DCBAE0064C9C1 /* ReadJson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ReadJson.swift; path = lazybear/Functions/ReadJson.swift; sourceTree = SOURCE_ROOT; };
 		95AB4A7C259DCC0C0064C9C1 /* CompanyDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = CompanyDataModel.swift; path = lazybear/Models/CompanyDataModel.swift; sourceTree = SOURCE_ROOT; };
@@ -75,7 +70,6 @@
 		95D1BF4825ADCF7700E5D063 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Persistence.swift; path = "LazyBear/Core Data/Persistence.swift"; sourceTree = SOURCE_ROOT; };
 		95E0287725B88F0B00020CF2 /* formDescription.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = formDescription.json; path = lazybear/Data/formDescription.json; sourceTree = SOURCE_ROOT; };
 		95E0287A25B88F3C00020CF2 /* FormDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FormDescription.swift; path = lazybear/Models/FormDescription.swift; sourceTree = SOURCE_ROOT; };
-		95E68FD525BCC2E4006468EF /* Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Test.swift; path = lazybear/Tests/Test.swift; sourceTree = SOURCE_ROOT; };
 		95F6C2DC25BAD394003CF389 /* FavCompanyRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavCompanyRow.swift; sourceTree = "<group>"; };
 		95F6C2E325BAD529003CF389 /* RandomColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RandomColor.swift; path = lazybear/Functions/RandomColor.swift; sourceTree = SOURCE_ROOT; };
 		95F6C2EF25BAE2ED003CF389 /* Company.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Company.swift; sourceTree = "<group>"; };
@@ -112,8 +106,6 @@
 		952F791C2598B1CD00FF929F /* Tests */ = {
 			isa = PBXGroup;
 			children = (
-				95E68FD525BCC2E4006468EF /* Test.swift */,
-				95700BC825BDAF83009CEEFE /* Test2.swift */,
 			);
 			path = Tests;
 			sourceTree = "<group>";
@@ -121,6 +113,8 @@
 		95612C4D2598D48200F7698F /* Supply views */ = {
 			isa = PBXGroup;
 			children = (
+				95F6C2EF25BAE2ED003CF389 /* Company.swift */,
+				95F6C2F225BAE3D1003CF389 /* Stock.swift */,
 				95F6C30025BAEC8B003CF389 /* ShowingCompany.swift */,
 				95612C4F2598D48200F7698F /* SearchBar.swift */,
 				958E472A25B1CA8B0048E770 /* FavCompanyList.swift */,
@@ -197,11 +191,8 @@
 				95F7CAF425ADC7B7009E0E7C /* LazyBear.xcdatamodeld */,
 				954D997025A253A9001F7F60 /* Config.swift */,
 				95700BC525BD9D12009CEEFE /* API.swift */,
-				9552A61E25B0657F001CD0C8 /* SampleConfig.swift */,
 				95B04EB225212369000AD27F /* LazyBearApp.swift */,
 				95B04EB425212369000AD27F /* ContentView.swift */,
-				95F6C2EF25BAE2ED003CF389 /* Company.swift */,
-				95F6C2F225BAE3D1003CF389 /* Stock.swift */,
 				95612C4D2598D48200F7698F /* Supply views */,
 				95855384259CD9800081CF24 /* Functions */,
 				9592F496259D29F1005AB6F1 /* Models */,
@@ -312,19 +303,16 @@
 				95D1BF4925ADCF7700E5D063 /* Persistence.swift in Sources */,
 				958E472B25B1CA8B0048E770 /* FavCompanyList.swift in Sources */,
 				956FAF7B25AF421E0002B2C1 /* FavCompany+CoreDataClass.swift in Sources */,
-				95E68FD625BCC2E4006468EF /* Test.swift in Sources */,
 				95F6C31125BAFFB8003CF389 /* AddWatchlist.swift in Sources */,
 				95B04EB325212369000AD27F /* LazyBearApp.swift in Sources */,
 				95F6C2F325BAE3D1003CF389 /* Stock.swift in Sources */,
 				95AB4A7D259DCC0C0064C9C1 /* CompanyDataModel.swift in Sources */,
 				95F6C2DD25BAD394003CF389 /* FavCompanyRow.swift in Sources */,
 				95700BC625BD9D12009CEEFE /* API.swift in Sources */,
-				95700BC925BDAF83009CEEFE /* Test2.swift in Sources */,
 				95F6C2E425BAD529003CF389 /* RandomColor.swift in Sources */,
 				95C28AB625BC45CF0033D16A /* ChartStyle.swift in Sources */,
 				954D997125A253A9001F7F60 /* Config.swift in Sources */,
 				95C28AB925BC46250033D16A /* ScalateChart.swift in Sources */,
-				9552A61F25B06580001CD0C8 /* SampleConfig.swift in Sources */,
 				954D992525A2123B001F7F60 /* HistoricalPricesModel.swift in Sources */,
 				95F7CAF625ADC7B7009E0E7C /* LazyBear.xcdatamodeld in Sources */,
 			);
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/lazybear/API.swift	Sun Jan 24 16:15:17 2021 +0100
+++ b/lazybear/API.swift	Sun Jan 24 19:22:46 2021 +0100
@@ -7,36 +7,113 @@
 
 import SwiftUI
 
+struct API {
+    enum BaseURL {
+        case sandbox
+        case production
+        
+        var path: (String, String) {
+            let token = Token()
+            switch self {
+            case .sandbox:
+                return ("https://sandbox.iexapis.com", token.sandbox)
+            case .production:
+                return ("https://cloud.iexapis.com", token.production)
+            }
+        }
+    }
 
-enum Url {
-    case sandbox
-    case production
+    enum Version {
+        case stable
+        
+        var path: String {
+            switch self {
+            case .stable:
+                return "/stable"
+            }
+        }
+    }
+    
+    enum Stock {
+        case symbol(company: String)
+        var path: String {
+            switch self {
+            case let .symbol(company):
+                return "/stock/\(company)"
+            }
+        }
+    }
+    
+    enum Endpoint {
+        case historicalPrices
+        var path: String {
+            switch self {
+            case .historicalPrices:
+                return "/chart"
+            }
+        }
+    }
     
-    var url: String {
-        switch self {
-        case .sandbox:
-            return "https://sandbox.iexapis.com"
-        case .production:
-            return "https://cloud.iexapis.com"
+    enum Range {
+        case period(range: String)
+        var path: String {
+            switch self {
+            case let .period(range):
+                return "/\(range)?"
+            }
+        }
+    }
+    
+    enum Parameters {
+        case chartCloseOnly
+        var path: String {
+            switch self {
+            case .chartCloseOnly:
+                return "chartCloseOnly=true"
+            }
         }
     }
+    
+    
+    // Create URL
+    func getURL(baseURL: BaseURL, version: Version, stock: Stock, endpoint: Endpoint, range: Range, parameters: Parameters) -> String {
+        let (baseURL, token) = baseURL.path
+        let version = version.path
+        let stock = stock.path
+        let endpoint = endpoint.path
+        let range = range.path
+        let parameters = parameters.path
+        
+        let url = "\(baseURL)\(version)\(stock)\(endpoint)\(range)\(parameters)&token=\(token)"
+        
+        return url
+        
+    }
+    
+    // Request API
+    func request<T: Decodable>(url: String, model: T.Type, completion: @escaping (T) -> Void) {
+        // We take some model data T.Type
+        guard let url = URL(string: url) else {
+            print("Invalid URL")
+            return
+        }
+        let request = URLRequest(url: url)
+        URLSession.shared.dataTask(with: request) { data, response, error in
+            if let data = data {
+                do {
+                    // Decode response with the model passed
+                    let decodedResponse = try JSONDecoder().decode(model, from: data)
+                    DispatchQueue.main.async {
+                        print(decodedResponse)
+                        completion(decodedResponse)
+                    }
+                    return
+                } catch {
+                    print(error)
+                }
+            }
+            print("Fetch failed: \(error?.localizedDescription ?? "Unknown error")")
+        }
+        .resume()
+    }
 }
-
-enum Endpoints {
-    case historicalPrices(H)
-    enum H {
-        case range(R)
-        enum R {
-            
-        }
-    }
-}
-
-struct SomeTest: View {
-    var body: some View {
-        Text("Hello world")
-            .onAppear {
-                
-            }
-    }
-}
--- a/lazybear/Company.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-//
-//  Company.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 22/1/21.
-//
-
-import SwiftUI
-
-struct Company: View {
-    var name: String
-    var symbol: String
-    
-    var body: some View {
-        CompanyHeader(name: self.name, symbol: self.symbol)
-        ScrollView {
-            VStack(alignment: .leading) {
-                //Stock(name: self.name, symbol: self.symbol)
-                Spacer()
-            }
-        }
-    }
-}
-
-struct Company_Previews: PreviewProvider {
-    static var previews: some View {
-        Company(name: "Apple Inc", symbol: "AAPL")
-    }
-}
--- a/lazybear/SampleConfig.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-//
-//  SampleConfig.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 14/1/21.
-//
-
--- a/lazybear/Stock.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-//
-//  Price.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 22/1/21.
-//
-
-import SwiftUI
-import SwiftUICharts
-/*
-struct Stock: View {
-    @ObservedObject var historicalPrices = HistoricalPrices()
-    @ObservedObject var latestPrice = LatestPrice()
-    
-    var periods = ["1D", "1W", "1M", "3M", "6M", "1Y", "2Y", "5Y"]
-    @State var selectedPeriod = 3
-    var name: String
-    var symbol: String
-    
-    var body: some View {
-        VStack {
-            Divider()
-            
-            let price = latestPrice.latestPrice
-            let change = latestPrice.changePercent*100
-            //let marketIsOpen = latestPrice.isUSMarketOpen
-            
-            if latestPrice.showingView {
-                CurrentPrice(price: price, change: change, marketIsOpen: false)
-            } else {
-                HStack {
-                ProgressView()
-                    .padding(.leading)
-                    Spacer()
-                }
-            }
-            
-            Divider()
-            DateSelection(selectedperiod: $selectedPeriod)
-                .padding([.leading, .trailing])
-                .onChange(of: selectedPeriod, perform: { value in
-                    historicalPrices.showingView.toggle()
-                    historicalPrices.request(symbol: self.symbol, period: periods[selectedPeriod], sandbox: true)
-                })
-            
-            if historicalPrices.showingView {
-                let prices = historicalPrices.result.map { $0.close }
-                LineView(data: scalateChart(prices: prices, selectedPeriod: selectedPeriod), title: "", style: chartStyle())
-                    .padding([.leading, .trailing])
-                    .offset(y: -40)
-            } else {
-                ProgressView()
-            }
-        }
-        .onAppear {
-            historicalPrices.request(symbol: self.symbol, period: periods[selectedPeriod], sandbox: true)
-            latestPrice.request(symbol: self.symbol, sandbox: true)
-        }
-    }
-}
-
-struct Price_Previews: PreviewProvider {
-    static var previews: some View {
-        Stock(name: "Apple Inc", symbol: "AAPL")
-    }
-}
-*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lazybear/Supply views/Company.swift	Sun Jan 24 19:22:46 2021 +0100
@@ -0,0 +1,29 @@
+//
+//  Company.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 22/1/21.
+//
+
+import SwiftUI
+
+struct Company: View {
+    var name: String
+    var symbol: String
+    
+    var body: some View {
+        CompanyHeader(name: self.name, symbol: self.symbol)
+        ScrollView {
+            VStack(alignment: .leading) {
+                //Stock(name: self.name, symbol: self.symbol)
+                Spacer()
+            }
+        }
+    }
+}
+
+struct Company_Previews: PreviewProvider {
+    static var previews: some View {
+        Company(name: "Apple Inc", symbol: "AAPL")
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lazybear/Supply views/Stock.swift	Sun Jan 24 19:22:46 2021 +0100
@@ -0,0 +1,67 @@
+//
+//  Price.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 22/1/21.
+//
+
+import SwiftUI
+import SwiftUICharts
+/*
+struct Stock: View {
+    @ObservedObject var historicalPrices = HistoricalPrices()
+    @ObservedObject var latestPrice = LatestPrice()
+    
+    var periods = ["1D", "1W", "1M", "3M", "6M", "1Y", "2Y", "5Y"]
+    @State var selectedPeriod = 3
+    var name: String
+    var symbol: String
+    
+    var body: some View {
+        VStack {
+            Divider()
+            
+            let price = latestPrice.latestPrice
+            let change = latestPrice.changePercent*100
+            //let marketIsOpen = latestPrice.isUSMarketOpen
+            
+            if latestPrice.showingView {
+                CurrentPrice(price: price, change: change, marketIsOpen: false)
+            } else {
+                HStack {
+                ProgressView()
+                    .padding(.leading)
+                    Spacer()
+                }
+            }
+            
+            Divider()
+            DateSelection(selectedperiod: $selectedPeriod)
+                .padding([.leading, .trailing])
+                .onChange(of: selectedPeriod, perform: { value in
+                    historicalPrices.showingView.toggle()
+                    historicalPrices.request(symbol: self.symbol, period: periods[selectedPeriod], sandbox: true)
+                })
+            
+            if historicalPrices.showingView {
+                let prices = historicalPrices.result.map { $0.close }
+                LineView(data: scalateChart(prices: prices, selectedPeriod: selectedPeriod), title: "", style: chartStyle())
+                    .padding([.leading, .trailing])
+                    .offset(y: -40)
+            } else {
+                ProgressView()
+            }
+        }
+        .onAppear {
+            historicalPrices.request(symbol: self.symbol, period: periods[selectedPeriod], sandbox: true)
+            latestPrice.request(symbol: self.symbol, sandbox: true)
+        }
+    }
+}
+
+struct Price_Previews: PreviewProvider {
+    static var previews: some View {
+        Stock(name: "Apple Inc", symbol: "AAPL")
+    }
+}
+*/
--- a/lazybear/Tests/File.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-//
-//  File.swift
-//  
-//
-//  Created by Dennis Concepción Martín on 24/1/21.
-//
-
-import Foundation
--- a/lazybear/Tests/SomeTests.playground/Contents.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-import UIKit
-
-func returnDouble() -> (String, String) {
-    let a = "Hello"
-    let b = "world"
-    
-    return (a, b)
-}
-
-let (a, b) = returnDouble()
-print(a)
-print(b)
--- a/lazybear/Tests/SomeTests.playground/contents.xcplayground	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<playground version='5.0' target-platform='ios' buildActiveScheme='true'>
-    <timeline fileName='timeline.xctimeline'/>
-</playground>
\ No newline at end of file
--- a/lazybear/Tests/Test.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-//
-//  Test.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 23/1/21.
-//
-
-import SwiftUI
-
-// We take some model data T.Type
-func loadData<T: Decodable>(model: T.Type, completion: @escaping (T) -> Void) {
-    guard let url = URL(string: "") else {
-        print("Invalid URL")
-        return
-    }
-    let request = URLRequest(url: url)
-    URLSession.shared.dataTask(with: request) { data, response, error in
-        if let data = data {
-            do {
-                // Decode response with the model passed
-                let decodedResponse = try JSONDecoder().decode(model, from: data)
-                DispatchQueue.main.async {
-                    print(decodedResponse)
-                    completion(decodedResponse)
-                }
-                return
-            } catch {
-                print(error)
-            }
-        }
-        print("Fetch failed: \(error?.localizedDescription ?? "Unknown error")")
-    }
-    .resume()
-}
-
-
-struct Test: View {
-    @State var results = [HistoricalPricesModel]()
-    var body: some View {
-        Text("Hello world")
-            .onAppear {
-                loadData(model: [HistoricalPricesModel].self) {
-                    self.results = $0
-                }
-            }
-    }
-}
--- a/lazybear/Tests/Test2.swift	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-//
-//  Test2.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 24/1/21.
-//
-
-import SwiftUI
-
-struct Test2: View {
-    var body: some View {
-        Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
-            .onAppear {
-
-            }
-    }
-}
-
-struct Test2_Previews: PreviewProvider {
-    static var previews: some View {
-        Test2()
-    }
-}
--- a/lazybear/Tests/Untitled.xcworkspace/contents.xcworkspacedata	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Workspace
-   version = "1.0">
-   <FileRef
-      location = "group:File.swift">
-   </FileRef>
-</Workspace>
--- a/lazybear/Tests/Untitled.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist	Sun Jan 24 16:15:17 2021 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IDEDidComputeMac32BitWarning</key>
-	<true/>
-</dict>
-</plist>
Binary file lazybear/Tests/Untitled.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed