iOS webp使用及Pod hook

Podfile 部分内容:

$:.unshift __dir__
require 'Podfile_Hook.rb'
#公有库
source 'https://github.com/CocoaPods/Specs.git'
def githubRepo
    pod 'SDWebImage', '4.4.2'
    pod 'SDWebImage/WebP'
    Pod::UI.puts '公有库集成'
end

Podfile_Hook.rb文件内容:

#hook installer
class Pod::Installer

    def create_pod_installer_hbc(pod_name)
      
      if ((pod_name <=> 'libwebp') == 0)
          libwebp_pod_target = nil
          pod_targets.each do |pod_target|
            if ((pod_target.root_spec.name <=> 'libwebp') == 0)
                libwebp_pod_target = pod_target
                customSource = { :git => 'https://github.com/webmproject/libwebp.git', :tag => 'v0.6.1' }
                libwebp_pod_target.root_spec.source = customSource
            end
          end
      end
      create_pod_installer_Orig(pod_name)
    end

    alias_method :create_pod_installer_Orig, :create_pod_installer
    alias_method :create_pod_installer, :create_pod_installer_hbc

end
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容