Help setting up #1090
-
Hey guys, I'm trying to set up GRDB for my app. I've installed the pod but there is something I am doing wrong when trying to create my database connection. I have tried writing these lines in my App.swift file:
But an error occurs and it says: Call can throw, but errors cannot be thrown out of a global variable initializer What am I doing wrong ? Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Creating the Database file can fail but you are not defining what should happen if it does. I'd recommend reading the Error Handling section of the Swift language manual. If you want to just get something to compile then you can use Also, |
Beta Was this translation helpful? Give feedback.
Creating the Database file can fail but you are not defining what should happen if it does. I'd recommend reading the Error Handling section of the Swift language manual.
If you want to just get something to compile then you can use
try!
Also,
"/Desktop/App"
is almost certainly not going to create the file you expect. Take a look at one of the examples.