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

Self used before all stored properties are initialised error when using PropertyWrapppers #284

Open
paulober opened this issue Jul 18, 2024 · 0 comments

Comments

@paulober
Copy link

When creating a struct with @Element and @Attribute and then try to create an init () {} you always get the error from the title even though all are initialised in the constructor before self is used.

Example:

import XMLCoder

public struct LocalizableText: Codable {
    @Attribute public var language: String
    @Element public var value: String?
    
    enum CodingKeys: String, CodingKey {
        case language = "Language"
        case value = ""
    }
    
    public init() {
        language = ""
        value = "de/de"
    }
}
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

1 participant