overridden_super_call - ApplebaumIan/BitbucketAPI GitHub Wiki
Overridden methods call super
Some overridden methods should always call super
- Identifier: overridden_super_call
- Enabled by default: Disabled
- Supports autocorrection: No
- Kind: lint
- Analyzer rule: No
- Minimum Swift compiler version: 3.0.0
- Default configuration: warning, excluded: , included: "*"
Non Triggering Examples
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
}
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {
self.method1()
super.viewWillAppear(animated)
self.method2()
}
}
class VC: UIViewController {
override func loadView() {
}
}
class Some {
func viewWillAppear(_ animated: Bool) {
}
}
class VC: UIViewController {
override func viewDidLoad() {
defer {
super.viewDidLoad()
}
}
}
Triggering Examples
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {↓
//Not calling to super
self.method()
}
}
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {↓
super.viewWillAppear(animated)
//Other code
super.viewWillAppear(animated)
}
}
class VC: UIViewController {
override func didReceiveMemoryWarning() {↓
}
}