How do you cast a UInt64 to an Int64?

前端 未结 6 1419
我在风中等你
我在风中等你 2020-12-17 23:08

Trying to call dispatch_time in Swift is doing my head in, here\'s why:

 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC), dispatch_get_mai         


        
6条回答
  •  死守一世寂寞
    2020-12-17 23:32

    simple solution for Swift 3 is an inbuilt function that takes care of overflows and buffer management.

    var a:UInt64 = 1234567890
    var b:Int64 = numericCast(a)
    

提交回复
热议问题