CoreOffice / XMLCoder

Easy XML parsing using Codable protocols in Swift
https://coreoffice.github.io/XMLCoder/
MIT License
801 stars 112 forks source link

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

Open paulober opened 4 months ago

paulober commented 4 months ago

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