I have an existing app and want to create a iMessage extension.
So I have added target iMessage Extension in in my project. Now I want to show my existing view in that extension via container view. I have added code :
let mainBundle = Bundle(identifier:"com.marvel.nearby")
print("MAIN_BUNDLE : \(mainBundle)") // getting nil
let storyboard = UIStoryboard(name: "Main", bundle: mainBundle)
let viewController = storyboard.instantiateViewController(withIdentifier: "MResourcesVC")
self.showViewControllerInContainerView(viewController)
in Swift iMessage extension class : MessagesViewController.swift
but getting nil. What should I do?
If this way is wrong what is the correct way to show viewcontroller in iMessage extension.
You have to add the storyboard.storyboard
file to your target:
To get the right bundle, use:
Bundle(for: type(of: self))