We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 91e4560 + 9aea01b commit 0b2a7d7Copy full SHA for 0b2a7d7
Sources/ArcGISToolkit/Components/BasemapGallery/BasemapGalleryViewModel.swift
@@ -89,7 +89,12 @@ import ArcGIS
89
@Published private(set) var currentItem: BasemapGalleryItem? = nil {
90
didSet {
91
guard let item = currentItem else { return }
92
- geoModel?.basemap = item.basemap
+ // If the portal is nil, the user passed in their own array
93
+ // of basemaps, so clone the selected one prior to setting. This
94
+ // prevents the "Object already owned" error.
95
+ // If portal is non-nil, there's no need to clone the basemap
96
+ // as the list of basemaps is reloaded from the portal each time.
97
+ geoModel?.basemap = portal == nil ? item.basemap.clone() : item.basemap
98
}
99
100
0 commit comments