我正在尝试为用户制作个人资料照片,并且我正在将ImageURL发送到数据库,现在我试图使用SDWebImage显示此ImageURL,如何将此ImageURL(filePath)从数据库获取到我的项目
这是我的代码。
@IBOutlet weak var profileImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
Ref=FIRDatabase.database().reference()
Ref?.child("Posts/\(FIRAuth.auth()!.currentUser!.uid)")
.observeSingleEvent(of: .value, with : { (snapshot) in
if snapshot.hasChild("userPhoto"){
let filepath = // How to get the current ImageURL path
let url = URL(string : filepath)
self.profileImage.sd_setImage(with: url)
}
if let val = snapshot.value as? [String: AnyObject] {
self.passwordLable.text = val["Provider"] as? String
self.emailLable.text = val["Email"] as? String
}
})
}