The demo iOS application from GRDB on github runs great on the phone simulator of my iMac, but it's not clear how to get GRDB building in an iOS application of my own (part 1 of this question), with the minimal set of components (part 2 of this question).1
The GRDB installation instructions suggests offers as one option: "Swift Package Manager". Since I'm new to this programming environment, this sounded like "the right way", but after trying it, I was still left guessing at how to get my project building successfully.
Steps done so far:
- Created a new project
Applications > Xcode (9.4 beta) > Create a new Xcode project > Single View App > "FirstDb"
- Put
import GRDB
in the view controller (obviously couldn't compile yet) - Applications > Utilities > Terminal
cd /Users/owner/documents/xcodeprojects/firstdb
mkdir GRDB
cd GRDB
swift package init --type library
- Edit
Package.swift
, adding.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.10.0")
at the appropriate location - Applications > Utilities > Terminal
swift package resolve
(resulting in 'Fetching', 'Cloning', 'Resolving')
Status
After Product > Build
, the import GRDB
line still says no such module
.
So part 1 of the question is still unresolved. I have not been able to address part 2 of the question yet. Sorry if either or both of these are brutally obvious to the well heeled Xcode developer, but after researching the problem, I found no specific guidance.
Using SPM is not a requirement, so if the other options to integrate GRDB are a better choice, I'd like to see how to integrate using one of those.
Footnote
- I would like to understand the steps required to add only the portions of GRDB that are required to use the
Record
object and to be able to execute SQL statements for an iOS project. The presumption is that much of the complete package (tests, watch, etc, is not required in the project using the GRDB basics, resulting in a more compact iOS application.