Last active
January 25, 2022 06:40
-
-
Save GUIEEN/0693b6009e79c882e55c5b15fc13cbeb to your computer and use it in GitHub Desktop.
log with time #swift #time #logWithTime
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
import Foundation | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS " | |
func log_with_time(_ items: Any...) { | |
print(formatter.string(from: Date()), terminator: "") | |
for idx in items.indices { | |
print(items[idx], terminator: idx == items.count-1 ? "\n" : " ") | |
} | |
} |
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 func quadrantOf(x: Int, y: Int) -> String { | |
var quadrant = "" | |
switch (x, y) { | |
case (1..., 1...): | |
quadrant = "1" | |
case (..<0, 1...): | |
quadrant = "2" | |
case (..<0, ..<0): | |
quadrant = "3" | |
case (1..., ..<0): | |
quadrant = "4" | |
default: | |
quadrant = "boundary" | |
} | |
return quadrant | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment