-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
6 changed files
with
113 additions
and
71 deletions.
There are no files selected for viewing
Empty file.
61 changes: 61 additions & 0 deletions
61
app/Common/Components/MapAnnotation/AnnotationStack/MetroAnnotationStack.swift
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,61 @@ | ||
|
||
|
||
import SwiftUI | ||
import MapKit | ||
|
||
|
||
struct MetroAnnotationStack: View { | ||
let metroLines: [String] | ||
|
||
var body: some View { | ||
ZStack { | ||
ForEach(Array(metroLines.enumerated()), id: \.0) { | ||
index, metroLine in | ||
let offset: CGFloat = index == 0 ? 0 : (-16 * CGFloat(index)) | ||
|
||
MetroStationAnnotation(metroLine: metroLine) | ||
.offset(x: offset, y: offset) | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview("One station annotation") { | ||
Map { | ||
Annotation( | ||
"Random place on map", coordinate: CLLocationCoordinate2D( | ||
latitude: 50.113680, longitude: 14.449520) | ||
) { | ||
MetroAnnotationStack( | ||
metroLines: ["A"] | ||
) | ||
} | ||
} | ||
} | ||
|
||
#Preview("Two stations annotation") { | ||
Map { | ||
Annotation( | ||
"Random place on map", coordinate: CLLocationCoordinate2D( | ||
latitude: 50.113680, longitude: 14.449520) | ||
) { | ||
MetroAnnotationStack( | ||
metroLines: ["A", "B"] | ||
) | ||
} | ||
} | ||
} | ||
|
||
// this is not very valid for Prague, but might be useful in the future | ||
#Preview("Multiple stations annotation") { | ||
Map { | ||
Annotation( | ||
"Random place on map", coordinate: CLLocationCoordinate2D( | ||
latitude: 50.113680, longitude: 14.449520) | ||
) { | ||
MetroAnnotationStack( | ||
metroLines: ["A", "B", "C", "A", "B", "C"] | ||
) | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/Common/Components/MapAnnotation/BusAnnotation/BusAnnotation.swift
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,33 @@ | ||
|
||
import SwiftUI | ||
import MapKit | ||
|
||
struct BusStationAnnotation: View { | ||
var body: some View { | ||
Image( | ||
systemName:"bus" | ||
) | ||
.imageScale(.medium) | ||
.padding(5) | ||
.foregroundStyle(.white) | ||
.background(.blue) | ||
.clipShape(.rect(cornerRadius: 6)) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 6) | ||
.stroke(.white, lineWidth: 2) | ||
) | ||
} | ||
} | ||
|
||
#Preview("Bus station annotation") { | ||
Map { | ||
Annotation( | ||
"Random place on map", coordinate: CLLocationCoordinate2D( | ||
latitude: 50.113680, longitude: 14.449520) | ||
) { | ||
BusStationAnnotation( | ||
|
||
) | ||
} | ||
} | ||
} |
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