gpt4 book ai didi

Swift 相当于 [NSBundle bundleForClass :[self class]]

转载 作者:IT王子 更新时间:2023-10-29 04:56:00 25 4
gpt4 key购买 nike

下一个代码的 swift 等价物是什么:

[NSBundle bundleForClass:[self class]]

我需要从测试包中加载资源(JSON 数据)

最佳答案

没用过,不过我觉得应该是这样的:

swift <= 2.x

NSBundle(forClass: self.dynamicType)

swift 3.x

Bundle(for: type(of: self))

关于Swift 相当于 [NSBundle bundleForClass :[self class]],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25651403/

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