I have my own custom view and adding them dynamically to the UIViewController.
Those views are something like:
class pinView: UIView {
var userID : String?
var lastTimeConnected : Date?
init(userID: String, lastTimeConnected : Date)
{
self.userID = userID
self.lastTimeConnected = lastTimeConnected
}
I then add my view to the UIViewController by calling
imageView.addSubview(pinViewInstance) in a loop
I have events that will trigger my views to move on the screen. I call a database to get their new position and then I need to update them. How do I get to the view by using the userID on my custom view? I would use tags but they are just INT and I need something much bigger than that. Otherwise I need to map the tags to the userIDs which I really want to avoid.
To be clear... I know I can do this: let pinViewInstance = self.view.viewWithTag(numberHere) as? pinView But what I want is to access it by the ID, the first reason why I extended the UIView class in the first place.
I hope you know how to solve this has been stuck on it for a bit and cannot see a way around it. Your help much appreciated. Thanks!