Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create table from Codable #879

Closed
kwstasna opened this issue Feb 4, 2019 · 3 comments
Closed

Create table from Codable #879

kwstasna opened this issue Feb 4, 2019 · 3 comments

Comments

@kwstasna
Copy link

kwstasna commented Feb 4, 2019

Is there any way to create a table from a model which conforms to codable?
For example

class User: Codable {
let pk: Int?
etc..
}

@anilsutariya
Copy link

Below Like that.
struct Person:Codable {

let personID:Int
let personName:String?
let type:String?


init(personID:Int:Int,personName:String,type:String) {
    
    self. personID = personID
    self. personName = personName
    self.type = type

}

enum CodingKeys:String,CodingKey {
    
    case personName
    case personID

}

}

@codingspark
Copy link

codingspark commented Apr 10, 2019

You have to create the table manually:
https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md#creating-a-table

Check previous issue #748

@nathanfallet
Copy link
Collaborator

Duplicate of #748

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants