ios - 单个 cartfile 为多个目标指定和安装依赖项

标签 ios swift carthage

有没有一种方法可以编写一个单独的 cartfile 来安装多个目标所需的依赖项。这可以在我们使用 Cocoapods 时实现,如下所示:

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

def rx_swift
    pod 'RxSwift', '~> 4.0'
end

def rx_cocoa
    pod 'RxCocoa', '~> 4.0'
end

def test_pods
    pod 'RxTest'
    pod 'RxBlocking'
    pod 'Nimble'
end


target 'CleanArchitectureRxSwift' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_cocoa
  rx_swift
  pod 'QueryKit'
  target 'CleanArchitectureRxSwiftTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'CoreDataPlatform' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift
  pod 'QueryKit'
  target 'CoreDataPlatformTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'Domain' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift

  target 'DomainTests' do
    inherit! :search_paths
    test_pods
  end

end

target 'NetworkPlatform' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    rx_swift
    pod 'Alamofire'
    pod 'RxAlamofire'

    target 'NetworkPlatformTests' do
        inherit! :search_paths
        test_pods
    end

end

target 'RealmPlatform' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  rx_swift
  pod 'RxRealm', '~> 0.7.1'
  pod 'QueryKit'
  pod 'RealmSwift', '~> 3.10'
  pod 'Realm', '~> 3.10'

  target 'RealmPlatformTests' do
    inherit! :search_paths
    test_pods
  end

end

请让我知道我们是否可以在使用 Carthage 时实现类似的事情?即通过在单个 cartfile 中编写所有目标所需的所有依赖项,然后使用 carthage 安装它们?

我为什么要这样做,我觉得当我们继续向应用程序中使用的不同目标(框架)添加依赖项时,如果我们将所有依赖项都列在一个 cartfile 中,那么维护起来会很容易。 提前致谢。

最佳答案

在迦太基不可能这样做,而且will probably never be supported .

您可以在单个 Cartfile 中列出所有依赖项,但您仍然必须手动选择它们并将它们添加到目标的链接框架和库

关于ios - 单个 cartfile 为多个目标指定和安装依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55760911/

相关文章:

json - 如何在 Swift 中解析具有类型相关子对象的 JSON 对象?

ios - 如何访问 objective-c 文件中的 swift 类

ios - 将 Facebook 登录集成到 Swift 框架中

ios - Alamofire 当数据响应 Swift 4 定时器

ios - iOS 应用程序可以处理的最大数据量是多少?

objective-c - 如何为 Swift 安装 Objective C GZIP 库

ios - 删除 Carthage build设置维护的框架

ios - 使用自定义标志构建 Carthage 依赖项

ios - PushKit:我们可以在不使用 VoiP 的情况下在聊天应用程序中使用推送工具包(VoiP 推送)吗

iphone - 注册多个远程通知类型时出错