2

I am implementing share extension functionality in iOS app. I am able to use "NSExtensionPrincipalClass" in share extension's Info.plist file. And I have added custom MyViewController i.e.

import UIKit
@objc(MyViewController)

class MyViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        print("My view loaded!!!!")
        // Do any additional setup after loading the view.
    }
}

I have created storyboard with "MyViewController" and it's sample UI.

How do I show UI from storyboard created for "MyViewController".?

When I run the app it prints "My view loaded!!!!" but not able to bind to UI i.e. UI is blank. How do I set UI for MyViewController from storyboard?

RohitK
  • 1,444
  • 1
  • 14
  • 37

1 Answers1

3

You need to replace NSExtensionPrincipalClass with NSExtensionMainStoryboard:

NSExtensionMainStoryboard

String - iOS, macOS. Specifies the name of the app extension’s main storyboard file, minus the .storyboard filename extension. This key, if used, must be placed as an immediate child of the NSExtension key.

Community
  • 1
  • 1
jjrscott
  • 1,386
  • 12
  • 16