comparison Sources/StockCharts/CapsuleChart/CapsuleChartView.swift @ 103:766a1169564b

Add WatchOS compatability
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Sun, 27 Jun 2021 16:32:23 +0200
parents 3e94c6721a6a
children 0c0d38dca6d8
comparison
equal deleted inserted replaced
102:7e524a9cc194 103:766a1169564b
15 } 15 }
16 public var body: some View { 16 public var body: some View {
17 ZStack { 17 ZStack {
18 GeometryReader { proxy in 18 GeometryReader { proxy in
19 Group { 19 Group {
20 #if os(iOS)
20 Capsule() 21 Capsule()
21 .foregroundColor(Color(.systemGray)) 22 .foregroundColor(Color(.systemGray))
22 .opacity(0.2) 23 .opacity(0.2)
23 24
24 Capsule() 25 Capsule()
25 .foregroundColor(Color(.systemBlue)) 26 .foregroundColor(Color(.systemBlue))
26 .frame(width: proxy.size.width * percentageOfWidth) 27 .frame(width: proxy.size.width * percentageOfWidth)
28 #elseif os(watchOS)
29 Capsule()
30 .foregroundColor(Color(.gray))
31 .opacity(0.2)
32
33 Capsule()
34 .foregroundColor(Color(.blue))
35 .frame(width: proxy.size.width * percentageOfWidth)
36 #endif
37
27 } 38 }
28 .frame(height: 10) 39 .frame(height: 10)
29 } 40 }
30 } 41 }
31 } 42 }