Skip to content

Instantly share code, notes, and snippets.

@ukitaka
Last active February 26, 2017 01:40
Show Gist options
  • Select an option

  • Save ukitaka/e7b76ebbf541d3617f18f9d2e54c1c53 to your computer and use it in GitHub Desktop.

Select an option

Save ukitaka/e7b76ebbf541d3617f18f9d2e54c1c53 to your computer and use it in GitHub Desktop.
SequenceProxy
public protocol SequenceProxy: Sequence {
associatedtype Element
var elements: [Element] { get }
}
public extension SequenceProxy {
func makeIterator() -> IndexingIterator<Array<Element>> {
return elements.makeIterator()
}
}
struct MyCustomSequence: SequenceProxy {
let elements: [Int]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment