SwiftUI용 WebPage에서 didFinishNavigation을 감지하려면 어떻게 해야 해?

Asked on 2025-07-05

1 search

To detect when didFinishNavigation occurs in a SwiftUI WebPage, you can use the new observable currentNavigationEvent property on the WebPage. This property allows you to access the navigation state and respond to different navigation events, including when the navigation is complete.

Here's a brief overview of how you can achieve this:

  1. Access the Navigation State: Use the currentNavigationEvent property to observe navigation events.
  2. Use Observations API: With Swift 6.2, you can create an async sequence from currentNavigationEvent and use a loop to observe changes. This allows you to handle events like didFinishNavigation.

For more detailed guidance, you can refer to the session Meet WebKit for SwiftUI (09:48) where these concepts are discussed.