-
-
Save schpaa/9db6a91cc0043ac42c29 to your computer and use it in GitHub Desktop.
This file contains 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
// MyClass.swift | |
class MyClass { | |
func doSomething() { | |
refresh() | |
} | |
} | |
//** | |
private func refresh() { | |
println("I'm the global refresh function.") | |
} | |
// main.swift | |
// Oh dear, we didn't know that there was an internal private function called refresh... | |
extension MyClass { | |
func refresh() { | |
println("I'm an extension refresh") | |
} | |
} | |
MyClass().doSomething() | |
// And our refresh() ** gets called. I wasn't expecting swizzling to happen quite so subltly. | |
// see also https://gist.github.com/rnapier/478465d1b15e95b98b42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment