swiftswiftui

Handle view load time and print out results


So I am in the phase of my iOS SwiftUI app where I am going through and checking to improve performance and such, are there any tools or any way for me to track View load times and print them out?

Example:

struct ContinueWithGoogleView: View {
    var body: some View {
        GoogleSignInButton()
            .accessibilityIdentifier("GoogleSignInButton")
            .accessibility(hint: Text("Sign in with Google button."))
    }
}

ContinueWithGoogleView() took 9.27364ms to load view, etc..


Solution

  • You can use Xcode Profile for these operations. There is a good guideline for here.

    Time Profiler is what you are looking for.

    I recommend you to look at Xcode Instruments for different processes that will develop your application like Allocations and controlling memory leaks