-
Notifications
You must be signed in to change notification settings - Fork 644
Expand file tree
/
Copy pathMagnifierRect.swift
More file actions
39 lines (37 loc) · 1.37 KB
/
MagnifierRect.swift
File metadata and controls
39 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// MagnifierRect.swift
//
//
// Created by Samu András on 2020. 03. 04..
//
import SwiftUI
public struct MagnifierRect: View {
@Binding var currentNumber: Double
@Binding var currentXValue: CustomStringConvertible?
var valueSpecifier:String
@Environment(\.colorScheme) var colorScheme: ColorScheme
public var body: some View {
VStack{
Text("\(self.currentNumber, specifier: valueSpecifier)")
.font(.system(size: 18, weight: .bold))
.foregroundColor(self.colorScheme == .dark ? Color.white : Color.black)
.padding(16)
Spacer()
if let currentValue = currentXValue {
Text(String(describing: currentValue))
.font(.system(size: 18, weight: .semibold, design: .default))
.foregroundColor(self.colorScheme == .dark ? Color.white : Color.gray)
.padding(16)
}
}
.background(colorScheme == .dark ?
AnyView(RoundedRectangle(cornerRadius: 16)
.stroke(Color.white, lineWidth: self.colorScheme == .dark ? 2 : 0))
:
AnyView(RoundedRectangle(cornerRadius: 16)
.foregroundColor(Color.white)
.shadow(color: Colors.LegendText, radius: 12, x: 0, y: 6 )
.blendMode(.multiply))
)
}
}