Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created May 31, 2020 15:51
Show Gist options
  • Save prafullakumar/6f6b4f124d86eb38579fb90df5ef14b6 to your computer and use it in GitHub Desktop.
Save prafullakumar/6f6b4f124d86eb38579fb90df5ef14b6 to your computer and use it in GitHub Desktop.
import SwiftUI
import Combine
struct ContentView: View {
func tick(at tick: Int) -> some View {
VStack {
Rectangle()
.fill(Color.primary)
.opacity(tick % 5 == 0 ? 1 : 0.4)
.frame(width: 2, height: tick % 5 == 0 ? 15 : 7)
Spacer()
}.rotationEffect(Angle.degrees(Double(tick)/(60) * 360))
}
var body: some View {
return ZStack {
ForEach(0..<60) { tick in
self.tick(at: tick)
}
GeometryReader { geometry in
ZStack {
HStack {
Text("9")
Spacer()
Text("3")
EmptyView()
}
VStack {
EmptyView()
Text("12")
Spacer()
Text("6")
EmptyView()
}
}.frame(width: geometry.size.width - 40, height: geometry.size.height - 30, alignment: .center)
}
}.frame(width: 200, height: 200, alignment: .center)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment