What I am trying to do is set a google map marker as ONLY a UIImage I am downloading from firebase. Currently here is my code:
if let downloadedImage = UIImage(data: data!) {
let markerImageView: UIImageView? = nil
markerImageView?.image = downloadedImage
print(markerImageView?.image)
markerImageView?.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
markerImageView?.layer.borderWidth = 1.0
markerImageView?.layer.masksToBounds = false
markerImageView?.layer.borderColor = UIColor.white.cgColor
markerImageView?.layer.cornerRadius = (markerImageView?.frame.size.width)! / 2
markerImageView?.clipsToBounds = true
let actualFinalImage = markerImageView?.image
marker.icon = actualFinalImage
}
I know that I am getting an image from firebase and that part is working. However, where I think the problem is with this part: let markerImageView: UIImageView? = nil
I think setting it as nil conflicts with the marker icon and that's why this does not work. However, if I take out the nil part, I get an error saying that I can't edit markerImageView before it has been initialized.
Any help would be appreciated!