-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #510 from pennlabs/subletting-endpoints
Add Subletting! 😃
- Loading branch information
Showing
41 changed files
with
3,807 additions
and
231 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// AddressMapView.swift | ||
// PennMobile | ||
// | ||
// Created by Jordan H on 3/2/24. | ||
// Copyright © 2024 PennLabs. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import MapKit | ||
|
||
struct AddressMapView: View { | ||
var address: String? | ||
@State private var region: MKCoordinateRegion = PennCoordinate.shared.getDefaultRegion(at: .far) | ||
@State private var location: CLLocationCoordinate2D? | ||
|
||
var body: some View { | ||
Map(coordinateRegion: $region, annotationItems: location != nil ? [location!] : []) { location in | ||
MapMarker(coordinate: location) | ||
} | ||
.onAppear { | ||
if address != nil { | ||
let geocoder = CLGeocoder() | ||
let regionHint = CLCircularRegion(center: region.center, radius: 5000, identifier: "regionHint") | ||
geocoder.geocodeAddressString(address!, in: regionHint) { (placemarks, _) in | ||
if let placemark = placemarks?.first, let location = placemark.location { | ||
self.region.center = location.coordinate | ||
self.location = location.coordinate | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
AddressMapView(address: "101 S 39th St") | ||
} |
Oops, something went wrong.