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

Why Class can not decode by Himotoki? #178

Closed
hjw6160602 opened this issue May 25, 2017 · 2 comments
Closed

Why Class can not decode by Himotoki? #178

hjw6160602 opened this issue May 25, 2017 · 2 comments
Labels

Comments

@hjw6160602
Copy link

Why Class in Swift can not decode by Himotoki?
such as :
class Hello: Decodable {
var text: String?
}

static func decode(_ e: Extractor) throws -> UserModel {
return try UserModel (
text : e <| "text",
)
}

@dcaunt
Copy link

dcaunt commented May 25, 2017

Classes don't have memberwise initalizers by default. You have to implement an initializer for your class and then you can call it in decode.

@ikesyo
Copy link
Owner

ikesyo commented May 27, 2017

Thanks @dcaunt!

@ikesyo ikesyo closed this as completed May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants