类型“ Double”的值?没有成员“相乘”

时间:2019-05-10 15:34:30

标签: swift

迁移到Swift 5后,我在第三方代码中遇到此错误。这是什么意思,我该如何解决?

/**
The timer's execution interval, in seconds.
*/
public let interval: Double!

/**
 *Starts the timer.
 * parameter now:     true, if the timer should fire immediately.
 */
open func start(_ now: Bool) {
    validate()
    if OSAtomicCompareAndSwap32Barrier(State.paused, State.running, 
        &running) {
        timer.scheduleRepeating(deadline: startTime(interval, now: 
        now), interval: 
        DispatchTimeInterval.nanoseconds(Int(interval.multiplied(by: 
        Double(NSEC_PER_SEC))))) // Swift Compiler Error here
        timer.resume()
    }
}

1 个答案:

答案 0 :(得分:0)

使用间隔*替换乘以(by:

    timer.scheduleRepeating(deadline: startTime(interval, now: now), interval: DispatchTimeInterval.nanoseconds(Int(interval * Double(NSEC_PER_SEC))))