New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Request: Strong IBOutlet #2433

Closed
sindresorhus opened this Issue Oct 4, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@sindresorhus
Copy link

sindresorhus commented Oct 4, 2018

New Issue Checklist

New rule request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

Enforce not using weak for @IBOutlet. Even though Xcode defaults to weak, Apple has recommended using strong outlets since WWDC 2015.

  1. Provide several examples of what would and wouldn't trigger violations.

Would trigger:

final class ViewController: NSViewController {
	@IBOutlet weak var label: NSTextField!
}

Would not trigger:

final class ViewController: NSViewController {
	@IBOutlet var label: NSTextField!
}
final class ViewController: NSViewController {
	weak var label: NSTextField = 
}
  1. Should the rule be configurable, if so what parameters should be configurable?

No

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a rule as opt-in.

I think it should be enabled by default as it adheres to the guidelines and it's what Apple recommends. In the few cases you would actually want it to be weak you can just use a // swiftlint:disable comment.

@realm-probot realm-probot bot added the O:User label Oct 4, 2018

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jan 14, 2019

otaviohere added a commit to heremaps/msdkui-ios that referenced this issue Jan 17, 2019

MSDKUI-1769: Update SwiftLInt to 0.29.4
And enable new optional rule, strong_iboutlet

realm/SwiftLint#2433

Signed-off-by: Otavio Cordeiro <41054361+otaviohere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment