Carthage - Dependency Manager - Step by Step Tutorial

1. Create Cartfile 


$ touch Cartfile

$ open -a Xcode Cartfile

2. List all needed frameworks in Cartfile like below 

github "mxcl/PromiseKit" "6.8.4"

github "onevcat/Kingfisher" "5.3.1"

github "ReactiveX/RxSwift" "4.5.0"


github "Swinject/Swinject" "2.6.0"

github "Swinject/SwinjectAutoregistration" "2.6.0"

github "Swinject/SwinjectStoryboard"

and run

carthage update --no-use-binaries

3. Go to Xcode project target, select General Settings, then in section Linked Frameworks & Libraries add this frameworks using + button (or just drag & drop them into this section pane). Fetched & build frameworks can be found in /Carthage/Build/iOS directory 

4. Add to Build Phases tab New Run Script Phase

Here you need to paste in


/usr/local/bin/carthage copy-framework

5. Create 2 files in the same directory as Cartfile named carthage_input.xcfilelist and carthage_output.xcfilelist 

content of input file should be: 

$(SRCROOT)/Carthage/Build/iOS/Kingfisher.framework

$(SRCROOT)/Carthage/Build/iOS/PromiseKit.framework

$(SRCROOT)/Carthage/Build/iOS/RxAtomic.framework

$(SRCROOT)/Carthage/Build/iOS/RxBlocking.framework

$(SRCROOT)/Carthage/Build/iOS/RxCocoa.framework

$(SRCROOT)/Carthage/Build/iOS/RxSwift.framework

$(SRCROOT)/Carthage/Build/iOS/RxTest.framework

$(SRCROOT)/Carthage/Build/iOS/Swinject.framework

$(SRCROOT)/Carthage/Build/iOS/SwinjectAutoregistration.framework

$(SRCROOT)/Carthage/Build/iOS/SwinjectStoryboard.framework

content of the output file should be: 

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Kingfisher.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/PromiseKit.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxAtomic.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxBlocking.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxCocoa.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxSwift.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RxTest.framework


$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Swinject.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwinjectAutoregistration.framework

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwinjectStoryboard.framework

5. Add this files in Build Phase Run Script as input/output files


Logowanie