stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.64k stars 1.56k forks source link

Example doesn't work ... #988

Closed SieczkowskiAL closed 3 years ago

SieczkowskiAL commented 4 years ago

Hi,

Error in example ... how correct ?

Captura de Tela 2020-02-07 às 23 25 39
nathanfallet commented 4 years ago

Because your db object is defined in the do structure, you need to wrap everything in it (db is created in it so stays in it)

do {
    let db = try Connection("financeiro.db")

    // Move your code here
    let users = Table("users")
    // ...
} catch {
    print (error)
}