-1

I am using Amplify, which I installed through cocoapods and it works fine in my "regular" iOS application in Swift. I have now created a Widget Extension, inside of which I would also like to use Amplify. I have tried adding Widget.swift to the main app's target, but that didn't let me compile because now there were two @main structs. (For the app & for the widget) Is there a way to import Amplify and use it in WidgetKit?

Florian S
  • 552
  • 3
  • 15

1 Answers1

3

Edit your Podfile to apply Pod for all targets: application & widget. Ex:

def workspace_pods
  pod 'YourPod'
end

target 'YourApplication' do
  use_frameworks!
  workspace_pods
end

target 'YourWidget' do
  use_frameworks!
  workspace_pods
end
Ralph Ng
  • 51
  • 4