Remove public access modifier for internal class _URLEncodedFormEncoder #3053
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goals β½
Ensure consistency within the public API.
Implementation Details π§
When testing out
swift-api-inventory
on Alamofire, I saw this line in the output, which stuck out because of the leading underscore:Looking at the source,
_URLEncodedFormEncoder
is an internal type, but the initializer showed up in the inventory because of itspublic
access modifier.Alamofire/Source/URLEncodedFormEncoder.swift
Lines 403 to 414 in 262fc46
This change removes
public
to give that initializer an implicitinternal
access level to match its enclosing type_URLEncodedFormEncoder
.Testing Details π
I ran the test suite locally and await the CI to finish to confirm that this change doesn't break anything. For this kind of issue, it seems like a linter rule would be more appropriate than a unit test. Reading through SwiftLint's list of rules, I didn't see anything that does this yet. I'll ask around to see if folks think that would be helpful, and if so, write that up.