8000 GitHub - joehinkle11/GYB2: Apple's GYB Script with support for generating multiple swift files from one template
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

joehinkle11/GYB2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GYB2

Overview

I had an iOS project where a gyb file was generating 10,000s lines of code, which made it a pain to debug because XCode would freak out. So I modified Apple's GYB script to support breaking the output into multiple files.

Input

example.swift.gyb

// main example.swift file 🎉
let someSwiftCodeInBaseExport: String = "Hello world from the main file!"

% # create 9 files in the directory "example"
% for i in range (1, 10):

// new gyb file file${i}.swift
// Welcome to file ${i}! 🎊
let someSwiftCodeInFile${i}: String = "Hello world from file ${i}!"

% end

Outputs

example.swift

// main example.swift file 🎉
let someSwiftCodeInBaseExport: String = "Hello world from the main file!"

example/file1.swift

// Welcome to file 1! 🎊
let someSwiftCodeInFile1: String = "Hello world from file 1!"

example/file2.swift ... example/file8.swift

example/file9.swift

// Welcome to file 9! 🎊
let someSwiftCodeInFile9: String = "Hello world from file 9!"

Tutorial Video

Tutorial Video

Example run script for an XCode build phase

# transpile .gyb files. gyb2 is an adaption I made to create multiple swift files from one gyb
find . -name '*.gyb' |                                               \
while read file; do                                              \
    tools/gyb2 --line-directive '' -o "${file%.gyb}" "$file"; \
done

My Links

About

Apple's GYB Script with support for generating multiple swift files from one template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0