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

Share action sheet in Safari #6

Closed
filimo opened this issue Sep 25, 2019 · 0 comments
Closed

Share action sheet in Safari #6

filimo opened this issue Sep 25, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@filimo
Copy link
Owner

filimo commented Sep 25, 2019

Description:

Add app button to share actions sheet in Safari

Articles

How to use NSSharingService in Catalyst? my post in stackoverflow.com
Creating a Custom macOS Sharing Service in Swift
How to show the share button in Mountain Lion?

Все, что нужно знать об iOS App Extensions
Library? Static? Dynamic? Or Framework? Project inside another project
Bundles and Packages

Beyond the Checkbox with Catalyst and AppKit
IOS CBL and Catalyst
Ultimate Catalyst Guide
Taking iPad Apps for Mac to the Next Level

Binary Frameworks in Swift
XCFrameworks Internals

Build iOS&osX XCFramework

xcodebuild archive -scheme "CBL Swift" -destination "generic/platform=OS X" -destination "generic/platform=ios" -destination "generic/platform=iOS Simulator" SKIP_INSTALL=NO

iOS->framework

public protocol ReaderTranslatorCommonInterfaces {
    func test() -> String
}

macOS->bundle

Info.plist -> Principal class = ReaderTranslatorAppKit.ReaderTranslatorAppKit
open class ReaderTranslatorAppKit: ReaderTranslatorCommonInterfaces {
    public func test() -> String {
        "test 1"
    }
}

import AppKit

extension NSSharingService {
    class func shareContent ( content: [AnyObject], button: NSButton ) {
        let sharingServicePicker = NSSharingServicePicker (items: content )

        sharingServicePicker.showRelativeToRect(button.bounds, ofView: button, preferredEdge: NSRectEdge.MaxY)
}

}

ReaderTranslator

ReaderTranslator -> Build Phases -> Copy Bundle Resources -> ReaderTranslatorAppKit.bundle
ReaderTranslator -> Signing -> Team -> Viktor Kushnerov
if let bundlePath = Bundle.main.path(forResource: "ReaderTranslatorAppKit", ofType: "bundle"),
    let bundle = Bundle(path: bundlePath) {
    
    bundle.load()

    if let cls = bundle.principalClass as? NSObject.Type,
        let plugin = cls.init() as? ReaderTranslatorCommonInterfaces {
        print(plugin.test())
    }
    print(bundle)
}
@filimo filimo added the enhancement New feature or request label Sep 25, 2019
@filimo filimo self-assigned this Sep 25, 2019
@filimo filimo changed the title Open a web page from Safari through Share Open a web page through share sheet action in Safari Sep 28, 2019
@filimo filimo changed the title Open a web page through share sheet action in Safari Share action sheet in Safari Sep 29, 2019
@filimo filimo mentioned this issue Sep 30, 2019
11 tasks
@filimo filimo closed this as completed Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant