Skip to content

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

Description

@paulober

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"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions