Skip to content

Instantly share code, notes, and snippets.

View jacobsapps's full-sized avatar

Jacob Bartlett jacobsapps

View GitHub Profile
Map() {}
.mapStyle(.standard)
Map(position: .camera(defaultMapCamera)) {}
.mapStyle(.hybrid(elevation: .realistic))
let defaultMapCamera = MapCamera(
centerCoordinate: Constants.london,
distance: 800,
heading: .zero,
pitch: 30
)
[
{
"pubName": "The Shakespeare",
"description": "The Shakespeare is a large, historic pub...",
"station": "Victoria",
"coordinate": {
"longitude": -0.144825,
"latitude": 51.4962508
},
"address": "99 Buckingham Palace Rd, London SW1W 0RP",
KeyframeTrack(\.pitch) {
LinearKeyframe(45, duration: 2.5)
LinearKeyframe(0, duration: 2.5)
}
KeyframeTrack(\.distance) {
CubicKeyframe(600, duration: 2)
LinearKeyframe(600, duration: 3)
SpringKeyframe(4_000, duration: 1)
}
KeyframeTrack(\.centerCoordinate) {
CubicKeyframe(selectedPub?.coordinate,
duration: 6)
}
.mapCameraKeyframeAnimator(trigger: selectedPub,
keyframes: { camera in
KeyframeTrack(\.centerCoordinate) { }
KeyframeTrack(\.distance) { }
KeyframeTrack(\.pitch) { }
})
@State private var selectedPub: Pub?
// ...
.mapCameraKeyframeAnimator(trigger: selectedPub,
keyframes: { camera in
})
// ...
.overlay(alignment: .bottomTrailing) {
lookAroundPreview
}
@ViewBuilder
private var lookAroundPreview: some View {
LookAroundPreview(scene: $scene,
allowsNavigation: true,
badgePosition: .bottomTrailing)