changeset 330:bd65ad95eae0

Reorganizing files
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Tue, 30 Mar 2021 23:15:15 +0200
parents 6576d259c8c8
children 47e4402a866e
files LazyBear/Views/Helpers/LineShape.swift LazyBear/Views/Helpers/LineView.swift
diffstat 2 files changed, 0 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/LazyBear/Views/Helpers/LineShape.swift	Tue Mar 30 23:15:06 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-//
-//  LineShape.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 29/3/21.
-//
-
-import SwiftUI
-
-struct LineShape: Shape {
-    var width: CGFloat
-    var height: CGFloat
-    var normalizedData: [Double]
-    
-    func path(in rect: CGRect) -> Path {
-        var path = Path()
-        
-        let spaceBetweenPoints = Double(width) / Double(normalizedData.count - 1)
-        var xPoint: Double = 0
-        let initialYPoint = normalizedData.first ?? 0 * Double(height)
-        
-        path.move(to: CGPoint(x: xPoint, y: initialYPoint))
-        
-        var firstLoop = true
-        for yPoint in normalizedData {
-            if firstLoop {
-                firstLoop = false
-            } else {
-                xPoint += spaceBetweenPoints
-                let yPoint = yPoint * Double(height)
-                path.addLine(to: CGPoint(x: xPoint, y: yPoint))
-            }
-        }
-        
-        return path
-    }
-}
-
--- a/LazyBear/Views/Helpers/LineView.swift	Tue Mar 30 23:15:06 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-//
-//  LineView.swift
-//  LazyBear
-//
-//  Created by Dennis Concepción Martín on 29/3/21.
-//
-
-import SwiftUI
-
-struct LineView: View {
-    var body: some View {
-        GeometryReader { proxy in
-            VStack {
-                let sampleData = generateRandomSample()
-                LineShape(width: proxy.size.width, height: proxy.size.height, normalizedData: normalize(sampleData))
-                    .stroke(lineWidth: 2)
-                    .rotationEffect(.degrees(180), anchor: .center)
-                    .rotation3DEffect(.degrees(180), axis: (x: 0.0, y: 1.0, z: 0.0))
-            }
-        }
-    }
-    
-    // Normalize data
-    func normalize(_ data: [Double]) -> [Double] {
-        var normalData = [Double]()
-        let min = data.min()!
-        let max = data.max()!
-
-        for value in data {
-            let normal = (value - min) / (max - min)
-            normalData.append(normal)
-        }
-
-        return normalData
-    }
-    
-    // DELETE THIS FUNCTION ON PRODUCTION
-    private func generateRandomSample() -> [Double] {
-        var randomSample = [Double]()
-        for _ in 1..<10 {
-            randomSample.append(Double.random(in: 1...100))
-        }
-        
-        return randomSample
-    }
-}
-
-struct LineView_Previews: PreviewProvider {
-    static var previews: some View {
-        LineView()
-    }
-}