10000 class_delegate_protocol warning triggered by the Actor protocol · Issue #6054 · realm/SwiftLint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

class_delegate_protocol warning triggered by the Actor protocol #6054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bagofstars opened this issue Apr 16, 2025 · 2 comments
Open

class_delegate_protocol warning triggered by the Actor protocol #6054

bagofstars opened this issue Apr 16, 2025 · 2 comments
Labels
enhancement Ideas for improvements of existing features and rules. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.

Comments

@bagofstars
Copy link

New Issue Checklist

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
@SimplyDanny SimplyDanny added enhancement Ideas for improvements of existing features and rules. good first issue Issue to be taken up by new contributors yet unfamiliar with the project. labels Apr 17, 2025
@carloshpdoc
Copy link

Hi! I'd like to work on this issue. It's ok?

@mildm8nnered
Copy link
Collaborator

Hi! I'd like to work on this issue. It's ok?

Absolutely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.
Projects
None yet
Development

No branches or pull requests

4 participants
0