Ios 如何通过segue将NSTimeInterval值从swift传递到目标C
我在Swift中得到了一个值:Ios 如何通过segue将NSTimeInterval值从swift传递到目标C,ios,objective-c,swift,Ios,Objective C,Swift,我在Swift中得到了一个值: var diff:NSTimeInterval! Cannot assign a value of type 'NSTimeInterval' to a value of type 'UnsafeMutablePointer<NSTimeInterval>' 我把它传给目标C班: var destVC:ProgressViewController = segue.destinationViewController as! ProgressViewC
var diff:NSTimeInterval!
Cannot assign a value of type 'NSTimeInterval' to a value of type 'UnsafeMutablePointer<NSTimeInterval>'
我把它传给目标C班:
var destVC:ProgressViewController = segue.destinationViewController as! ProgressViewController //as! UIViewController
destVC.seconds = self.diff!
下面接受该值的变量位于目标C中:
@property (nonatomic) NSTimeInterval *seconds;
但我在Swift中发现了一个错误:
var diff:NSTimeInterval!
Cannot assign a value of type 'NSTimeInterval' to a value of type 'UnsafeMutablePointer<NSTimeInterval>'
无法将类型为“NSTimeInterval”的值分配给类型为“UnsaFemeutablePointer”的值
任何帮助都将不胜感激。使用
NSTimeInterval秒
和noNSTimeInterval*秒
,删除*
NSTimeInterval实际上是一个typedef到double的值。它不是对象,因此不需要为其属性添加指针
@property (nonatomic) NSTimeInterval seconds;
谢谢你为我节省了时间!