← All languages

wildling

Swift library and CLI for pattern-based string generation. Zero third-party packages (Foundation / Swift standard library only). Targets Swift 5.9+ / 6.x on Linux or macOS.

Example

Install

From this repository:

cd swift
./build.sh
./bin/wildling "Year 19##"

SwiftPM (dotmonk/wildling-swift):

dependencies: [
    .package(url: "https://github.com/dotmonk/wildling-swift.git", from: "2.0.0"),
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "Wildling", package: "wildling"),
    ]),
]
import Wildling

let wildling = Wildling(patterns: ["Year 19##"])
while let value = wildling.next() {
    print(value)
}

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

Help text and --check output follow docs/cli.md / docs/help.txt.

Build

./build.sh   # Docker (swift:6.0-bookworm): swiftc -static-stdlib → dist/wildling

Project tests live in ../tests/ and are run with ../test.sh.