Writing an iOS 8 share extension without a storyboard

前端 未结 4 1239
慢半拍i
慢半拍i 2020-12-25 12:36

Does anyone know of a good way to write an iOS 8 share extension without the MainInterface.storyboard that comes with the template?

When I delete the fi

4条回答
  •  礼貌的吻别
    2020-12-25 13:18

    Figured it out!

    Turns out there's a weird module naming thing going on in Swift, so you can fix it by adding an @objc name to the class:

    @objc(PrincipalClassName)
    
    class PrincipalClassName: UIViewController {
    ...
    

    and then set the NSExtensionPrincipalClass key to PrincipalClassName.

提交回复
热议问题