Crates.io | swift-precompiler |
lib.rs | swift-precompiler |
version | 0.1.5 |
source | src |
created_at | 2024-01-13 00:37:20.629345 |
updated_at | 2024-03-09 17:46:16.943667 |
description | A precompiler for Swift that allows you to use additional macros, include files, and more. |
homepage | https://github.com/lockieluke/swift-precompiler |
repository | https://github.com/lockieluke/swift-precompiler |
max_upload_size | |
id | 1098184 |
size | 37,215 |
⚡ A fast, lightweight precompiler for Swift
includeStr!
like functionality to Swift with the precompileIncludeStr
functionCargo:
cargo install swift-precompiler
Run swift-precompiler init
to initialise a config file swift-precompiled.toml
with the default values
Available options:
dirs
- An array of directories to search for Swift source files that require precompilationpath_aliases
- A dictionary of path aliases to use in precompile callsExample:
dirs = ["Cider/", "CiderPlaybackAgent/"]
[path_aliases]
# "@" as a path alias refers to the current working directory in most cases
"@" = "./"
Including a file as a string literal at compile time:
let javaScript = precompileIncludeStr("path/to/file.js")
Include a file as a Data at compile time:
let image = precompileIncludeData("path/to/image.png")
Run swift-precompiler
to precompile all Swift files in the directories specified in the config file
swift-precompiler precompile
You should add Precompiled.swift
to your .gitignore
Swift Precompiler encodes your strings with Base64, you can add swift-extras-base64 to your project using SPM to enable faster Base64 decode.