Files
Lyrebird/Sources/LyrebirdCLI/ProjectScaffolder+ShoeGazeMacOS.swift
T
2026-06-21 11:45:58 -07:00

611 lines
26 KiB
Swift

// ProjectScaffolder+ShoeGazeMacOS.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import Foundation
// MARK: - shoegaze (macOS Xcode app) template
extension ProjectScaffolder {
/// Write the full `shoegaze` macOS app template tree at `projectRoot`.
///
/// Single macOS application target. SwiftUI `@main` entry point wired to
/// `CoreAudioDriver`. Lyrebird + LyrebirdUI + LyrebirdShoeGaze +
/// LyrebirdShoeGazeUI pulled in via SPM dependencies. A default board
/// (Overdrive → Delay → Reverb → Modulation) fed by the built-in test loop
/// is constructed at launch inside an `@Observable` `AppModel`.
///
/// An **Audio** menu with **Mute ⌘M** is added via `.commands`. Quit ⌘Q is
/// standard in SwiftUI App and requires no extra code. Recording (Choose
/// Folder / Record / Stop) is already provided by `ShoeGazeView`.
static func writeShoeGazeMacOSFiles(
name: String,
projectRoot: String,
lyrebirdPath: String?,
shoegazePath: String?,
fm: FileManager
) throws {
let appGroupDir: String = (projectRoot as NSString).appendingPathComponent(name)
let xcodeprojDir: String = (projectRoot as NSString).appendingPathComponent("\(name).xcodeproj")
let schemeDir: String = (xcodeprojDir as NSString)
.appendingPathComponent("xcshareddata/xcschemes")
for dir: String in [appGroupDir, xcodeprojDir, schemeDir] {
do {
try fm.createDirectory(atPath: dir,
withIntermediateDirectories: true,
attributes: nil)
} catch {
try? fm.removeItem(atPath: projectRoot)
throw Error.fileSystemError(path: dir, reason: error.localizedDescription)
}
}
let files: [(String, String)] = [
((appGroupDir as NSString).appendingPathComponent("Info.plist"),
shoegazeMacOSInfoPlist(name: name)),
((appGroupDir as NSString).appendingPathComponent("\(name)App.swift"),
shoegazeMacOSAppSwift(name: name)),
((appGroupDir as NSString).appendingPathComponent("\(name)AppModel.swift"),
shoegazeMacOSAppModelSwift(name: name)),
((xcodeprojDir as NSString).appendingPathComponent("project.pbxproj"),
shoegazeMacOSPBXProj(name: name,
lyrebirdPath: lyrebirdPath,
shoegazePath: shoegazePath)),
((schemeDir as NSString).appendingPathComponent("\(name).xcscheme"),
appScheme(name: name, productExtension: "app")),
]
try writeFiles(files, fm: fm, projectRoot: projectRoot)
}
// MARK: - Source files
/// `Info.plist` for the shoegaze macOS app.
///
/// Extends the standard macOS plist with `NSMicrophoneUsageDescription`
/// (required when switching to `.liveInput`), `NSHighResolutionCapable`,
/// and `LSApplicationCategoryType` set to music.
static func shoegazeMacOSInfoPlist(name: String) -> String {
let bundleIdSetting: String = "$(PRODUCT_BUNDLE_IDENTIFIER)"
let bundleNameSetting: String = "$(PRODUCT_NAME)"
let executableNameSetting: String = "$(EXECUTABLE_NAME)"
let deploymentTargetSetting: String = "$(MACOSX_DEPLOYMENT_TARGET)"
return """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>\(executableNameSetting)</string>
<key>CFBundleIdentifier</key>
<string>\(bundleIdSetting)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>\(bundleNameSetting)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key>
<string>\(deploymentTargetSetting)</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMicrophoneUsageDescription</key>
<string>\(name) requires microphone access for live guitar and audio input.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © \(currentYearString()) \(name). All rights reserved.</string>
</dict>
</plist>
"""
}
/// `<name>App.swift` — SwiftUI `@main` entry point for the shoegaze macOS template.
///
/// Emitted source must not contain the Lyrebird MIT copyright header.
static func shoegazeMacOSAppSwift(name: String) -> String {
"""
// \(name) — entry point
import SwiftUI
import LyrebirdShoeGazeUI
@main
struct \(name)App: App {
@State private var model: \(name)AppModel = \(name)AppModel()
var body: some Scene {
WindowGroup {
ShoeGazeView(shoeGaze: model.shoeGaze)
.frame(minWidth: 960, minHeight: 480)
.onAppear { model.start() }
.onDisappear { model.stop() }
}
.commands {
CommandMenu("Audio") {
Button(model.muted ? "Unmute" : "Mute") {
model.toggleMute()
}
.keyboardShortcut("m", modifiers: .command)
}
}
}
}
"""
}
/// `<name>AppModel.swift` — `@Observable` model owning the engine and `ShoeGaze`.
///
/// Emitted source must not contain the Lyrebird MIT copyright header.
static func shoegazeMacOSAppModelSwift(name: String) -> String {
let blockSize: Int = scaffoldDefaultBlockSize
let sampleRate: Double = 48_000.0
let outputChannels: Int = scaffoldDefaultOutputChannels
let audioBusCount: Int = 256
return """
// \(name)AppModel.swift
import Observation
import LyrebirdSynth
import LyrebirdShoeGaze
/// Owns the `SynthesisEngine` and `ShoeGaze` manager for \(name).
///
/// Call `start()` when the root view appears and `stop()` when it disappears.
/// `toggleMute()` stops and restarts the engine, providing a click-free
/// silence while parameters remain live.
@Observable
@MainActor
final class \(name)AppModel {
private(set) var shoeGaze: ShoeGaze
private(set) var muted: Bool = false
private let engine: SynthesisEngine
init() {
let eng: SynthesisEngine = SynthesisEngine(
blockSize: \(blockSize),
sampleRate: \(sampleRate),
numOutputChannels: \(outputChannels),
numInputChannels: 0,
numAudioBuses: \(audioBusCount),
driver: CoreAudioDriver()
)
self.engine = eng
self.shoeGaze = ShoeGaze(engine: eng)
do {
let board: PedalBoard = try shoeGaze.addBoard()
try board.add(OverdrivePedal())
try board.add(DelayPedal())
try board.add(ReverbPedal())
try board.add(ModulationPedal())
try shoeGaze.finalizeBoard(board)
} catch {
print("[\(name)] board build failed: \\(error)")
}
}
/// Start the audio engine. Call from `.onAppear`.
func start() {
guard !muted else { return }
do {
try engine.start()
} catch {
print("[\(name)] engine.start failed: \\(error)")
}
}
/// Stop the audio engine. Call from `.onDisappear`.
func stop() {
engine.stop()
}
/// Toggle mute by stopping/starting the engine.
func toggleMute() {
if muted {
muted = false
do {
try engine.start()
} catch {
print("[\(name)] engine.start (unmute) failed: \\(error)")
}
} else {
engine.stop()
muted = true
}
}
}
"""
}
// MARK: - pbxproj
/// `project.pbxproj` for the `shoegaze` macOS app template.
///
/// Structure mirrors `shoegazeIOSPBXProj` but uses `SDKROOT = macosx`,
/// `MACOSX_DEPLOYMENT_TARGET = 15.0`, macOS-style `LD_RUNPATH_SEARCH_PATHS`,
/// `ENABLE_HARDENED_RUNTIME`, `COMBINE_HIDPI_IMAGES`, and `DEAD_CODE_STRIPPING`.
/// UUIDs are in the `0x03Cxx` range — no collision with ios-ui (`0x02xx`),
/// macos-ui-xcode (`0x01xx`), auv3 (`0x03Axx`), or shoegaze-ios (`0x03Bxx`).
/// Depends on four SPM products: `Lyrebird`, `LyrebirdUI`, `LyrebirdShoeGaze`,
/// `LyrebirdShoeGazeUI`.
static func shoegazeMacOSPBXProj(
name: String,
lyrebirdPath: String? = nil,
shoegazePath: String? = nil
) -> String {
let bundleID: String = "\(defaultBundleIdentifierPrefix).\(name)"
let lyrebirdRefLabel: String = pbxPackageReferenceLabel(lyrebirdPath: lyrebirdPath)
let lyrebirdRefSection: String = pbxPackageReferenceSection(lyrebirdPath: lyrebirdPath)
let shoegazeRefLabel: String = shoegazeMacOSPackageReferenceLabel(shoegazePath: shoegazePath)
let shoegazeRefSection: String = shoegazeMacOSPackageReferenceSection(shoegazePath: shoegazePath)
return """
// !$*UTF8*$!
{
\tarchiveVersion = 1;
\tclasses = {
\t};
\tobjectVersion = 60;
\tobjects = {
/* Begin PBXBuildFile section */
\t\t\(pbxSGMacAppFileBuild) /* \(name)App.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGMacAppFileRef) /* \(name)App.swift */; };
\t\t\(pbxSGMacAppModelBuild) /* \(name)AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = \(pbxSGMacAppModelRef) /* \(name)AppModel.swift */; };
\t\t\(pbxSGMacLyrebirdBuild) /* Lyrebird in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacLyrebirdDep) /* Lyrebird */; };
\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxLyrebirdUIProductDep) /* LyrebirdUI */; };
\t\t\(pbxSGMacShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */; };
\t\t\(pbxSGMacShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */ = {isa = PBXBuildFile; productRef = \(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
\t\t\(pbxAppProductRef) /* \(name).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = \(name).app; sourceTree = BUILT_PRODUCTS_DIR; };
\t\t\(pbxInfoPlistRef) /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
\t\t\(pbxSGMacAppFileRef) /* \(name)App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)App.swift; sourceTree = "<group>"; };
\t\t\(pbxSGMacAppModelRef) /* \(name)AppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \(name)AppModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
\t\t\(pbxFrameworksPhase) /* Frameworks */ = {
\t\t\tisa = PBXFrameworksBuildPhase;
\t\t\tbuildActionMask = \(pbxBuildActionMask);
\t\t\tfiles = (
\t\t\t\t\(pbxSGMacLyrebirdBuild) /* Lyrebird in Frameworks */,
\t\t\t\t\(pbxLyrebirdUIFrameworkBuild) /* LyrebirdUI in Frameworks */,
\t\t\t\t\(pbxSGMacShoeGazeBuild) /* LyrebirdShoeGaze in Frameworks */,
\t\t\t\t\(pbxSGMacShoeGazeUIBuild) /* LyrebirdShoeGazeUI in Frameworks */,
\t\t\t);
\t\t\trunOnlyForDeploymentPostprocessing = 0;
\t\t};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
\t\t\(pbxMainGroup) = {
\t\t\tisa = PBXGroup;
\t\t\tchildren = (
\t\t\t\t\(pbxAppGroup) /* \(name) */,
\t\t\t\t\(pbxProductsGroup) /* Products */,
\t\t\t);
\t\t\tsourceTree = "<group>";
\t\t};
\t\t\(pbxProductsGroup) /* Products */ = {
\t\t\tisa = PBXGroup;
\t\t\tchildren = (
\t\t\t\t\(pbxAppProductRef) /* \(name).app */,
\t\t\t);
\t\t\tname = Products;
\t\t\tsourceTree = "<group>";
\t\t};
\t\t\(pbxAppGroup) /* \(name) */ = {
\t\t\tisa = PBXGroup;
\t\t\tchildren = (
\t\t\t\t\(pbxSGMacAppFileRef) /* \(name)App.swift */,
\t\t\t\t\(pbxSGMacAppModelRef) /* \(name)AppModel.swift */,
\t\t\t\t\(pbxInfoPlistRef) /* Info.plist */,
\t\t\t);
\t\t\tpath = \(name);
\t\t\tsourceTree = "<group>";
\t\t};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
\t\t\(pbxBlueprintIDApp) /* \(name) */ = {
\t\t\tisa = PBXNativeTarget;
\t\t\tbuildConfigurationList = \(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */;
\t\t\tbuildPhases = (
\t\t\t\t\(pbxSourcesPhase) /* Sources */,
\t\t\t\t\(pbxFrameworksPhase) /* Frameworks */,
\t\t\t\t\(pbxResourcesPhase) /* Resources */,
\t\t\t);
\t\t\tbuildRules = (
\t\t\t);
\t\t\tdependencies = (
\t\t\t);
\t\t\tname = \(name);
\t\t\tpackageProductDependencies = (
\t\t\t\t\(pbxSGMacLyrebirdDep) /* Lyrebird */,
\t\t\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */,
\t\t\t\t\(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */,
\t\t\t\t\(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */,
\t\t\t);
\t\t\tproductName = \(name);
\t\t\tproductReference = \(pbxAppProductRef) /* \(name).app */;
\t\t\tproductType = "com.apple.product-type.application";
\t\t};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
\t\t\(pbxRootObject) /* Project object */ = {
\t\t\tisa = PBXProject;
\t\t\tattributes = {
\t\t\t\tBuildIndependentTargetsInParallel = 1;
\t\t\t\tLastSwiftUpdateCheck = 1600;
\t\t\t\tLastUpgradeCheck = 1600;
\t\t\t\tTargetAttributes = {
\t\t\t\t\t\(pbxBlueprintIDApp) = {
\t\t\t\t\t\tCreatedOnToolsVersion = 16.0;
\t\t\t\t\t};
\t\t\t\t};
\t\t\t};
\t\t\tbuildConfigurationList = \(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */;
\t\t\tcompatibilityVersion = "Xcode 14.0";
\t\t\tdevelopmentRegion = en;
\t\t\thasScannedForEncodings = 0;
\t\t\tknownRegions = (
\t\t\t\ten,
\t\t\t\tBase,
\t\t\t);
\t\t\tmainGroup = \(pbxMainGroup);
\t\t\tpackageReferences = (
\t\t\t\t\(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */,
\t\t\t\t\(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */,
\t\t\t);
\t\t\tproductRefGroup = \(pbxProductsGroup) /* Products */;
\t\t\tprojectDirPath = "";
\t\t\tprojectRoot = "";
\t\t\ttargets = (
\t\t\t\t\(pbxBlueprintIDApp) /* \(name) */,
\t\t\t);
\t\t};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
\t\t\(pbxResourcesPhase) /* Resources */ = {
\t\t\tisa = PBXResourcesBuildPhase;
\t\t\tbuildActionMask = \(pbxBuildActionMask);
\t\t\tfiles = (
\t\t\t);
\t\t\trunOnlyForDeploymentPostprocessing = 0;
\t\t};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
\t\t\(pbxSourcesPhase) /* Sources */ = {
\t\t\tisa = PBXSourcesBuildPhase;
\t\t\tbuildActionMask = \(pbxBuildActionMask);
\t\t\tfiles = (
\t\t\t\t\(pbxSGMacAppFileBuild) /* \(name)App.swift in Sources */,
\t\t\t\t\(pbxSGMacAppModelBuild) /* \(name)AppModel.swift in Sources */,
\t\t\t);
\t\t\trunOnlyForDeploymentPostprocessing = 0;
\t\t};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
\t\t\(pbxAppDebugConfig) /* Debug */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
\t\t\t\tCODE_SIGN_STYLE = Automatic;
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
\t\t\t\tENABLE_HARDENED_RUNTIME = YES;
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
\t\t\t\t\t"$(inherited)",
\t\t\t\t\t"@executable_path/../Frameworks",
\t\t\t\t);
\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 15.0;
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
\t\t\t\tSWIFT_VERSION = 6.0;
\t\t\t};
\t\t\tname = Debug;
\t\t};
\t\t\(pbxAppReleaseConfig) /* Release */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
\t\t\t\tCODE_SIGN_STYLE = Automatic;
\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
\t\t\t\tENABLE_HARDENED_RUNTIME = YES;
\t\t\t\tGENERATE_INFOPLIST_FILE = NO;
\t\t\t\tINFOPLIST_FILE = \(name)/Info.plist;
\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (
\t\t\t\t\t"$(inherited)",
\t\t\t\t\t"@executable_path/../Frameworks",
\t\t\t\t);
\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 15.0;
\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \(bundleID);
\t\t\t\tPRODUCT_NAME = "$(TARGET_NAME)";
\t\t\t\tSWIFT_VERSION = 6.0;
\t\t\t};
\t\t\tname = Release;
\t\t};
\t\t\(pbxProjectDebugConfig) /* Debug */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
\t\t\t\tCOPY_PHASE_STRIP = NO;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
\t\t\t\tENABLE_TESTABILITY = YES;
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;
\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (
\t\t\t\t\t"DEBUG=1",
\t\t\t\t\t"$(inherited)",
\t\t\t\t);
\t\t\t\tONLY_ACTIVE_ARCH = YES;
\t\t\t\tSDKROOT = macosx;
\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-Onone";
\t\t\t};
\t\t\tname = Debug;
\t\t};
\t\t\(pbxProjectReleaseConfig) /* Release */ = {
\t\t\tisa = XCBuildConfiguration;
\t\t\tbuildSettings = {
\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;
\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;
\t\t\t\tCOPY_PHASE_STRIP = NO;
\t\t\t\tDEAD_CODE_STRIPPING = YES;
\t\t\t\tDEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
\t\t\t\tENABLE_NS_ASSERTIONS = NO;
\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;
\t\t\t\tENABLE_USER_SCRIPT_SANDBOXING = YES;
\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu17;
\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;
\t\t\t\tSDKROOT = macosx;
\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;
\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = "-O";
\t\t\t};
\t\t\tname = Release;
\t\t};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
\t\t\(pbxAppBuildConfigList) /* Build configuration list for PBXNativeTarget "\(name)" */ = {
\t\t\tisa = XCConfigurationList;
\t\t\tbuildConfigurations = (
\t\t\t\t\(pbxAppDebugConfig) /* Debug */,
\t\t\t\t\(pbxAppReleaseConfig) /* Release */,
\t\t\t);
\t\t\tdefaultConfigurationIsVisible = 0;
\t\t\tdefaultConfigurationName = Release;
\t\t};
\t\t\(pbxProjectBuildConfigList) /* Build configuration list for PBXProject "\(name)" */ = {
\t\t\tisa = XCConfigurationList;
\t\t\tbuildConfigurations = (
\t\t\t\t\(pbxProjectDebugConfig) /* Debug */,
\t\t\t\t\(pbxProjectReleaseConfig) /* Release */,
\t\t\t);
\t\t\tdefaultConfigurationIsVisible = 0;
\t\t\tdefaultConfigurationName = Release;
\t\t};
/* End XCConfigurationList section */
\(lyrebirdRefSection)
\(shoegazeRefSection)
/* Begin XCSwiftPackageProductDependency section */
\t\t\(pbxSGMacLyrebirdDep) /* Lyrebird */ = {
\t\t\tisa = XCSwiftPackageProductDependency;
\t\t\tpackage = \(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */;
\t\t\tproductName = Lyrebird;
\t\t};
\t\t\(pbxLyrebirdUIProductDep) /* LyrebirdUI */ = {
\t\t\tisa = XCSwiftPackageProductDependency;
\t\t\tpackage = \(pbxRemoteSPMRef) /* \(lyrebirdRefLabel) */;
\t\t\tproductName = LyrebirdUI;
\t\t};
\t\t\(pbxSGMacShoeGazeDep) /* LyrebirdShoeGaze */ = {
\t\t\tisa = XCSwiftPackageProductDependency;
\t\t\tpackage = \(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */;
\t\t\tproductName = LyrebirdShoeGaze;
\t\t};
\t\t\(pbxSGMacShoeGazeUIDep) /* LyrebirdShoeGazeUI */ = {
\t\t\tisa = XCSwiftPackageProductDependency;
\t\t\tpackage = \(pbxSGMacShoeGazePackageRef) /* \(shoegazeRefLabel) */;
\t\t\tproductName = LyrebirdShoeGazeUI;
\t\t};
/* End XCSwiftPackageProductDependency section */
\t};
\trootObject = \(pbxRootObject) /* Project object */;
}
"""
}
// MARK: - ShoeGaze macOS package reference helpers
/// pbxproj snippet for the ShoeGaze SPM package reference in the macOS template.
/// Uses the macOS-specific `pbxSGMacShoeGazePackageRef` UUID so it doesn't
/// collide with the iOS template's `pbxSGShoeGazePackageRef`.
static func shoegazeMacOSPackageReferenceSection(shoegazePath: String?) -> String {
if let path: String = shoegazePath {
let escaped: String = pbxQuoteEscape(path)
return """
/* Begin XCLocalSwiftPackageReference section */
\t\t\(pbxSGMacShoeGazePackageRef) /* XCLocalSwiftPackageReference "shoegaze" */ = {
\t\t\tisa = XCLocalSwiftPackageReference;
\t\t\trelativePath = "\(escaped)";
\t\t};
/* End XCLocalSwiftPackageReference section */
"""
} else {
return """
/* Begin XCRemoteSwiftPackageReference section */
\t\t\(pbxSGMacShoeGazePackageRef) /* XCRemoteSwiftPackageReference "shoegaze" */ = {
\t\t\tisa = XCRemoteSwiftPackageReference;
\t\t\trepositoryURL = "\(shoegazePackageURL)";
\t\t\trequirement = {
\t\t\t\tkind = upToNextMajorVersion;
\t\t\t\tminimumVersion = \(shoegazeMinimumVersion);
\t\t\t};
\t\t};
/* End XCRemoteSwiftPackageReference section */
"""
}
}
/// Comment label used in pbxproj for the ShoeGaze package reference (macOS variant).
static func shoegazeMacOSPackageReferenceLabel(shoegazePath: String?) -> String {
shoegazePath == nil
? #"XCRemoteSwiftPackageReference "shoegaze""#
: #"XCLocalSwiftPackageReference "shoegaze""#
}
// MARK: - shoegaze macOS PBX UUID constants
//
// All UUIDs in the `0x03Cxx` range — no collision with ios-ui (`0x02xx`),
// macos-ui-xcode (`0x01xx`), auv3 (`0x03Axx`), or shoegaze-ios (`0x03Bxx`).
/// `<name>App.swift` file reference UUID.
static let pbxSGMacAppFileRef: String = "AABB000000000000000003C0"
/// `<name>App.swift` build file UUID.
static let pbxSGMacAppFileBuild: String = "AABB000000000000000003C1"
/// `<name>AppModel.swift` file reference UUID.
static let pbxSGMacAppModelRef: String = "AABB000000000000000003C2"
/// `<name>AppModel.swift` build file UUID.
static let pbxSGMacAppModelBuild: String = "AABB000000000000000003C3"
/// Package reference UUID for the ShoeGaze SPM package (macOS variant).
static let pbxSGMacShoeGazePackageRef: String = "AABB000000000000000003C4"
/// Product dependency UUID for `Lyrebird` (macOS shoegaze needs the core module).
static let pbxSGMacLyrebirdDep: String = "AABB000000000000000003C5"
/// Build file UUID for `Lyrebird` in Frameworks.
static let pbxSGMacLyrebirdBuild: String = "AABB000000000000000003C6"
/// Product dependency UUID for `LyrebirdShoeGaze`.
static let pbxSGMacShoeGazeDep: String = "AABB000000000000000003C7"
/// Build file UUID for `LyrebirdShoeGaze` in Frameworks.
static let pbxSGMacShoeGazeBuild: String = "AABB000000000000000003C8"
/// Product dependency UUID for `LyrebirdShoeGazeUI`.
static let pbxSGMacShoeGazeUIDep: String = "AABB000000000000000003C9"
/// Build file UUID for `LyrebirdShoeGazeUI` in Frameworks.
static let pbxSGMacShoeGazeUIBuild: String = "AABB000000000000000003CA"
}