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

Calling the toJSONString method with UIColor.clear will result in an error #486

Open
jijiucheng opened this issue Jun 28, 2023 · 0 comments

Comments

@jijiucheng
Copy link

Question

Calling toJSONString after creating an object with the UIColor.clear property reports an error and fails to serialize successfully.

Code

class SandBoxModel: HandyJSON {
    var mode: Int = 0
    var color: UIColor = .clear
    
    func mapping(mapper: HelpingMapper) {
        mapper <<<
            color <-- HexColorTransform()
    }
    
    public required init() {}
}

var model = SandBoxModel()
model.color = .clear
if let jsonString = model.toJSONString {
    print(jsonString)
}

Error

Swift/ContiguousArrayBuffer.swift:580: Fatal error: Index out of range

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