Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 2.06 KB

File metadata and controls

48 lines (36 loc) · 2.06 KB

Step Into Vision Example Code

This repo is my workspace for Example Code for Step Into Vision.

I'm not currently accepting pull requests. If you would like to suggest an example, please contact me. Links are in ny GitHub profile.

Support my work

ko-fi

Auto-generating the Example list

The huge switch and ModelData array are now generated from the example files themselves.

Each example already has a short metadata header the generator reads:

//  Title: Example150
//  Subtitle: Something cool
//  Description: A short description
//  Type: Volume   // Window | Window Alt | Volume | Space | Space Full
//  Featured: false
//  Success: true

Regenerate the registry (App/Generated/ExampleRegistry.swift) any time you add or change examples:

xcrun swift Tools/generate_examples.swift

If you want Xcode to trigger this for you, add a Run Script build phase (runs on every build):

  • Select the app target → Build Phases → + → New Run Script Phase.
  • Paste:
    set -euo pipefail
    SRC="$SRCROOT/Step Into Example Code/Examples"
    OUT="$SRCROOT/Step Into Example Code/App/Generated/ExampleRegistry.swift"
    xcrun --sdk macosx swift "$SRCROOT/Tools/generate_examples.swift" --src "$SRC" --out "$OUT"
  • Drag it before “Compile Sources”.
  • Inputs: $(SRCROOT)/Tools/generate_examples.swift, $(SRCROOT)/Step Into Example Code/Examples
    Output: $(SRCROOT)/Step Into Example Code/App/Generated/ExampleRegistry.swift
  • To avoid Xcode sandbox blocks, set Build Settings → User Script Sandboxing (ENABLE_USER_SCRIPT_SANDBOXING) to No (you can limit this to Debug).