Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dimpiax/genericsequencetype

A minimal generator types of collection enumeration
https://github.com/dimpiax/genericsequencetype

Last synced: 3 days ago
JSON representation

A minimal generator types of collection enumeration

Awesome Lists containing this project

README

        

# GenericSequenceType
A minimal generator types of collection enumeration

##### Generator types
* Iterator
* Random
* Odd

##### Usage
```swift
var boxCollection = Collection>()
boxCollection.addItems(Box(name: "Maps", age: 12), Box(name: "VHS", age: 1), Box(name: "Puzzles", age: 7), Box(name: "Books", age: 4))

for value in boxCollection {
println("do stuff with \(value)")
}
```

##### Examples
```swift
// IteratorGenerator
boxCollection.addItems(Box(name: "Maps", age: 12), Box(name: "Puzzles", age: 7), Box(name: "Books", age: 4))
for value in boxCollection { println(value) }
// Box(name=Maps, age=12), Box(name=Puzzles, age=7), Box(name=Books, age=4)

// OddGenerator
boxCollection.addItems(Box(name: "Maps", age: 12), Box(name: "Puzzles", age: 7), Box(name: "Books", age: 4), Box(name: "Photos", age: 72))
for value in boxCollection { println(value) }
// Box(name=Puzzles, age=7), Box(name=Photos, age=72)
```