-
目录
ios swift 创建framework(一):https://www.jianshu.com/p/2acd1fbb7537
ios swift 创建framework(二)Dynamic Library资源图片image引用:https://www.jianshu.com/p/deeefdc7714f
ios swift 创建framework(三)Static Library 调用资源image:
https://www.jianshu.com/p/d56e341513b5
本篇文章介绍 静态库Static Library引用图片
1.项目里配置动态库 targets -> LZSDK -> Build Settings -> Mach-o type 为Static Library
2. 重要!!! 在主工程LZSDKDemo ,Targets -> LZSDKDemo -> Build Phases -> Copy Bundle Resources 添加对应的framework(LZSDK.framework)
3. framework 中调用 资源图片的代码
// 荔枝
public func staticSdk_image() -> UIImage? {
// class: 库里 任意class
let bundle = Bundle(for: LZSDKManager.self)
let path = bundle.path(forResource: "LZSDK", ofType: "framework")
if let path = path {
let sdkBundle = Bundle(path: path)
let image = UIImage(named: "hi", in: sdkBundle, compatibleWith: nil)
return image
}
return nil
}