Share image from main app to imessage extension and vice versa in swift

I want to fetch a image from main app and share this image via iMessage extension.iMessage has created new target.So how to share this image from main app to this new iMessage extension as both have two different targets in same application.