Swift Spinner在队列任务完成之前消失

时间:2020-08-30 10:10:59

标签: swift

这是我的头脑。我试图显示微调器,然后在执行任务后将其删除。

不幸的是,微调器删除代码在任务完成之前执行。任何帮助将不胜感激。

<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!, long: longitude!, elev: elev, aircraft: airframe!)
            case .F_18:
                dcsBIOSConn.configureWaypoint(lat: latitude!, long: longitude!, elev: elev, aircraft: airframe!)
            case .AV_8B:
                dcsBIOSConn.configureWaypoint(lat: latitude!, long: longitude!, elev: elev, 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.删除文本微调框应位于最后。有想法吗?

0 个答案:

没有答案