Skip to content

Conversation

@awelch6
Copy link

@awelch6 awelch6 commented Dec 9, 2018

Instead of overwriting the existing urlComponents.queryItems with itself and then adding the new queryItems variable on top of it. I appended the contents of the queryItems variable to urlComponents.queryItems. This fixes the access management issues, and results in slightly cleaner code.

Instead of overwriting the existing urlComponents.queryItems with itself and then adding the new queryItems variable on top of it. I appended the contents of the queryItems variable to urlComponents.queryItems. This fixes the access management issues, and results in slightly cleaner code.
@max-vyshnevskyi
Copy link

max-vyshnevskyi commented Mar 22, 2019

@awelch6, your changes will break SDK.
urlComponents?.queryItems?.append(contentsOf: queryItems) is not the same as urlComponents?.queryItems = (urlComponents?.queryItems ?? []) + queryItems.
If urlComponents.queryItems will be nil (spoiler: they will), then after appending it still be nil, but after assigning it will have a value.
Unfornaturely, you have to create a local variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants