0

I have an iOS app with a Share Extension.

The main class of the Share Extension inherits the SLComposeServiceViewController, and in the Storyboard, I have checked "Is initial view controller". However, I need another custom view to render with more options before eventually launching the Share Extension.

I added an additional ViewController in the Storyboard and added a button inside a container. This "Share" button should launch the original Share Extension, Share View Controller Scene

Storyboard

I added a UIViewController class, ActionsMenuController, and set that as a custom class for Àction Menu Controller.

class ActionMenuController: UIViewController {
    @IBAction func launchShareExtension(_ sender: Any) {
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

Somehow, I need to make the button's action function, launchShareExtension, switch scenes to the Share View Controller.

It seems as I should use segues to perform this, but I haven't found a way to define a segue identifier for my Share View Controller

Are there any other ways of launching a ViewController or SLComposeServiceViewController, or is there a way to achieve this using segues?

ZGski
  • 2,398
  • 1
  • 21
  • 34
Rasmus Puls
  • 3,009
  • 7
  • 21
  • 58

1 Answers1

0

I found out that adding a segue between a normal UIViewController and SLComposeServiceViewController can be done directly in the storyboard editor, but click+ctrl on the button and drag the appearing blue line to the Share View Controller Scene. A small segue option menu will appear, choose show which will launch and share extension and replace the action menu.

enter image description here

I found inspiration in this storyboard tutorial about half way through. It covers the most basics in storyboard editing.

Rasmus Puls
  • 3,009
  • 7
  • 21
  • 58