首页 > 解决方案 > 在 didset 属性观察者 ios swift 中管理可编码

问题描述

我想使用 didset 属性来管理自定义可编码数组以设置不同的数据类型。这里 ReportSortModal 是

struct ReportSortModal<T:Decodable> {
    var title : String?
    var data : T?
}

Fieldreport&DustbinInspection是两种不同的可编码结构。

错误和代码如下:

在此处输入图像描述

标签: iosswiftstructcodabledecodable

解决方案


推荐阅读