You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print("Network status changed to: \(newPath.status)")
102
102
}
103
103
}
104
104
```
@@ -115,16 +115,41 @@ let monitor = NetworkPathMonitor(debounceInterval: 1.0) // 1 second debounce
115
115
116
116
---
117
117
118
+
## Ignore First Path Update
119
+
120
+
Sometimes you may want to ignore the initial network path update that occurs when monitoring starts, especially during app launch. You can use the `ignoreFirstPathUpdate` parameter:
121
+
122
+
```swift
123
+
// Ignore the first path update when monitoring starts
124
+
let monitor =NetworkPathMonitor(ignoreFirstPathUpdate: true)
125
+
await monitor.fire() // First update will be ignored
126
+
127
+
// Useful for avoiding immediate notifications during app startup
128
+
let monitor =NetworkPathMonitor(
129
+
debounceInterval: 0.5,
130
+
ignoreFirstPathUpdate: true
131
+
)
132
+
```
133
+
134
+
This is particularly useful when:
135
+
136
+
- You want to avoid showing network status alerts immediately when the app starts
137
+
- You only care about network changes after the initial connection is established
138
+
- You're implementing features that should only respond to actual network transitions
0 commit comments