加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

CocoaPods 给每个库单独指定 Swift 版本教程 —— Jinkey 原创

发布时间:2020-12-14 05:58:36 所属栏目:百科 来源:网络整理
导读:苹果每年都更新 Swift 版本,但是平常项目中使用的一些开源库却不能及时更新,使用那就需要一部分库继续使用 Swift3.2 版本,一部分使用 Swift4,那么在 Podfile 中应该这么写: # Swift 版本声明 post_install do |installer| installer.pods_project.targe

苹果每年都更新 Swift 版本,但是平常项目中使用的一些开源库却不能及时更新,使用那就需要一部分库继续使用 Swift3.2 版本,一部分使用 Swift4,那么在 Podfile 中应该这么写:

# Swift 版本声明
  post_install do |installer|
        installer.pods_project.targets.each do |target|
            if ['库的名字1','Jinkey'].include? target.name
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = '4.0'
                    config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
                end
            else
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = '3.2'
                    config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
                end
            end
        end
    end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读