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

Property wrappers error #259

Open
Vinestro89 opened this issue Feb 27, 2023 · 1 comment
Open

Property wrappers error #259

Vinestro89 opened this issue Feb 27, 2023 · 1 comment

Comments

@Vinestro89
Copy link

Vinestro89 commented Feb 27, 2023

Hi !

Following the example given in the documentation:

struct Book: Codable {
    @Element var id: Int
}

I tried to create an instance of a Book:

let book = Book(id: 42)

But I get the following error:

Cannot convert value of type 'Int' to expected argument type 'Element<Int>'

To make it work I have to do:

let book = Book(id: Element(42))

Is there something I'm doing wrong ? Thank you 😊

@Joannis
Copy link
Member

Joannis commented Feb 27, 2023

No, his is correct as it stands. But I'll keep the issue open as I think we can fix it in the signature.

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

No branches or pull requests

2 participants