-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Optional initial
value for input property wrappers
#556
Comments
Hi @tarbaiev-smg — thanks for the issue! It seems like this overlaps a bit with #4 and #41, such that I don't think I want to land this fix quite yet. In particular, instead of just specifying a key for the environment, users may need to transform the value, which should be handled by the type's Would love to hear your thoughts about how this could fit in with those other requests! |
@natecook1000 Thanks for your notes. I had some doubts about the design. However also tried to keep the changes minimal. As an example I was able to solve my needs by writing a simple extension to the @Option(environmentKey: .exportPath)
var exportPath: URL where Likewise some out-of-the-box solutions (like the ones you mentioned) take a lot of effort and time to implement and in the end might still be too limited to fit the majority's needs, while the users might already benefit from a more low-level API. So maybe the #4 might be built on top of this solution (especially if nobody has started working on it yet)? I also wasn't sure about the transformation logic, and decided to match the behavior of |
Hi @natecook1000, |
Currently it's only possible to use initial value if the property type is non-
Optional
.I'd like to use environment variable as a fallback value for a command line argument (similar how it's done in Fastlane), but keep the argument required. To allow this I'd like to propose adding the
initial
argument to initializers of non-Optional
type property wrappers which do not contain thewrappedValue
argument.For example adjusting the
Option
initializer:would allow us to use it as follows:
The text was updated successfully, but these errors were encountered: