Prohibited Calls to Super
Some methods should not call super.
- Identifier:
prohibited_super_call
- 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 excluded [] included [“*”]
Non Triggering Examples
class VC: UIViewController {
override func loadView() {
}
}
class NSView {
func updateLayer() {
self.method1()
}
}
public class FileProviderExtension: NSFileProviderExtension {
override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {
guard let identifier = persistentIdentifierForItem(at: url) else {
completionHandler(NSFileProviderError(.noSuchItem))
return
}
}
}
Triggering Examples
class VC: UIViewController {
override func loadView() {↓
super.loadView()
}
}
class VC: NSFileProviderExtension {
override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {↓
self.method1()
super.providePlaceholder(at:url, completionHandler: completionHandler)
}
}
class VC: NSView {
override func updateLayer() {↓
self.method1()
super.updateLayer()
self.method2()
}
}
class VC: NSView {
override func updateLayer() {↓
defer {
super.updateLayer()
}
}
}