Welcome to the Transit documentation! This page will guide you through the usage and features of the Transit framework.


To start using Transit, follow the steps below:

  1. Open your terminal.
  2. Navigate to your project directory.
  3. Run the following command:

$ pod init

This will create a Podfile in your project directory.

  1. Open the Podfile and add the following line:

pod 'Transit'

  1. Save the Podfile and run:

$ pod install

This will install the Transit framework and generate a .xcworkspace file for your project.


To start using Transit in your project, follow these steps:

  1. Open the .xcworkspace file generated after installing Transit.
  2. In your Xcode project, navigate to the file where you want to use Transit.
  3. Add the following import statement to the top of the file:

import Transit

You can now use Transit’s functionality in your project.


Feature 1: JSON Encoding

Transit provides convenient JSON encoding of your Swift objects.

To encode an object, use the following method:

json = try Transit.jsonEncoder.encode(yourObject)

Feature 2: JSON Decoding

Transit also supports JSON decoding of your Swift objects.

To decode a JSON string into an object, use the following method:

yourObject = try Transit.jsonDecoder.decode(YourObject.self, from: jsonString)

Feature 3: Custom Encoding

Transit allows you to define custom encoders for your objects.

To create a custom encoder, implement the Transit.Encoder protocol.

For example:

    struct CustomEncoder: Transit.Encoder {
        func encode(_ value: T) throws -> JSON {
            // Custom encoding logic
            // ...


Congratulations! You have now learned the basics of using the Transit framework. Explore the features and capabilities of Transit to enhance your Swift project.