Skip to content

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

@yanxiaobing

Description

@yanxiaobing
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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions