-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathViewHighlighterExample.swift
More file actions
89 lines (64 loc) · 2.68 KB
/
ViewHighlighterExample.swift
File metadata and controls
89 lines (64 loc) · 2.68 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// ContentView.swift
// SwiftUIHighlighter
//
// Created by msz on 2023/01/23.
//
#if os(iOS)
import SwiftUI
import MapKit
import ViewHighlighter
@available(iOS 15.0, *)
struct ViewHighlighterExample: View {
@State var currentSpot: Int? = 0
var body: some View {
VStack {
Map(coordinateRegion: .constant(.init(center: .init(latitude: 34.98584759304511, longitude: 135.75867838657743),
latitudinalMeters: 5000,
longitudinalMeters: 5000)))
.ignoresSafeArea()
.overlay {
VStack {
SearchTextFieldView(searchText: .constant("Some search text"))
.addSpotlight(0, text: "Search for the name of a location")
Spacer()
Button {
self.currentSpot = 0
} label: {
Image(systemName: "star")
}
.buttonStyle(.borderedProminent)
.font(.system(size: 30))
.addSpotlight(1, text: "Button in the middle of the view just to test the feature of this framework")
Spacer()
HStack {
Button {
} label: {
Image(systemName: "location.fill")
}
.buttonStyle(.borderedProminent)
.font(.system(size: 30))
.addSpotlight(2, text: "Tap this button to center the map")
Spacer()
Button {
} label: {
Image(systemName: "star.bubble")
}
.buttonStyle(.borderedProminent)
.font(.system(size: 30))
.addSpotlight(3, text: "Click here to view a list of featured locations")
}
}
.padding()
}
}
.applySpotlightOverlay(currentSpot: $currentSpot)
}
}
@available(iOS 15.0, *)
struct ViewHighlighterExample_Previews: PreviewProvider {
static var previews: some View {
ViewHighlighterExample()
}
}
#endif