Is the Swift dot syntax still being used for class properties #800
jaxdesmarais
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Idea
Currently our SDK is mostly in Objective-C, as we transition to using Swift, we have been exploring possibly removing the dot syntax for initializing required parameters on class properties.
Proposed Change
Currently our docs along with defaulting all parameters to optionals and nil allows merchants to do this:
Ideally, we would like to make required fields non-optional which would require merchants to move to this syntax:
Reasoning
Our preference is for the latter, but we want to start a discussion to see if any Swift merchants feel strongly about the dot syntax or if people are already using the latter.
The reason we would like to make this change is to allows merchants to know sooner if a request may fail. Currently, these requests are often used to construct an API call that returns a resulting error if a required parameter is not passed. Switching to making the parameters required in the initilizers would allow merchants to get inline warnings when a required field is not present, which we believe will make debugging easier vs waiting on the result of an API call to figure out that not all fields were passed.
Beta Was this translation helpful? Give feedback.
All reactions