Created
November 23, 2021 17:19
-
-
Save beyzaince/1670f210faca03c980b97f861719b971 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public extension UIImageView { | |
| static func swizzleSetImageWithUrl() { | |
| guard let setImageWithMethod = class_getInstanceMethod(UIImageView.self, #selector(setImageWith(path:placeholder:completion:))), | |
| let swizzledMethod = class_getInstanceMethod(UIImageView.self, #selector(setStaticImage)) else { return } | |
| method_exchangeImplementations(setImageWithMethod, swizzledMethod) | |
| } | |
| @objc private func setStaticImage() { | |
| sd_setImage(with: URL(string: ""), placeholderImage: UIImage(named: "mock_snapshot_image"), completed: nil) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment