HomeiOS DevelopmentThere is no such thing as a present images and e-mail's adresses...

There is no such thing as a present images and e-mail’s adresses in feedtableview However I cant resolve Assist me


import UIKit
import FirebaseStorage
import FirebaseFirestore
import SDWebImage

class FeedViewController: UIViewController, UITableViewDelegate,UITableViewDataSource {

    @IBOutlet weak var tableView: UITableView!
    var postDizisi = [Post]()
    /*
    var emailDizisi = [String]()
    var gorselDizisi = [String]()
    */
    func firebaseTakeData() {
            let firebaseData = Firestore.firestore()
            firebaseData.assortment("Submit").order(by: "tarih", descending: true).addSnapshotListener { snapshot, error in
                if let error = error {
                    print(error.localizedDescription)
                } else if let snapshot = snapshot, !snapshot.isEmpty {
                    self.postDizisi.removeAll()
                    for doc in snapshot.paperwork {
                        if let e-mail = doc.get("emailUrl") as? String,
                           let gorselUrl = doc.get("gorselUrl") as? String {
                            let put up = Submit(e-mail: e-mail, gorselURL: gorselUrl)
                            self.postDizisi.append(put up)
                        }
                    }
                    self.tableView.reloadData()
                }
            }
        }
          
      override func viewDidLoad() {
          tremendous.viewDidLoad()
          firebaseTakeData()
          tableView.delegate = self
          tableView.dataSource = self
      }
    func tableView(_ tableView: UITableView, numberOfRowsInSection part: Int) -> Int {
        return postDizisi.depend
        
    }
      
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! FeedViewCell
          cell.emailText.textual content = postDizisi[indexPath.row].e-mail
          cell.imageView2.sd_setImage(with: URL(string: self.postDizisi[indexPath.row].gorselURL))
          return cell
      }
  }

It is a Swift code for a FeedViewController.

This view controller shows a feed of posts retrieved from a Firebase Firestore database. The postDizisi array shops the posts retrieved from the database.

The firebaseTakeData() perform retrieves the posts from the database and updates the postDizisi array. The viewDidLoad() perform units the delegate and information supply for the desk view and calls firebaseTakeData() to populate the postDizisi array.

The tableView(_:numberOfRowsInSection:) perform returns the variety of rows within the desk view, which is the same as the variety of posts in postDizisi.

The tableView(_:cellForRowAt:) perform configures and returns the desk view cell for every row. The perform dequeues a reusable cell with the identifier "cell" and units the e-mail textual content and picture view utilizing the information from the postDizisi array.

General, this code gives the essential performance for displaying a feed of posts retrieved from a Firebase Firestore database.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments