Swift

Swift

Made by DeepSource

Setter access control should be different from the variable's access level SW-R1013

Anti-pattern
Minor

This issue highlights the redundant use of access control for property setters in Swift. If the access level of the variable and the setter are the same, it's unnecessary to specify the access level for the setter explicitly.

This issue doesn't cause any errors or bugs in the code, but it affects its readability and maintainability. It clutters the code with redundant information, making it harder for developers to read and understand the code.

To fix this issue, remove the redundant access control for the setter. Here's an example:

Bad Practice

private(set) private var foo: Int

Recommended

private(set) public var foo: Int