ShedSports
ShedSports

Reputation: 739

iMessage extension in swift

I want to make an iMessage app extension for my app, once I have it set up how do I use code from the actual app in the extension? Do I need to import certain files from my app?

I have App Groups set up for both Main app and iMessage extension, how can I access classes from the main app?

Upvotes: 0

Views: 531

Answers (1)

jnpdx
jnpdx

Reputation: 52416

You'll need to have any source files you want included in the extension added to the extension target (as well as the app target, if they're shared).

One way to do this:

  1. Go to the View menu in Xcode and select Inspectors -> File.

  2. Navigate to whichever file you want to add to the extension, and then in the File Inspector (which should be visible in the right-hand sidebar), make sure the target for your extension is selected under "Target Membership"

enter image description here

Upvotes: 1

Related Questions