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 (将#修改为@)