diff --git a/Sources/azkaban/main.swift b/Sources/azkaban/main.swift index 2514884..d66f119 100644 --- a/Sources/azkaban/main.swift +++ b/Sources/azkaban/main.swift @@ -2,10 +2,11 @@ import Commander // from: http://stackoverflow.com/a/28341290 func iterateEnum(_: T.Type) -> AnyGenerator { - var i = 0 + var i = -1 return AnyGenerator { + i += 1 let next = withUnsafePointer(&i) { UnsafePointer($0).memory } - return next.hashValue == i++ ? next : nil + return next.hashValue == i ? next : nil } }