Last active
February 9, 2025 14:03
-
-
Save jordansinger/f4ae5283425258ff1faa86c0386a02ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import MapKit // be sure to import MapKit | |
import PlaygroundSupport | |
struct ContentView: View { | |
var body: some View { | |
ZStack { | |
MapView() | |
VStack { | |
HStack { | |
Spacer() | |
Controls() | |
} | |
Spacer() | |
Sheet() | |
} | |
} | |
.cornerRadius(24) | |
} | |
} | |
struct Sheet: View { | |
@State var search = "" | |
var body: some View { | |
VStack { | |
RoundedRectangle(cornerRadius: 5) | |
.frame(width: 32, height: 5) | |
.foregroundColor(Color(UIColor.tertiaryLabel)) | |
HStack { | |
Image(systemName: "magnifyingglass") | |
TextField("Search for a place or address", text: $search) | |
.foregroundColor(.primary) | |
Image(systemName: "mic.fill") | |
} | |
.foregroundColor(Color(UIColor.tertiaryLabel)) | |
.padding(12) | |
.background(Color(UIColor.tertiarySystemGroupedBackground)) | |
.cornerRadius(12) | |
} | |
.padding(24) | |
.padding(.top, -16) | |
.background(Color(UIColor.secondarySystemGroupedBackground)) | |
.cornerRadius(12) | |
} | |
} | |
struct Controls: View { | |
var body: some View { | |
VStack(spacing: 6) { | |
VStack(spacing: 12) { | |
Image(systemName: "info.circle") | |
Divider() | |
Image(systemName: "location.fill") | |
} | |
.frame(width: 40) | |
.padding(.vertical, 12) | |
.background(Color(UIColor.secondarySystemGroupedBackground)) | |
.cornerRadius(8) | |
Image(systemName: "binoculars.fill") | |
.frame(width: 40) | |
.padding(.vertical, 12) | |
.background(Color(UIColor.secondarySystemGroupedBackground)) | |
.cornerRadius(8) | |
} | |
.font(.system(size: 20)) | |
.foregroundColor(.blue) | |
.padding() | |
.shadow(color: Color(UIColor.black.withAlphaComponent(0.1)), radius: 4) | |
} | |
} | |
struct MapView: UIViewRepresentable { | |
func makeUIView(context: Context) -> MKMapView { | |
return MKMapView(frame: .zero) | |
} | |
func updateUIView(_ view: MKMapView, context: Context) { | |
// do nothing | |
} | |
} | |
PlaygroundPage.current.setLiveView(ContentView()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment