组件化过程中问题

2020-09-18  本文已影响0人  Sword_xxx_ooo

1.组件子模块对公共子模块有依赖 

s.subspec 'AlertVC' do |alert|

alert.source_files = 'ZJFunc/Classes/AlertVC/**/*'.    #子模块源

alert.dependency 'TYAlertController', '1.2.0'   #子模块对第三方库依赖

alert.dependency 'ZJFunc/Public'                               

end

2.组件中获取Bundle及图片(组件为.framework)

+ (UIImage*)imageNamed:(NSString*)imageName targetClass:(Class)targetClass {

    NSBundle*bundle = [NSBundle bundleForClass:targetClass];

    if(bundle && imageName && ![imageName isEqualToString:@""]) {

        NSInteger scale = [[UIScreen mainScreen] scale];

        NSString *bundleName = bundle.infoDictionary[@"CFBundleName"];

        NSString *directory = [bundleName  stringByAppendingPathExtension:@"bundle"];

        NSString*fullName = [NSString stringWithFormat:@"%@@%zdx", imageName, scale];

        NSString *imagePath = [bundle pathForResource:fullName ofType:@"png" inDirectory:directory];

        return [UIImage imageWithContentsOfFile:imagePath];

    }

    return nil;

}

3.framework与.a如何集成到pod库中? 

参考: https://blog.csdn.net/w_shuiping/article/details/80606277

4.业务组件采用target-action通信时,业务组件提供接口,Mediator分类如何放置?

5.spec参考: https://guides.cocoapods.org/syntax/podspec.html

6.plist资源问题: s.resources = "XMGFMMine/Assets/*.plist"

7.组件依赖其它组件的协议时,未导入仅引用协议文件,导致pod lib lint不通过

上一篇 下一篇

猜你喜欢

热点阅读