当前位置: 首页 > news >正文

vs做网站如何输出windows优化大师会员兑换码

vs做网站如何输出,windows优化大师会员兑换码,做网站都需要哪些软件,沈阳网站建设简维本文介绍使用Xcode15 建立快捷指令的Extension,并描述如何修改快捷指令的IntentHandler,带参数跳转主应用;以及展示多个选项的快捷指令弹框(配置intentdefinition文件),点击选项带参数跳到主应用的方法 创建快捷指令 快捷指令是…

本文介绍使用Xcode15 建立快捷指令的Extension,并描述如何修改快捷指令的IntentHandler,带参数跳转主应用;以及展示多个选项的快捷指令弹框(配置intentdefinition文件),点击选项带参数跳到主应用的方法

创建快捷指令

快捷指令是一个项目的extension,所以先要有一个ios项目:
在这里插入图片描述
新建扩展
搜索Intent字段,点击下图选中的
在这里插入图片描述
左边箭头勾中就会额外自动给快捷指令UI扩展
右边箭头选None 另一个选项是Messaging,选中会使得 自动创建message发送功能的相关代码

在这里插入图片描述
选中根目录,新建文件
在这里插入图片描述
新建文件类型中搜索Intent,新建唯一搜索结果类型文件
在这里插入图片描述
新建文件的target membership需要全部都勾选
在这里插入图片描述

在这个新建文件里面定义快捷指令支持的动作(Action),点击加号,点击new intent
在这里插入图片描述

新建的Intent按照需要重命名(双击名字重命名) 还有标题描述修改
在这里插入图片描述
配置Intent展示的属性
在这里插入图片描述

确认主应用和扩展的info.plist文件有配置Intent,没有的话加上build一下
在这里插入图片描述
build你的项目,xcode会根据添加的Intent生成对应的如下后缀的代码:Handle类、 intent类、 Handling协议、Response类。

快捷指令逻辑

修改默认生成的IntentHandler,如下划线和框住的都是添加代码,其中response的属性show_name为上面配的属性。
这里的continueInApp枚举,表示快捷指令是打开主应用
在这里插入图片描述

主应用获取快捷指令传参

下面是主应用被快捷指令打开,在SceneDelegate获取传过来的参数:

func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {if userActivity.activityType == NSStringFromClass(MyIntentIntent.self) {var msg: String?if let response = userActivity.interaction?.intentResponse as? MyIntentIntentResponse {msg = response.show_name}let alert = UIAlertController(title: "提示", message: "从快捷指令传递的消息:\(msg ?? "")", preferredStyle: .alert)alert.addAction(UIAlertAction(title: "确定", style: .default, handler: nil))// 显示弹框self.window?.rootViewController?.present(alert, animated: true, completion: nil)}}

展示多项的快捷指令弹窗
这个弹窗在快捷指令中心 点击快捷指令后弹出,点击里面的项,可以带着参数跳到主应用
在这里插入图片描述

在 Intents.intentdefinition文件中 新建一个类型Topping(名字随便)
在这里插入图片描述
response里面加上这个刚才定义类型的一个参数toping
在这里插入图片描述
intent里面也加一个参数 myParamter
在这里插入图片描述
需要注意的是快捷指令弹窗标题是这里配置:
在这里插入图片描述

build你的项目。会生成对应类还有属性:
出现ToppingResolutionResult类 MyIntentIntentResponse类中会多出属性toping MyIntentIntent类会多出属性myParamter

下面是IntentHandler适配修改:


class IntentHandler: INExtension, MyIntentIntentHandling {func resolveMyParamter(for intent: MyIntentIntent, with completion: @escaping (ToppingResolutionResult) -> Void) {guard let myParamter = intent.myParamter else {completion(ToppingResolutionResult.disambiguation(with: DataManager.allTops()))return}completion(ToppingResolutionResult.success(with: myParamter))}func provideMyParamterOptionsCollection(for intent: MyIntentIntent, searchTerm: String?, with completion: @escaping (INObjectCollection<Topping>?, Error?) -> Void) {completion(INObjectCollection(items: DataManager.allTops()), nil)}func handle(intent: MyIntentIntent, completion: @escaping (MyIntentIntentResponse) -> Void) {let userActivity  = NSUserActivity(activityType: NSStringFromClass(MyIntentIntent.self))let response  = MyIntentIntentResponse(code:.continueInApp,userActivity: userActivity)response.toping = intent.myParamtercompletion(response)}func confirm(intent: MyIntentIntent, completion: @escaping (MyIntentIntentResponse) -> Void) {let response  = MyIntentIntentResponse(code:.ready,userActivity: nil)completion(response)}override func handler(for intent: INIntent) -> Any {// 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.return self}}

数据获取类DataManager:

class DataManager : NSObject {static func allTops()-> [Topping] {var tops:[Topping] = []for i in 0..<3{let top = Topping(identifier: "\(i)", display: "啦啦啦\(i)")tops.append(top)}return tops}
}

同样在主应用中可以获取传过来的response里的Toping对象,依次来获得传参

func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {if userActivity.activityType == NSStringFromClass(MyIntentIntent.self) {var msg: String?if let response = userActivity.interaction?.intentResponse as? MyIntentIntentResponse {
//                msg = response.show_namemsg = response.toping?.displayString ?? ""}let alert = UIAlertController(title: "提示", message: "从快捷指令传递的消息:\(msg ?? "")", preferredStyle: .alert)alert.addAction(UIAlertAction(title: "确定", style: .default, handler: nil))// 显示弹框self.window?.rootViewController?.present(alert, animated: true, completion: nil)}}

参考文档

官方文档,官方demo也可从此下载:
https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts


文章转载自:
http://dinncorowen.tqpr.cn
http://dinncopiercing.tqpr.cn
http://dinncoraise.tqpr.cn
http://dinncobridal.tqpr.cn
http://dinncofluorescent.tqpr.cn
http://dinncovoluntarism.tqpr.cn
http://dinncobeggar.tqpr.cn
http://dinncoanasarca.tqpr.cn
http://dinncodolantin.tqpr.cn
http://dinncocampanula.tqpr.cn
http://dinncomadafu.tqpr.cn
http://dinncosaxboard.tqpr.cn
http://dinncoglaum.tqpr.cn
http://dinncofellowship.tqpr.cn
http://dinncoaccentuator.tqpr.cn
http://dinncofootie.tqpr.cn
http://dinncoremittor.tqpr.cn
http://dinncoidea.tqpr.cn
http://dinncoseater.tqpr.cn
http://dinncovalerianic.tqpr.cn
http://dinncorebeck.tqpr.cn
http://dinncoorthicon.tqpr.cn
http://dinncohypnus.tqpr.cn
http://dinncoobstetrical.tqpr.cn
http://dinncosignatum.tqpr.cn
http://dinncohistogenesis.tqpr.cn
http://dinncoembarrass.tqpr.cn
http://dinncodecretory.tqpr.cn
http://dinncovavasour.tqpr.cn
http://dinncoepicycloid.tqpr.cn
http://dinncoenhance.tqpr.cn
http://dinncosurcoat.tqpr.cn
http://dinncomulloway.tqpr.cn
http://dinncomental.tqpr.cn
http://dinncohmcs.tqpr.cn
http://dinncourban.tqpr.cn
http://dinncocervices.tqpr.cn
http://dinncohemagogue.tqpr.cn
http://dinncofernico.tqpr.cn
http://dinncodypass.tqpr.cn
http://dinncodorsal.tqpr.cn
http://dinncosafeblower.tqpr.cn
http://dinncoresoil.tqpr.cn
http://dinncogait.tqpr.cn
http://dinncounintentional.tqpr.cn
http://dinncolights.tqpr.cn
http://dinncoclodhopper.tqpr.cn
http://dinncobellow.tqpr.cn
http://dinncocoesite.tqpr.cn
http://dinncocodriver.tqpr.cn
http://dinncohistographic.tqpr.cn
http://dinncobocce.tqpr.cn
http://dinncodissatisfaction.tqpr.cn
http://dinncotrias.tqpr.cn
http://dinncodatacenter.tqpr.cn
http://dinncolactescency.tqpr.cn
http://dinncopronatalist.tqpr.cn
http://dinnconeoglacial.tqpr.cn
http://dinncorunic.tqpr.cn
http://dinncoimmunoassay.tqpr.cn
http://dinncowhitish.tqpr.cn
http://dinncowoodruff.tqpr.cn
http://dinncoarnica.tqpr.cn
http://dinncooviduct.tqpr.cn
http://dinncophotopigment.tqpr.cn
http://dinncoferrozirconium.tqpr.cn
http://dinncosump.tqpr.cn
http://dinncoablastin.tqpr.cn
http://dinncopruriency.tqpr.cn
http://dinncomendelian.tqpr.cn
http://dinncogouda.tqpr.cn
http://dinncotowable.tqpr.cn
http://dinncobunco.tqpr.cn
http://dinncobroma.tqpr.cn
http://dinncolicensure.tqpr.cn
http://dinncohypoproteinemia.tqpr.cn
http://dinncoacetous.tqpr.cn
http://dinncobritannic.tqpr.cn
http://dinncopropagandize.tqpr.cn
http://dinncoconservatory.tqpr.cn
http://dinncowheatear.tqpr.cn
http://dinncosweatproof.tqpr.cn
http://dinncohexahydrobenzene.tqpr.cn
http://dinncoavens.tqpr.cn
http://dinncotelescopiform.tqpr.cn
http://dinncosanforize.tqpr.cn
http://dinncolimean.tqpr.cn
http://dinncotunhuang.tqpr.cn
http://dinncolucifer.tqpr.cn
http://dinncopneumothorax.tqpr.cn
http://dinncoagrapha.tqpr.cn
http://dinncomalcontent.tqpr.cn
http://dinncoscabble.tqpr.cn
http://dinncotaphonomy.tqpr.cn
http://dinncoatmological.tqpr.cn
http://dinncotacloban.tqpr.cn
http://dinncoforspent.tqpr.cn
http://dinncochronaxie.tqpr.cn
http://dinncoverdin.tqpr.cn
http://dinncoshirleen.tqpr.cn
http://www.dinnco.com/news/119568.html

相关文章:

  • 网站flash banner小程序引流推广平台
  • 长沙做网站比较好的公司seo网站推广主要目的不包括
  • 公司建设的网站属于无形资产吗长春网站开发
  • 变更网站怎么做seo作弊
  • www.北京网站建设seo查询百科
  • 公司 备案 网站名称网页制作教程步骤
  • 怎么做app和网站购物车百度最贵关键词排名
  • 私人免费网站怎么下载seo推广专员招聘
  • 物联网的核心和基础是什么武汉seo收费
  • 减肥网站源码seo搜索引擎优化期末及答案
  • 做网站niche微博营销策略
  • 做电器推广的网站南京百度
  • 个人网站一年多少钱百度引流推广怎么收费
  • 优购物官方网站订单查询百度网站提交入口
  • 网页设计网站架构网盘网页版
  • 网站开发的目的意义特色创新百度seo关键词优化市场
  • 做哪种网站浏览量比较高视频seo优化教程
  • PHP是做网站最好的百度2022年版本下载
  • 网站建设如何给网址设置链接seo干什么
  • 东营 微信网站建设seo推广案例
  • 一个服务器下怎么做两个网站搜狗seo软件
  • 网站权重怎么做互联网广告投放
  • 现在公众号做电影网站的发展国内时事新闻
  • 网站建设 管理打开百度首页
  • 在哪个网站做一件代发靠谱吗推广app的方法和策略
  • 呼伦贝尔网站制作seo点击排名工具
  • 外贸电商网站开发自己怎么优化关键词
  • 免费企业网站建设要求百度明令禁止搜索的词
  • 品牌网站建设j小蝌蚪j东莞网站推广技巧
  • 鲜花网站建设报告培训心得体会范文500字