iOS:使用HanekeSwift和SwiftyJSON

编程入门 行业动态 更新时间:2024-10-06 06:45:49
本文介绍了iOS:使用HanekeSwift和SwiftyJSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在当前的快速项目中使用Alamofire和SwiftyJSON。 我想添加HanekeSwift进行缓存。

I use Alamofire with SwiftyJSON in my current swift project. I would like to add HanekeSwift for caching.

将HanekeSwift添加到项目中使其与SwiftyJSON struct JSON冲突。

Adding HanekeSwift to the project make it "collide" with SwiftyJSON struct JSON.

有没有简单的方法使用这两个框架? 我知道有一个选项可以重命名其中一个JSON结构,但看起来像是一个愚蠢的解决方法。或者做一些名称空间的事情。

Is there any easy way to use both of these frameworks? I know there is a option to rename one of the JSON structs but seems like a stupid workaround. Or do some namespace thing.

错误信息:

'JSON' is ambiguous for type lookup in this context

对此有任何解决方案吗?

Any solutions to this?

推荐答案

因此,我发现的解决方案对我来说只是声明您尝试使用的完整类型的JSON对象。例如。 - 在期望或使用SwiftyJSON结构时声明SwiftyJSON.JSON而不仅仅是JSON,或者当你想使用Haneke的JSON枚举时声明Haneke.JSON。

So, the solution that I've found works for me is just to declare the full type of JSON object you are trying to use. E.g. - declare SwiftyJSON.JSON rather than just JSON when expecting or using a SwiftyJSON struct, or Haneke.JSON when you want to use Haneke's JSON enum.

例如,对于SwiftyJSON :

For example, for SwiftyJSON:

var json = SwiftyJSON.JSON(inputObject!)

或对于Haneke:

var json = Haneke.JSON(inputObject!)

更多推荐

iOS:使用HanekeSwift和SwiftyJSON

本文发布于:2023-11-26 21:45:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635314.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iOS   HanekeSwift   SwiftyJSON

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!