如何快速发布嵌套数据?

问题描述

用户结构:

struct User: Codable,Identifiable {
    let id = UUID()
    let userId: Int?
    let userName: String?
    let userDocument: [UserDocument]?
}

UserDocument结构:

struct UserDocument: Codable,Identifiable {
    let id = UUID()
    let userDocumentId: Int?
    let userId: Int?
    let documentId: Int?
    let document: Document?
}

文档结构:

struct Document: Codable {
    let documentId: Int
    let ownerId: Int?
    let secureName: String?
    let title: String?
    let description: String?
    let fileExtension: String?
    let fileSize: Int64?
    let url: String?
}

这是请求正文(我被卡在这里):

let body: [String: Any?] = ["userId": 0,"userName": "name","userDcuments": ?....]

解决方法

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

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

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