native cocoa views in safari

I want to discuss possibility of using native cocoa views on top of safari web content.

Apple is clear, that safari app extensions are the future of safari extensions and they already replaced some of its parts to be more native to macOS:

  • Global javascript space is replaced by native objc/swift application.
  • Introduced native cocoa views inside a popup.

But what if your view depends on the context and certain position in page ?

Well, for now you're good to go with injected scripts and do js magic inside. You're pretty much out of choice here and you'll need to modify document DOM by appending nodes, apply css to achieve what you want.

Sometimes this ends up wrong, because main page native scripts could detect DOM changes and treat them the way it is originally intended (redirects, blocks, throws alerts and so on). The fact is, that such modifications could brake page functionality without developer knowing it or mess how it looks.

I see it as a potential place for conflict between user->apple<->developer.

IMHO web page should be left intact.


Would'nt it be great if you could present native cocoa view according to context ?

Advantaged are clear

  • native cocoa
  • native objc/swift code
  • you're guaranteed you did not mess web content
  • works on any page, HTML 4.01... 🙂


Hope, You and Apple liked the idea.

We could definitely take advantage of such feature.

What Apple things about this ?