SwiftLint
SwiftLint copied to clipboard
class_delegate_protocol warning triggered by the Actor protocol
New Issue Checklist
- ✅ I've Updated SwiftLint to the latest version.
- ✅ I've searched for existing GitHub issues.
Bug Description
class_delegate_protocol doesn't recognize the Actor protocol as suitable for being weakly referenced.
protocol FooDelegate: Actor { }
actor Bar {
weak var delegate: (any FooDelegate)? // raises warning: Class Delegate Protocol Violation: Delegate protocols should be class-only so they can be weakly referenced (class_delegate_protocol)
}
Since Actor protocol already conforms to AnyObject I believe it can also be whitelisted.
Bonus idea for further consideration: how about renaming the rule into reference_type_delegate_protocol? (I don't have a strong opinion about this one.)
Environment
- SwiftLint version: 0.59.1
- Xcode version: 16.3
- Installation method used: Homebrew
Hi! I'd like to work on this issue. It's ok?
Hi! I'd like to work on this issue. It's ok?
Absolutely!
Has there been any progress on this issue? (@carloshpdoc)