Array
extension Array
extension Array where Element: NSAttributedString
extension Array where Iterator.Element == CLLocationCoordinate2D
-
Seealso
Array.filter(_:)Declaration
Swift
public func filterKeepingFirstAndLast(_ isIncluded: (Element) throws -> Bool) rethrows -> [Element]
-
Seealso
Array.split(maxSplits:omittingEmptySubsequences:whereSeparator:)Declaration
Swift
public func splitExceptAtStartAndEnd(maxSplits: Int = .max, omittingEmptySubsequences: Bool = true, whereSeparator isSeparator: (Element) throws -> Bool) rethrows -> [ArraySlice<Element>]
-
Conditionally remove each element depending on the elements immediately preceding and following it.
Declaration
Swift
mutating func removeSeparators(where shouldBeRemoved: (Element?, Element, Element?) throws -> Bool) rethrows
Parameters
shouldBeRemoved
A closure that is called once for each element in reverse order from last to first. The closure accepts the following arguments: the preceding element in the (unreversed) array, the element itself, and the following element in the (unreversed) array.
-
Returns a new attributed string by concatenating the elements of the array, adding the given separator between each element.
Declaration
Swift
func joined(separator: NSAttributedString = .init()) -> NSAttributedString
-
Returns an array of congestion segments by associating the given congestion levels with the coordinates of the respective line segments that they apply to.
This method coalesces consecutive line segments that have the same congestion level.
For each item in the
CongestionSegment
collection aCongestionLevel
substitution will take place that has a streets road class contained in theroadClassesWithOverriddenCongestionLevels
collection. For each of these items theCongestionLevel
for.unknown
traffic congestion will be replaced with the.low
traffic congestion.Declaration
Swift
func combined(_ congestionLevels: [CongestionLevel], streetsRoadClasses: [MapboxStreetsRoadClass?]? = nil, roadClassesWithOverriddenCongestionLevels: Set<MapboxStreetsRoadClass>? = nil) -> [CongestionSegment]
Parameters
congestionLevels
The congestion levels along a leg. There should be one fewer congestion levels than coordinates.
streetsRoadClasses
A collection of streets road classes for each geometry index in
Intersection
. There should be the same amount ofstreetsRoadClasses
andcongestions
.roadClassesWithOverriddenCongestionLevels
Streets road classes for which a
CongestionLevel
substitution should occur.Return Value
A list of
CongestionSegment
tuples with coordinate and congestion level.