Swiftlint: Support for fileprivate on @IBOutlet rule

Created on 8 Oct 2016  路  4Comments  路  Source: realm/SwiftLint

A similar case to #781 which would basically treat fileprivate and private the same. The reason I would like this is because I like to put logic inside extensions to my class to keep things organized and leaving them as private doesn't allow them to be accessible in an extension even if its defined in the same file.

enhancement

Most helpful comment

I wonder if we could do that via a Rule Configuration (instead of allowing both private and fileprivate in the rule for everybody)?

This way in your .swftlint.yml you could do whatever you prefer, with something like this:

iboutlet_access:
  scopes: [private, fileprivate]

If we go that route, we might as well accept people to configure it for internal (or even public?), So we might as well consider renaming the rule to iboutlet_access_scope or something similar

All 4 comments

I wonder if we could do that via a Rule Configuration (instead of allowing both private and fileprivate in the rule for everybody)?

This way in your .swftlint.yml you could do whatever you prefer, with something like this:

iboutlet_access:
  scopes: [private, fileprivate]

If we go that route, we might as well accept people to configure it for internal (or even public?), So we might as well consider renaming the rule to iboutlet_access_scope or something similar

any update on this? i'm happy to work on it, but would be inclined to keep it simple to begin with and just make the change as per the OP.

of course i agree @AliSoftware is a more long term solution. (although now i think about it, public is probably even more useful than internal in terms of outlets. separation of concerns would suggest you'd keep all outlets private or fileprivate unless you're making some kind of generic, reusable user interface component that can be used across projects, where each project would hook up the outlet in a custom IB file). in which case you'd be building a framework and want your outlet public.)

anyone already working on it?

I won't be working on it anytime soon at least (I have already to much work on other OSS projects including mine 馃槣) so feel free to start this one up!

This was resolved on #905. Feel free to open a new issue/PR to address the configuration stuff!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AliSoftware picture AliSoftware  路  3Comments

castus picture castus  路  3Comments

muzamilhassan1987 picture muzamilhassan1987  路  3Comments

ivanbruel picture ivanbruel  路  3Comments

jcarroll-mediafly picture jcarroll-mediafly  路  3Comments