Edit Package.swift
to add the lib as a dependency:
dependencies: [
.package(url: "https://github.com/Kjuly/ColorCalculation.git", .upToNextMajor(from: "1.0"))
]
For a detailed guide, read Apple's developer doc Creating a standalone Swift package with Xcode and Swift's Swift Package Manager.
To add a package dependency to your Xcode project, select File > Add Package Dependency and enter the URL: https://github.com/Kjuly/ColorCalculation.git
.
For a detailed guide, read Apple's developer doc: Adding package dependencies to your app.
- Edit
Podfile
to add the dependency:
# Integrating CocoaPods with an existing workspace requires one extra line in your Podfile.
# Remove it if not.
workspace 'YourWorkspace'
# Provide the platform info, iOS 16.0+ as an example here.
platform :ios, '16.0'
# Add package to your project target
target 'YourProjectTarget' do
project 'Path/To/Your/YourProjectTarget.xcodeproj'
pod 'ColorCalculation', '~> 1.0'
end
- Close your Xcode project and run commands below:
$ pod install
For a detailed guide, read CocoaPods's doc: Using CocoaPods.
Tip
- Use
pod install
to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods. - Use
pod update <PODNAME>
only when you want to update pods to a newer version.
You can find a detailed explanation here.
- Edit
Cartfile
to add the dependency:
github "Kjuly/ColorCalculation" ~> 1.0
- Run the command in terminal:
$ carthage update --use-xcframeworks
- Drag the built
ColorCalculation.xcframework
fromCarthage/Build
to the "Frameworks, Libraries, and Embedded Content" section of your Xcode project.
Tip
If you are using Carthage for an application, select "Embed & Sign", otherwise "Do Not Embed".
For a detailed guide, read Carthage's Quick Start.
Important
Carthage builds your dependencies and provides you with a binary framework, which defaults to a Release configuration. So if you want to print debug logs on the console, you need to run the command below. Xcode will update *.xcframework automatically if you've added them already.
$ carthage update --use-xcframeworks --configuration Debug
Once you're done debugging, just don't forget to switch it back to production:
$ carthage update --use-xcframeworks
If you don't want to use any of the above package managers, you can add packages to your project manually.
- Run the commands in terminal:
$ cd path/to/your/root/project/directory
$ git submodule add https://github.com/Kjuly/ColorCalculation.git Libs/ColorCalculation
- Open your project and add a reference to the source code folder: "ColorCalculation/ColorCalculation".
For a detailed guide about git submodule usage, read git's doc: git-submodule.