Skip to content

Instantly share code, notes, and snippets.

@eldesperado
Created November 9, 2015 03:52
Show Gist options
  • Save eldesperado/73a350451cbf60e2243b to your computer and use it in GitHub Desktop.
Save eldesperado/73a350451cbf60e2243b to your computer and use it in GitHub Desktop.
Conformity to CollectionType simply requires implementing the methods of Indexable.
extension <# extendedType #> : CollectionType {
var startIndex: <# indexType : ForwardIndexType #> { return <# startIndex #> }
var endIndex: <# indexType : ForwardIndexType #> { return <# endIndex #> }
subscript (index: <# indexType : ForwardIndexType #>) -> <# elementType #> {
return <# subscript value #>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment