i'm using SQLite Library and in usage it says let db = try Connection("path/to/db.sqlite3") i have sqlite database located in documents. but when i try to make connection it throw an error call can throw but errors cannot be thrown out of a property initializer
here's my code :
import UIKit
import SQLite
class SearchViewController: UIViewController, UITextFieldDelegate {
let db = try Connection("/Users/macbookpro/Documents/db.sqlite") //error
let categoryVC = CategoryViewController()
let UseFullVC = UseFullViewController()
let MapVC = MapViewController()
let EventVC = SearchResultOnlineVC()
@IBOutlet weak var searchTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Search"
searchTextField.delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
i also try to put connection in viewDidLoad but still doesn't work
what's wrong?