Hacker News new | ask | show | jobs
by kraigspear 1699 days ago
He didn't speak to why he's using NSLog. There are better alternatives that player nicer with Swift. https://developer.apple.com/documentation/os/logging
3 comments

> A few years ago Apple introduced a new logging framework called the Unified Logging System, which supports logging with variadic arguments from both Swift and Objective-C. It also supports a host of other features that allow you to categorize and prioritize your log message and, well, it sounds great, but it’s also quite a bit more complicated than just invoking NSLog. It’s complicated enough that I can’t offer a one-line fix for the situation I’ve described here, but I encourage you to investigate your options.
Unified logs are an overkill API that isn't particularly well-suited for general purpose use like NSLog is. It's really more of something Apple uses themselves that they decided to throw over the wall for third party developers to adopt, but very few have done so due to its strange interface and goals that don't match what most app developers want.
The article implies that the code was ported from objective-c to swift.