Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Access Project code base in SwiftUI widget extension

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

my goal:

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

>Solution :

Go to the

File you want to share > File Inspector > Target Membership > Click on the widget.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading