Swift 6.4 introduces the diagnose attribute, which provides developers with fine-grained control over compiler diagnostics by allowing specific diagnostic IDs (such as deprecated declarations or unused variables) to be configured as ignored, warning, or error, enabling more flexible error handling than the previous all-or-nothing approach.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
What's new in Swift 6.4? | Diagnose Attribute
Added:What is new in Swift 6.4? Part 2.
>> Swift 6.4 introduced a new attribute called diagnose, giving developers fine-grained control over compiler diagnostics. Let's look an example.
Here, we have some code running in a project configured to treat all deprecated warnings as errors. While that's generally a good practice, there are some situations where we might want a little more flexibility. Before diagnose, this was impossible. It was all or nothing. But, take a look at what happens when we add this attribute. In this case, I'm using the deprecated declaration diagnostic ID, which detects the use of deprecated APIs. The second parameter can be configured as ignored, which suppressed the diagnostic entirely, warning, which emits a warning, or error, which blocks compilation until the issue is resolved.
Here's another example, this time using the no usage diagnostic ID, which detects variables that are declared but never used. Those are just two examples, but Apple actually added many more diagnostic IDs for different situations.
The problem is that at the time I'm recording this video, there's almost no documentation about them. So, I dug through the Swift source code myself and put together a post explaining every diagnostic group currently available.
Link in the description.
>> And if you want to learn more Swift, subscribe.
Related Videos
LBF101 Creating an XML Changelog
liquibase7511
3K views•2026-06-15
Alta Labs Cloud Dashboard Real time Network & Xnet Insights!
ShinyTechThings
158 views•2026-06-17
Wait... Group Policy Not Applying? Check This First!
keeplearning_iT
144 views•2026-06-15
Leetcode Weekly Contest 506 | Life's boring these days
Pudeesht
2K views•2026-06-14
microJAM: MAKING A MICRO GAME FOR A GAME JAM IN CLOJURESCRIPT AND TOTALLY NOT C
janetacarr
156 views•2026-06-18
Partitioning vs Bucketing vs Clustering: How to Make Queries 100x Faster
thedataandaiguy
194 views•2026-06-16
Design Claude Code Like a Senior Engineer
hayk.simonyan
344 views•2026-06-19
Linus Torvalds: AI Won’t Replace Understanding Code
SavvyNik
140 views•2026-06-19











