Created
June 30, 2020 04:09
-
-
Save twof/97b8c1be08b8f02c30e142ecd1a64437 to your computer and use it in GitHub Desktop.
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
extension Binding: Sequence where Value == Array<Track> { | |
public typealias Iterator = IndexingIterator<Array<Binding<Track>>> | |
public __consuming func makeIterator() -> IndexingIterator<Array<Binding<Track>>> { | |
return IndexingIterator(_elements: (0..<wrappedValue.count).map { projectedValue[$0] }) | |
} | |
} | |
extension Binding: Collection where Value == Array<Track> { | |
public typealias Element = Binding<Track> | |
public typealias Index = Value.Index | |
public var startIndex: Array<Track>.Index { | |
return wrappedValue.startIndex | |
} | |
public var endIndex: Array<Track>.Index { | |
return wrappedValue.endIndex | |
} | |
public func index(after i: Array<Track>.Index) -> Array<Track>.Index { | |
return wrappedValue.index(after: i) | |
} | |
public subscript(position: Array<Track>.Index) -> Binding<Track> { | |
return projectedValue[position] | |
} | |
} | |
extension Binding: BidirectionalCollection where Value == Array<Track> { | |
public func index(before i: Array<Track>.Index) -> Array<Track>.Index { | |
return wrappedValue.index(before: i) | |
} | |
} | |
extension Binding: RandomAccessCollection where Value == Array<Track> { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment