opened
onepointsixtwo
username_0
The documentation states that the MaplyVectorObject should have a userObject property to help identify it on selection etc., but it doesn't appear to actually exist in the latest version. Has this changed name, or is there another method of identifying your Vector objects on selection now?
iOS: MaplyVectorObject.userObject is documented but doesn't exist
issue
created
mousebird
username_1
Thanks for the note about the documentation.

The preferred way to identify a VectorObject is to put an attribute in the attribute dictionary.
comment
created
onepointsixtwo
username_0
Ah ha, yes, that worked. Can I just ask, are the objects in the dictionary stored in memory as-is or are they copied when returned via the delegate allSelect method? I ask because if they're not copied I can directly use a model object there with a callback, but if not then I guess I'll just use an identifier and a mapping back to the model.
comment
created
onepointsixtwo
username_0
Actually tried it out with a simple closure in the attributes and it worked fine. Awesome!

Thanks very much for your help. This is a really great project.
comment
closed
onepointsixtwo
username_0
issue
created
mousebird
username_1
They shouldn't be copied at that point.  There's some funkyness with Vector Tiles, but it happens before this point, so it should affect your usage.
comment
created
onepointsixtwo
username_0
OK, that's great. That makes it a lot easier for me and the way I like to write ViewModels. Thanks again.
comment
created
kalpeshTOPS
username_2
if let jsonData = NSData(contentsOfFile: outline),
                        let wgVecObj = MaplyVectorObject(fromGeoJSON: jsonData as Data) {
                    // the admin tag from the country outline geojson has the country name ­ save
                    if let attrs = wgVecObj.attributes,
                       let vecName = attrs.object(forKey: "ADMIN") as? NSObject {
                        wgVecObj. = vecName}
comment
created
mousebird
username_1
How is this related to the userObject question?
If it is not, then please open your own issue.
comment