Private Actions
IBActions should be private
- Identifier:
private_action
- Enabled by default: No
- Supports autocorrection: No
- Kind: lint
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
class Foo {
@IBAction private func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction private func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
}
private extension Foo {
@IBAction func barButtonTapped(_ sender: UIButton) {}
}
fileprivate extension Foo {
@IBAction func barButtonTapped(_ sender: UIButton) {}
}
Triggering Examples
class Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
public extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
internal extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}