迅速如何在 XCODE 中正确编写数据结构

问题描述

我要求提示如何正确编写结构和数据模型。我想要来自解码器的一段数据。可以这样做吗?

重要!我被标记为“???”不知道写什么的地方。

class Todayviewmodel : ObservableObject {
    @Published var today = ""
    @Published var tomorrow = ""
    
    func updateText() {
        HoroscopeDecoder.shared.run(sign: .aries) { prediction in
            dispatchQueue.main.async {
                self.today = prediction[0]
                self.tomorrow = prediction[1]
            }
        }
    }
}

struct Sign: Identifiable {
    
    var id = UUID()
    var title: String
    var image: String
    var today: **???**
    var tomorrow: **???**
}


let signsData: [Sign] = [
    Sign(title: "Овен",image: "aries",today: **???**,tomorrow: **???**)
]

在屏幕上,我更详细地描绘了我想要得到的东西。 enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)