Monday, June 27, 2011

Milli Seconds calculation

       // Start timer
    NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
   
      // Do something
    for(double i=0; i < 1000000; i++ );
   
       // Stop timer
    NSTimeInterval endTime = [NSDate timeIntervalSinceReferenceDate];
   
       // Get the elapsed time in milliseconds
    NSTimeInterval elapsedTime = (endTime - startTime) * 1000;

       // Send it to the Console
    NSLog(@"Elapsed time in ms: %f", elapsedTime);

No comments:

Create a list in SwiftUI with sticky section headers

 Sample Code import SwiftUI struct ContentView : View {     @State var isCustomViewControllerDisplayed = false     @State private va...