-
Notifications
You must be signed in to change notification settings - Fork 12
/
creepyMap.swift
36 lines (33 loc) · 1.09 KB
/
creepyMap.swift
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
//
// ContentView.swift
// Examples
//
// Created by GrandSir on 19.09.2022.
//
import SwiftUI
import InteractiveMap
struct ContentView: View {
@State private var clickedPath = PathData()
var body: some View {
VStack {
Text(clickedPath.name.isEmpty ? "" : "\(clickedProvince.name) is clicked!" )
.font(.largeTitle)
.padding(.bottom, 15)
InteractiveMap(svgName: "tr") { pathData in // is a PathData
InteractiveShape(pathData)
.initWithAttributes(.init(strokeWidth: 2, strokeColor: .black, background: .black.opacity(0.3)))
.shadow(color: clickedProvince == province ? .white : .clear, radius: 6)
.onTapGesture {
clickedPath = pathData
}
.animation(.easeInOut(duration: 0.2), value: clickedPath)
.zIndex(clickedPath == pathData ? 2 : 1)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}