$ npm install hyperschema-swiftSwift code generation for Hyperschema. Transforms schema definitions into Swift structs with binary codec conformance using https://github.com/holepunchto/compact-encoding-swift.
npm i hyperschema-swift
const SwiftHyperschema = require('hyperschema-swift')
const Hyperschema = require('hyperschema')
const schema = Hyperschema.from('./spec')
// Get generated Swift source as a string
const swift = new SwiftHyperschema(schema)
const code = swift.toCode()
// Or write a complete Swift package to disk
SwiftHyperschema.toDisk(schema, './output')
toDisk writes a ready-to-build Swift package:
output/
Package.swift
Sources/Schema.swift
schema.json
Apache-2.0