-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
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,22 @@ | ||
// | ||
// MapSnapshotterEnvironmentKey.swift | ||
// OBAKit | ||
// | ||
// Created by Alan Chu on 2/22/23. | ||
// | ||
|
||
import SwiftUI | ||
import OBAKitCore | ||
|
||
private struct StopIconFactoryKey: EnvironmentKey { | ||
static public let defaultValue: StopIconFactory = { | ||
return StopIconFactory(iconSize: ThemeMetrics.defaultMapAnnotationSize, themeColors: ThemeColors.shared) | ||
}() | ||
} | ||
|
||
extension EnvironmentValues { | ||
var stopIconFactory: StopIconFactory { | ||
get { self[StopIconFactoryKey.self] } | ||
set { self[StopIconFactoryKey.self] = newValue } | ||
} | ||
} |
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,45 @@ | ||
// | ||
// StopArrivalHeaderView.swift | ||
// OBAKit | ||
// | ||
// Created by Alan Chu on 2/22/23. | ||
// | ||
|
||
import MapKit | ||
import SwiftUI | ||
|
||
struct StopArrivalHeaderView: View { | ||
@Environment(\.stopIconFactory) var stopIconFactory | ||
|
||
@State var region: MKCoordinateRegion | ||
@State var mapImage: UIImage? | ||
|
||
var body: some View { | ||
ZStack { | ||
Map(coordinateRegion: $region, interactionModes: []) | ||
Text("asdf") | ||
|
||
if let mapImage { | ||
Image(uiImage: mapImage) | ||
} | ||
} | ||
.task(priority: .high) { | ||
// stopIconFactory.buildIcon(for: <#T##Stop#>, isBookmarked: <#T##Bool#>, traits: <#T##UITraitCollection#>) | ||
// let snapshot = MapSnapshotter(size: , stopIconFactory: <#T##StopIconFactory#>) | ||
} | ||
} | ||
} | ||
|
||
struct StopArrivalHeaderView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
StopArrivalHeaderView( | ||
region: MapHelpers.coordinateRegionWith( | ||
center: CLLocationCoordinate2D(latitude: 47.62217, longitude: -122.32090), | ||
zoomLevel: 16, | ||
size: CGSize(width: 375, height: 250) | ||
) | ||
) | ||
.frame(width: 375, height: 250, alignment: .center) | ||
.previewLayout(.sizeThatFits) | ||
} | ||
} |