DatabaseFuture

public class DatabaseFuture<Value>

A future database value, returned by the DatabaseWriter.concurrentRead(_:) method.

let futureCount: Future<Int> = try writer.writeWithoutTransaction { db in
    try Player(...).insert()

    // Count players concurrently
    return writer.concurrentRead { db in
        return try Player.fetchCount()
    }
}

let count: Int = try futureCount.wait()
  • Blocks the current thread until the value is available, and returns it.

    It is a programmer error to call this method several times.

    Throws

    Any error that prevented the value from becoming available.

    Declaration

    Swift

    public func wait() throws -> Value