gpt4 book ai didi

ios - Argo - 解码方法中的箭头括号是什么意思?

转载 作者:行者123 更新时间:2023-11-28 09:36:19 25 4
gpt4 key购买 nike

我尝试掌握 Argo 进行 json 解码。在文档中有解码功能的例子

extension User: Decodable {
static func decode(j: JSON) -> Decoded<User> {
return curry(User.init)
<^> j <| "id"
<*> j <| "name"
}
}

什么是<^><*>意思是 ?它们有什么区别?

最佳答案

根据Github documentation ...

<^>map功能

<*>apply功能

这两个都在这里描述... https://robots.thoughtbot.com/functional-swift-for-dealing-with-optional-values

从 Github 页面链接。

注意阅读文档:)

关于ios - Argo - 解码方法中的箭头括号是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41589731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com