Home > Blockchain >  Access Project code base in SwiftUI widget extension
Access Project code base in SwiftUI widget extension

Time:11-28

I'm created a widget extension within a UIKit application, and as it's my first dive into SwiftUI I'm confused on how I can access my structs/enums and helper classes within the greater project code base.

For example, if I have a simple enum or model struct defined in my project, when I try to access these types within my widget extension file Xcode asks me to import the module from "MyApp". Yet, unfortunately this doesn't work.

I have a feeling I'm making an error of first principle in not understanding the architecture of this process and would appreciate any direction.

my goal:

use all of the helper methods and model structs defined in the global project to present data within a WidgetExtension dynamically.

CodePudding user response:

Go to the

File you want to share > File Inspector > Target Membership > Click on the widget.
  • Related