title: Connect swift to FirebaseDatabase
body: <p>Want to connect this code to FirebaseDatabase.
  But I getting an error while Connecting to it.</p>
  
  <p>Error :- Cannot convert value of type '[Datasnapshot]' to expected argument type 'UView'.</p>
  
  <p><a href="https://i.stack.imgur.com/wFZfU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wFZfU.png" alt="FirebaseDatabase"></a></p>
  
  <blockquote>
    <p>Below is Code snippet of it.</p>
  </blockquote>
  
  <pre><code>import UIKit
  import FirebaseDatabase
  import FirebaseAuth
  
  class HomeViewController: UIViewController, iCarouselDelegate, iCarouselDataSource 
  {
  
  @IBOutlet var carouselView: iCarousel!
  
          var snaps : [DataSnapshot] = []
          override func viewDidLoad() {
              super.viewDidLoad()
              if let currentUserUid = Auth.auth().currentUser?.uid {
                  Database.database().reference().child("posts").child("photoUrl").observe(.childAdded, with: { (snapshot) in
                      self.snaps.append(snapshot)
                      self.carouselView.reloadData()
                  })
              }
  
              carouselView.type = .coverFlow
          }
  
          func numberOfItems(in carousel: iCarousel) -&gt; Int {
              return snaps.count
          }
  
          func carousel(_ carousel: iCarousel, viewForItemAt index: Int, reusing view: UIView?) -&gt; UIView {
              let tempView = UIView(frame: CGRect(x: 0, y: 0, width: 374, height: 417))
             tempView.addSubview(snaps)
              return tempView
          }
  
          func carousel(_ carousel: iCarousel, valueFor option: iCarouselOption, withDefault value: CGFloat) -&gt; CGFloat {
              if option == iCarouselOption.spacing {
                  return value * 2.1
              }
              return value
          }
          override func didReceiveMemoryWarning() {
              super.didReceiveMemoryWarning()
              // Dispose of any resources that can be recreated.
          }
  }
  </code></pre>