Skip to content

Commit cbcf585

Browse files
committed
Refactor how the UN is got.
1 parent fa54f20 commit cbcf585

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Shared/Samples/Display content of utility network container/DisplayContentOfUtilityNetworkContainerView.Model.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ extension DisplayContentOfUtilityNetworkContainerView {
5555
}()
5656

5757
/// The utility network for this sample.
58-
private var network: UtilityNetwork!
58+
private var network: UtilityNetwork {
59+
map.utilityNetworks.first!
60+
}
5961

6062
// MARK: Methods
6163

6264
/// Loads the utility network.
6365
func loadUtilityNetwork() async throws {
6466
// Gets and loads the first utility network from the web map.
65-
network = map.utilityNetworks.first!
67+
try await map.load()
6668
try await network.load()
6769
}
6870

Shared/Samples/Display content of utility network container/DisplayContentOfUtilityNetworkContainerView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ struct DisplayContentOfUtilityNetworkContainerView: View {
8484
.task {
8585
// Loads the utility network from the web map.
8686
do {
87-
try await model.map.load()
8887
try await model.loadUtilityNetwork()
8988
model.statusMessage = "Tap on a container to see its content."
9089
} catch {

0 commit comments

Comments
 (0)