I’m attempting to make the most of the Run Script Part in my Xcode mission’s Construct Phases to generate a .swift
file, which shall be included within the compilation of an area Swift bundle dependency.
My mission construction appears like this:
my-app/
├─ my-app.xcodeproj
├─ my-package/
│ ├─ Bundle.swift
│ ├─ Sources/
│ │ ├─ MyPackage/
│ │ | ├─ Utility.swift
│ │ | ├─ Generated/
│ │ | | ├─ GeneratedCode.swift
├─ my-app-ios/
│ ├─ ContentView.swift
│ ├─ ...
The principle mission listing is my-app
and it incorporates an iOS app my-app-ios
, which relies on a Swift bundle throughout the mission, my-package
.
The bundle has a Utility
class that references static members outlined in Generated/GeneratedCode.swift
.
My important aim is to keep away from committing GeneratedCode.swift
into supply management, because it incorporates secrets and techniques that I need to maintain out of GitHub, so on a contemporary clone this file wouldn’t exist.
My thought course of was that I may use Xcode’s Construct Phases on my-app
to run a script previous to Compile Sources which might generate and place GeneratedCode.swift
the place it must go, thereby avoiding any “Can not discover ‘…’ in scope” construct errors.
Nonetheless I can not appear to get previous these “Can not discover ‘…’ in scope” errors. It appears as if my-package
is attempting to be compiled earlier than reaching the construct section that I added. At the very least that is what I assume the problem is.
Is there any solution to have a script generate a .swift
file that shall be utilized in an area Swift bundle previous to the compilation of the bundle as a way to keep away from together with that file in supply management?