1
votes

please check my image for storing and retrieving dataenter image description here

I am getting an error because I want retrieve image from firebase, my url is string but error states about uiImage cannot be string, is there away I can get an image shown of my uiImageView.

By the Way this is my model view class of user below class User {

    var username:String!
    var userage:String!
    var uid:String!
    var profileImageUrl: String!


    init (uid:String,dictionary:Dictionary<String,AnyObject>) {

    self.uid = uid
    if let username = dictionary [ "userName" ] as? String{

        self.username = username
    }

    if let userage = dictionary [ "useAge" ] as? String {

        self.userage = userage
    }

   if let profileImageUrl = dictionary["profileImageUrl"] as? String

 {

      self.profileImageUrl = profileImageUrl
   }


 }

    }
1
Unrelated to the question, but may I ask, what theme are you using? I like this, I may change mineGeorge
@George_E press command key and ,(comma) key. preferences I am using is duskAkbar
Cheers! Used to use dark, now I have switched to this, but with grey comments :)George
@George_E #########yesAkbar

1 Answers

0
votes

If user.profileImageURL is actually an URL, you have to download the image and assign that to self.swipeLabel.image.

To download image from URL, Please refer this post: Create a UIImage with a URL in iOS

If the image is already stored, the use the following code.

self.swipeLabel.image = UIImage(contentsOfFile: profileimageurl)