Hi community, during SE-0196 I said that it would be really cool if we would eventually extend the language to emit runtime issues triggered by some compiler diagnostic directives.
This idea intrigued a few of the community members and even the core team mentioned it in the rationale:
Now I had the chance to watch the following WWDC session 'Debugging with Xcode 11'. I noticed that SwiftUI provides custom 'runtime issues' similar to the idea mentioned above.
Let's bump this thread. Is there a chance we could possibly get this feature rolling? Maybe it's now the right time as we are currently discussing the concrete implementation for these directives as macros. (cc @Douglas_Gregor again)
Today I think this feature should be standalone and not tied to the directives. It should be something lightweight and on par with assert but without a failure. Maybe some kind of global emit function with parameters similar to print?
As the resources shared by @gwendal.roue indicate, runtime warnings occur by a call to the logging framework. However, instead of using your app's DSO handle, you use one of the Apple-internal frameworks, such as SwiftUI or Foundation.