简体   繁体   English

iOS Swift Today Extension:从容器应用程序导入类?

[英]iOS Swift Today Extension: import class from container app?

I have an app with a Today widget. 我有一个带有Today小部件的应用程序。 I would like to use a model class from the container app in the TodayViewController.swift . 我想在TodayViewController.swift使用容器应用程序中的模型类。

Is such a thing possible? 这样的事情可能吗?

I copied the file into the Today Extension folder and tried to import it. 我将文件复制到Today Extension文件夹并尝试导入它。 No dice. 没有骰子。

I can't find an answer in the documentation or online. 我无法在文档中或在线找到答案。

Thanks 谢谢

You need to include the file in the target membership. 您需要将文件包含在目标成员资格中。 Select the file and then, in the right hand pane, tick the correct target. 选择文件,然后在右侧窗格中勾选正确的目标。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从应用程序中删除ios今天的扩展 - How to remove ios today extension from app (iOS Swift)在应用程序和Today Extension之间共享EKEventStore和访问 - (iOS Swift) Share EKEventStore and access between app and Today Extension 在Swift中,如何将永久变量从主iOS应用传递到扩展程序(例如,今天的扩展程序,自定义键盘) - In Swift, how would I pass a permanent variable from the main iOS app to an extension (e.g. today extension, custom keyboard) 如何从Swift的Today扩展中的父iPhone应用程序中调用方法? - How to call a method in the parent iPhone app from Today Extension in Swift? 从Swift 4中的Today扩展打开时,包含应用程序崩溃 - Containing App crashes when opened from Today extension in swift 4 如何将应用程序中的数据显示到 Today Extension Swift - How to show data from app to Today Extension Swift 从今天扩展名打开时,iOS应用程序崩溃 - iOS app crash when opened from today extension iOs - 如何使用url将数据从Widget(今日扩展)传递到App? - iOs - How to pass data from Widget (Today Extension) to App with url? 如何将UIImage快速传递给iOS中的Today扩展? - How to pass UIImage to Today Extension in iOS, swift? 今日扩展iOS 10 Swift,显示更少 - Today Extension iOS 10 Swift, Show Less
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM