如何解决Swift Spinner在队列任务完成之前消失
不幸的是,微调器删除代码在任务完成之前执行。任何帮助将不胜感激。
<script>
import { gameState } from './store.js'
const { preGame,inGame,postGame } = gameState
</script>
<span>Current State: {$gameState}</span>
{#if preGame}<span>PRE_GAME</span>{/if}
{#if inGame}<span>IN_GAME</span>{/if}
{#if postGame}<span>POST_GAME</span>{/if}
产生此结果
dispatchQueue.global(qos: .utility).async { [weak self] in // Create a new queue for our networking activity
guard let self = self else {
return
}
switch airframe{
case .A_10:
dcsBIOSConn.configureHawgWaypoint(name: name,lat: latitude!,long: longitude!,elev: elev,tot: timeOnTarget)
case .F_16:
dcsBIOSConn.configureWaypoint(lat: latitude!,aircraft: airframe!)
case .F_18:
dcsBIOSConn.configureWaypoint(lat: latitude!,aircraft: airframe!)
case .AV_8B:
dcsBIOSConn.configureWaypoint(lat: latitude!,aircraft: airframe!)
default:
break
}
dcsBIOSConn.printMessageQueue()
print("1. Entering Queue")
let biosQueue = dispatchQueue(label: "dcs_bios")
biosQueue.async {
dcsBIOSConn.sendMessageQueuetoDCSBIOS()
}
print("2. Finishing Out of Loop")
// Send the designated coord to the CDU radio.
dispatchQueue.main.async { [weak self] in // Update the spinner on the main thread.
self?.removeSpinner()
//ERProgressHud.sharedInstance.hide()
print("3. Remove Spinner")
}
}
标记为1,2,3的文本均在任务开始发送文本之前执行。 3.删除文本微调框应位于最后。有想法吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。