Want to compare CMTime
and based on that I am performing loop. Converting ObjectiveC
to Swift
, I can't found suitable method for CMTIME_COMPARE_INLINE
.
CMTime oneSecond = CMTimeMake( 1, 1 );
CMTime oneSecondAgo = CMTimeSubtract( timestamp, oneSecond );
while( CMTIME_COMPARE_INLINE( [_previousSecondTimestamps[0] CMTimeValue], <, oneSecondAgo ) ) {
[_previousSecondTimestamps removeObjectAtIndex:0];
}
Has anybody face this similar issue in any version of Swift
?
CMTime
is imported as aComparable
type in Swift 3, so, you have no need to useCMTIME_COMPARE_INLINE
.Assuming
_previousSecondTimestamps
is of type[CMTime]
(*1), you can write something like this in Swift 3:*1 In Swift, you can declare an Array of
CMTime
directly, you have no need to useNSMutableArray
containingNSValue
.