Created
January 26, 2016 04:15
-
-
Save therealbnut/e6f46a673b4f09c9cdf7 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
public struct SourceLocation: CustomDebugStringConvertible { | |
init(file: String = __FILE__, line: Int = __LINE__, column: Int = __COLUMN__, function: String = __FUNCTION__) { | |
self.file = file | |
self.line = line | |
self.column = column | |
self.function = function | |
} | |
public let file: String | |
public let line: Int | |
public let column: Int | |
public let function: String | |
public var debugDescription: String { | |
return "\(function) @ \(file):\(line):\(column)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be used to get the current location in source, as a structure.
For example: