Is there a way to write a single cartfile which can be used to install the dependencies required for multiple targets. This can be achieved when we're using Cocoapods as shown below:
# 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
Please let me know whether can we achieve similar thing while using Carthage? i.e. by writing all the dependencies needed for all targets in a single cartfile and then installing them using carthage?
Why I want to do this is, I feel that as we go on adding dependencies to different targets(frameworks) used in the application, it'd be easy to maintain if we have all the dependencies listed in a single cartfile. Thanks in advance.
It's not possible to do this in Carthage, and will probably never be supported.
You could list all the dependencies in a single Cartfile, but you'll still have to manually select and add them to your target's linked frameworks and libraries
.