首页 > 解决方案 > Swiftui 如何在 IntentHandling 中获取小部件 displaySize 信息

问题描述

我实现了动态配置信息,代码如下。

import Intents
import WidgetKit

class IntentHandler: INExtension, ConfigurationIntentHandling {
    
    func resolveTransparent(for intent: ConfigurationIntent, with completion: @escaping (INStringResolutionResult) -> Void) {
    }
    
    func provideTransparentOptionsCollection(for intent: ConfigurationIntent, searchTerm: String?, with completion: @escaping (INObjectCollection<NSString>?, Error?) -> Void) {
        //how to get widget displaySize?
    }
    
    func handle(intent: ConfigurationIntent, completion: @escaping (ConfigurationIntentResponse) -> Void){
        // This is the default implementation.  If you want different objects to handle different intents,
        // you can override this and return the handler you want for that particular intent.
    }
    
}

如何在 a 函数中获取当前编辑的小部件 displaySize 信息

标签: swiftuiwidgetios14

解决方案


推荐阅读