mirror of
https://github.com/ypresto/SwiftLintXcode.git
synced 2026-04-27 14:57:38 +00:00
🔧 Guard Method values in swizzle()
This commit is contained in:
parent
5cb965ea10
commit
6101a95d39
1 changed files with 5 additions and 2 deletions
|
|
@ -24,8 +24,11 @@ final class SaveHook {
|
||||||
if swizzled { return }
|
if swizzled { return }
|
||||||
swizzled = true
|
swizzled = true
|
||||||
|
|
||||||
let fromMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.save(withDelegate:didSave:contextInfo:)))
|
guard let fromMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.save(withDelegate:didSave:contextInfo:))),
|
||||||
let toMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.swiftLintXcodeSaveDocument(delegate:didSaveSelector:contextInfo:)))
|
let toMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.swiftLintXcodeSaveDocument(delegate:didSaveSelector:contextInfo:))) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
method_exchangeImplementations(fromMethod, toMethod)
|
method_exchangeImplementations(fromMethod, toMethod)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue