scjson

scjson logo

scjson Swift Package

This directory contains the Swift implementation of scjson. The package exposes a reusable library (SCJSONKit) and a command line tool that can convert between .scxml and .scjson and perform validation using the shared schema.

Installation

swift build -c release

After building, the scjson executable will be available in .build/release.

Library Usage

Add SCJSONKit as a dependency in your Package.swift and import the models:

import SCJSONKit

let doc = ScjsonDocument.makeDefault()
let encoded = try doc.encode()
let decoded = try ScjsonDocument.decode(from: encoded)

Swift Package Manager

// Package.swift
dependencies: [
    .package(url: "https://github.com/softoboros/scjson-swift.git", from: "0.1.0")
]

// Target declaration
.target(
    name: "YourFeature",
    dependencies: [
        .product(name: "SCJSONKit", package: "scjson-swift")
    ]
)

Documentation

You can browse the DocC catalog in Xcode (Product ▶ Build Documentation) or generate static docs via:

swift package generate-documentation --product SCJSONKit

Documented API Surface

Every public symbol ships with DocC-friendly documentation comments so Xcode can display quick help and build full documentation. Highlights include:

Generated sources live in Sources/SCJSONKit/ScjsonTypes.swift; edit the templates in py/scjson/templates/ if you need to tweak the emitted docs or types.

Command Line Usage

scjson json path/to/machine.scxml
scjson xml path/to/machine.scjson
scjson validate path/to/dir -r

Repository Guide

All source code in this directory is released under the BSD 1-Clause license. See LICENSE and LEGAL.md for details.