In Objective-C land, Swift classes that subclass an ObjC class get an ObjC counterpart called Module.Class. SQLite thinks the module name is a database name, which won’t exist, so we have to take that out.
I’ve made a change that requires the module name to be passed to openDatabaseAtPath:…. I didn’t want to complicate things trying to guess the module name (and it feels hacky searching for and stripping up to a period), so I feel that’s the best way to do it. Everywhere the class name is used in an SQL statement, it’s been replaced with a call to +tableName, which returns the name with the module prefix stripped out. Eg: if a model class is TestApp.People – g_modulePrefix will be TestApp.. The table used will be People.
Model objects that provide their own init method can’t call +instanceWithPrimaryKey:…; the language seems to not support it. I added -initWithPrimaryKey:… methods for this situation.
There was also an #import <sqlite3.h> missing. Not sure if that was a mistake or not, but I added it back in so FCModelDatabase.m compiles.
Issue still unfixed: Swift enums don’t seem to work? Probably because they’re more like Swift objects and not just a primitive type. (Edit: You can just mark the enum as @objc to fix that.)
I learned of this project last night, I learned of CompactConstraint a few days ago, and I started using Overcast (again) last week. It’s been a Marco kind of month for me. :+1: for all you do.
In Objective-C land, Swift classes that subclass an ObjC class get an ObjC counterpart called
Module.Class
. SQLite thinks the module name is a database name, which won’t exist, so we have to take that out.I’ve made a change that requires the module name to be passed to
openDatabaseAtPath:…
. I didn’t want to complicate things trying to guess the module name (and it feels hacky searching for and stripping up to a period), so I feel that’s the best way to do it. Everywhere the class name is used in an SQL statement, it’s been replaced with a call to+tableName
, which returns the name with the module prefix stripped out. Eg: if a model class isTestApp.People
–g_modulePrefix
will beTestApp.
. The table used will bePeople
.+instanceWithPrimaryKey:…
; the language seems to not support it. I added-initWithPrimaryKey:…
methods for this situation.#import <sqlite3.h>
missing. Not sure if that was a mistake or not, but I added it back in so FCModelDatabase.m compiles.Issue still unfixed: Swift enums don’t seem to work? Probably because they’re more like Swift objects and not just a primitive type. (Edit: You can just mark the enum as
@objc
to fix that.)I learned of this project last night, I learned of CompactConstraint a few days ago, and I started using Overcast (again) last week. It’s been a Marco kind of month for me. :+1: for all you do.