Skip to content

Installation

Swift

Download and install Swift 5.3 or higher.

Swift Package Manager

New Package

This creates a new executable package named MyPackage.

mkdir MyPackage
cd MyPackage
swift package init --type executable

Package Manifest

Add the Validation package as a dependency by specifying its name, url, and version.

dependencies: [
    .package(name: "chaqmoq-validation", url: "https://github.com/chaqmoq/validation.git", from: "1.0.0")
]

Add the Validation target to your desired target as a dependency by specifying its name and package where you want to import and use it. In this case, we are adding it to the default target named MyPackage generated using the swift package init command we executed earlier.

targets: [
    .target(name: "MyPackage", dependencies: [
        .product(name: "Validation", package: "chaqmoq-validation")
    ])
]

Build

This builds the MyPackage and installs the Validation package with the Debug configuration needed for development.

swift build

Once you are ready to deploy, you can run the command below that builds the MyPackage and installs the Validation package with the Release configuration optimized for production.

swift build -c release

Xcode Project

  1. Open your Xcode project.
  2. Go to File -> Swift Packages -> Add Package Dependency.
  3. Enter the Validation package URL: https://github.com/chaqmoq/validation.git.
  4. Choose the version you want to install. We suggest installing the latest stable version by using the Up to Next Major strategy.
  5. Add the Validation package to your desired target of the MyPackage where you want to import and use it.