Created
August 23, 2016 23:57
-
-
Save eralpkaraduman/6f12646ac5093cda9c33c9ab8a435fa0 to your computer and use it in GitHub Desktop.
Printing where the function was called from in swift 2
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
func someFunction() { | |
// drops last call because it's the current function call | |
if let sym = NSThread.callStackSymbols().dropFirst().first { | |
print(sym) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment