Skip to content
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

[SR-200] Remove @objc requirement for specifying optional protocol methods #42822

Open
swift-ci opened this issue Dec 12, 2015 · 2 comments
Open
Labels
compiler The Swift compiler in itself improvement

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-200
Radar None
Original Reporter arthur (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 1
Component/s Compiler, Standard Library
Labels Improvement
Assignee None
Priority Medium

md5: 295aff435f019895cd28d9719bbf68f1

Issue Description:

The Swift Programming Language states that the @objc attribute is required when declaring optional methods in a protocol.

I'm assuming it has to do with ObjC interoperability. I'd love to know about the reasoning behind this implementation as well.

If this is something that is surmountable, I'd love if that requirement could be removed in a future version of Swift.

@swift-ci
Copy link
Collaborator Author

Comment by Aaron Brager (JIRA)

There's some discussion about this here: http://thread.gmane.org/gmane.comp.lang.swift.evolution/13347

I think the consensus is that there's already a few ways to do that:

  • use protocol extensions to create a no-op implementation for the optional items

  • make a separate protocol for the optional items

  • use some other type (like an optional closure) to optionally coordinate behavior with another type

@Dante-Broggi
Copy link
Contributor

Can this be closed as "Won't Do"?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@Azoy Azoy removed the standard library Area: Standard library umbrella label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

3 participants