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) rethrowsParameters
shouldBeRemovedA 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
CongestionSegmentcollection aCongestionLevelsubstitution will take place that has a streets road class contained in theroadClassesWithOverriddenCongestionLevelscollection. For each of these items theCongestionLevelfor.unknowntraffic congestion will be replaced with the.lowtraffic congestion.Declaration
Swift
func combined(_ congestionLevels: [CongestionLevel], streetsRoadClasses: [MapboxStreetsRoadClass?]? = nil, roadClassesWithOverriddenCongestionLevels: Set<MapboxStreetsRoadClass>? = nil) -> [CongestionSegment]Parameters
congestionLevelsThe congestion levels along a leg. There should be one fewer congestion levels than coordinates.
streetsRoadClassesA collection of streets road classes for each geometry index in
Intersection. There should be the same amount ofstreetsRoadClassesandcongestions.roadClassesWithOverriddenCongestionLevelsStreets road classes for which a
CongestionLevelsubstitution should occur.Return Value
A list of
CongestionSegmenttuples with coordinate and congestion level.
Install in Dash
Array Extension Reference