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

How to support [key:value] type with value:Codable,DefaultsSerializable #293

Open
yanxiaobing opened this issue Jun 14, 2022 · 0 comments
Open

Comments

@yanxiaobing
Copy link

yanxiaobing commented Jun 14, 2022

struct TestM: Codable,DefaultsSerializable{
    var name: String?
    var age: Int? = 0
}

extension DefaultsKeys{
    var tests: DefaultsKey<[String:[TestM]]>{.init("tests", defaultValue: [String:[TestM]]())}
}

let testM = TestM.init(name: "test", age: 18)
Defaults[\.tests]["tests"] = [testM]
@yanxiaobing yanxiaobing changed the title How to support [key:value] types with value:Codable,DefaultsSerializable How to support [key:value] type with value:Codable,DefaultsSerializable Jun 14, 2022
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