[Fix] "false" utility network load problem #259
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue in the
Trace utility network
sample.In the original PR, when the sample opens, a computed property
private var network: UtilityNetwork? { map.utilityNetworks.first }
tries to get the first utility network from the web map. However, because the web map is not explicitly loaded,network
can becomenil
occasionally, depending on the load timing of the map.This leads to the problem in 4401 where the
network?.makeElement(arcGISFeature: feature)
call silently fails. A status message was added in #248 to show the error.After discussing with Jen, both the web map and the network need to be loaded. Only loading the map is not enough; only loading the network doesn't guarantee the map to be present either. Once the map is loaded, we can safely assume the utility network's description is available.
Linked Issue(s)
swift/issues/4401
How To Test
v.next
, sometimes you cannot add element to the utility network