Capture of ‘self’ with non-sendable type ‘Type?’ in a `@Sendable` closure

  Kiến thức lập trình

I have a warnings ‘Capture of ‘self’ with non-sendable type ‘Type?’ in a @Sendable closure‘ for this code

func launchPairingAtCorrectStepAfter(timeout: TimeInterval) {
        Timer.scheduledTimer(withTimeInterval: connexionTimeout, repeats: false, block: { [weak self] _ in
            self?.launchPairingAtCorrectStep()
        })
    }

I have been trying to resolve it with Task{ @MainActor }

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT