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

Compatible with SwiftyJSON #356

Open
zhangferry opened this issue Jun 17, 2022 · 0 comments
Open

Compatible with SwiftyJSON #356

zhangferry opened this issue Jun 17, 2022 · 0 comments

Comments

@zhangferry
Copy link

Ran into a SwiftyJSON compatibility issue that only occurs when a ':' appears in the parsed string. Here's the code:

struct Model: Codable {
    let name: String
    let repo: JSON?
}

let model = Model(name: "Yams", repo: "git:Yams")
        
let encoder = YAMLEncoder()
let encodeStr = try! encoder.encode(model)
        
let newModel = try! decoder.decode(RuleRepo.self, from: encodeStr)
print(newModel.repo) // output: Optional(0)

the key is the : of git:Yams.

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