Managing tagsΒΆ

To manage tags you need to build an NSDictionary object with key/value pairs and then pass this to setTags -

/*************************
* Objective-C
*************************/
NSDictionary *tags = @{
	@"gender" : @"female",
	@"age" : @"25",
	@"membership" : @"gold"
};
[[Geomoby sharedInstance]  setTags:tags];

/*************************
* Swift
*************************/
func setGeomobyTags() {
	guard Geomoby.isInitialised() else{
    	return
    }
        
   [...]
        
    var tags: [AnyHashable : Any] = [:]

    if let gender = UserDefaults.gender {
    	tags["gender"] = "female"
    }
    
    if let age = UserDefaults.age as? Int {
        tags["age"] = "25"
    }
    
    if let userId = UserDefaults.userId {
        tags["membership"] = "gold"
    }
        
    Geomoby.sharedInstance()?.setTags(tags)
}

NOTE - Using [Geomoby sharedInstance] can only be done after the Geomoby service is initialised. See Instantiate the GeoMoby SDK for more information.