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-1514] impossible to adopt WKScriptMessageHandler protocol #44123

Closed
mattneub opened this issue May 13, 2016 · 4 comments
Closed

[SR-1514] impossible to adopt WKScriptMessageHandler protocol #44123

mattneub opened this issue May 13, 2016 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mattneub
Copy link

Previous ID SR-1514
Radar rdar://problem/26313044
Original Reporter @mattneub
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Toolchain: Swift Development Snapshot 2016-05-09 (a)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: f72b7fd1f83b5b9cc15520535500db4c

is duplicated by:

  • SR-1518 cannot implement tableView:cellForRowAtIndexPath: in Swift 3
  • SR-1523 cannot implement GLKViewDelegate in Swift 3
  • SR-1526 Swift 3 can't implement EKEventViewDelegate, EKEventEditViewDelegate
  • SR-1527 cannot implement QLPreviewControllerDataSource

Issue Description:

The WebKit WKScriptMessageHandler protocol has one required method, defined like this in Objective-C

- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message;

and like this in Swift

public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)

Unfortunately, no matter how I write this method in my actual code, the compiler complains either that it doesn't match the argument names or that I'm not conforming to the protocol. Example:

extension ViewController : WKScriptMessageHandler {
    func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
        
    }
}

That doesn't compile. It should.

Moreover, no amount of playing with `@objc` overrides helps. I can't seem to find any workaround, so this project is currently out of action...

I enclose a small test project for you to play with.

@belkadan
Copy link
Contributor

Should be fixed in master as e003e5e, though I haven't tested with this project (or dups) yet. Will work on getting it into the Preview 1 branch tomorrow.

@belkadan
Copy link
Contributor

#2604

@belkadan
Copy link
Contributor

Merged for preview 1!

@mattneub
Copy link
Author

mattneub commented Jun 3, 2016

Confirmed, this is fixed in toolchain released May 31.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants