Skip to content

Instantly share code, notes, and snippets.

@ChristianKienle
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save ChristianKienle/22bfa174c390e551d810 to your computer and use it in GitHub Desktop.

Select an option

Save ChristianKienle/22bfa174c390e551d810 to your computer and use it in GitHub Desktop.

Revisions

  1. Christian Kienle revised this gist Dec 30, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    import Foundation

    class QueryResult {} // if I make this class public then the compiler says that generate has to be declared public. If I make generate public I get a different error... But QueryResult is a class which has to be public... it is part of my public API...
    class QueryResult {} // if I make this class public then the compiler says that generate has to be declared public.
    // If I make generate public I get a different error...
    // But QueryResult is a class which has to be public... it is part of my public API...
    public class Row {}

    class QueryResultGenerator : GeneratorType {
  2. Christian Kienle created this gist Dec 30, 2014.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    import Foundation

    class QueryResult {} // if I make this class public then the compiler says that generate has to be declared public. If I make generate public I get a different error... But QueryResult is a class which has to be public... it is part of my public API...
    public class Row {}

    class QueryResultGenerator : GeneratorType {
    typealias Element = Row
    func next() -> Element? {
    return nil
    }
    }

    extension QueryResult : SequenceType {
    typealias GeneratorType = QueryResultGenerator

    func generate() -> GeneratorType {
    return QueryResultGenerator()
    }

    }