← Back to raywenderlich/swift-style-guide

How to Deploy & Use raywenderlich/swift-style-guide

Swift Style Guide - Deployment and Usage Guide

Prerequisites

  • Swift Development Tools: Xcode 13.0 or later, or Swift 5.5+
  • Git: For cloning the repository
  • macOS: Required for Swift development and running the style guide tools

Installation

  1. Clone the repository:

    git clone https://github.com/kodecocodes/swift-style-guide.git
    cd swift-style-guide
    
  2. Install SwiftLint (required for style checking):

    brew install swiftlint
    
  3. Verify installation:

    swiftlint version
    

Configuration

The style guide uses the following configuration files:

  • .swiftlint.yml: SwiftLint configuration file
  • .editorconfig: Editor configuration for consistent formatting

Environment Variables: None required for local development.

API Keys: Not applicable for this style guide project.

Build & Run

Development

  1. Check SwiftLint configuration:

    swiftlint lint --path Sources/
    
  2. Run style checks on example files:

    swiftlint lint --path Examples/
    

Production

The style guide is primarily documentation and configuration. To use it in your projects:

  1. Copy the .swiftlint.yml file to your project root
  2. Integrate SwiftLint into your Xcode build phases or CI/CD pipeline

Deployment

This project is a style guide and configuration files, not a deployable application. To share or use:

  • GitHub Repository: The primary distribution method
  • Swift Package Manager: Reference the repository as a dependency if needed
  • Git Submodules: Add as a submodule to your project

Troubleshooting

Common Issues

SwiftLint not found

brew install swiftlint

SwiftLint configuration errors

  • Ensure .swiftlint.yml is in your project root
  • Check YAML syntax in the configuration file

Xcode integration issues

  • Add SwiftLint to your Xcode build phases
  • Ensure the SwiftLint binary path is correct in your build settings

Getting Help