美文网首页iOS--三方技术
iOS webp使用及Pod hook

iOS webp使用及Pod hook

作者: xuvw | 来源:发表于2018-09-25 20:16 被阅读4次

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

相关文章

网友评论

    本文标题:iOS webp使用及Pod hook

    本文链接:https://www.haomeiwen.com/subject/ulxroftx.html