IBAnimatable icon indicating copy to clipboard operation
IBAnimatable copied to clipboard

Use `private` instead of `fileprivate` if possible

Open JakeLin opened this issue 9 years ago • 1 comments

Following up @tbaranes 's comment on https://github.com/IBAnimatable/IBAnimatable/pull/437#discussion_r110823732

We should consider using private if possible instead of fileprivate.

Personally, I don't like the idea of having two privates: private and fileprivate. But since we have them, we should follow Principle of least privilege. For example, we should use private for variables and methods if they get used within the same scope (same extension, same class or struct). If we can't, then use fileprivate when those variables and methods get used in different scope but within the same file.

How to do it?

Search all fileprivate and see which one can be downgraded to private.

JakeLin avatar Apr 11 '17 22:04 JakeLin

for the future please look at https://github.com/apple/swift-evolution/blob/master/proposals/0169-improve-interaction-between-private-declarations-and-extensions.md and the rejected one https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md

phimage avatar Apr 15 '17 21:04 phimage