Is it possible to share constants between your Tuist/SPM files and your Swift files?

Since we can use Tuist to generate Info.plist, we already have a degree of DRY (Don’t Repeat Yourself). Is it possible to take it further, to make sure that constants used to configure a project exactly match ones in the app proper?

Hey @CTMacUser :waving_hand:

Would you mind expanding what kind of configuration you want to share for which manifest files? We do allow you to share configuration across Project.swift manifests: Code sharing · Projects · Features · Guides · Tuist. Would that solve your need?

ProjectDescriptionHelpers is the code-sharing mechanism for Tuist manifests; if you’re asking how to share code between ProjectDescriptionHelpers and your app/production code, I did this with a bit of a workaround: I created an SPM package with my Tuist manifest code (I called it ProjectDescriptionModels), and then symlinked that package’s Sources to the Tuist location (ProjectDescriptionHelpers). It works, and allows me to do some niche things like write a CLI that knows what all of my project’s target names are. In your example, I suppose it’d let you read Info.plist values without directly reading from a Bundle.

1 Like

Something like this; using constants for both manifests and production files.

It’s not (just) common constants for manifest files, but ones common the manifests and the app code. Or, an app and an XPC.