Q:

Prototype Cells fetch not correct from JSON

I made a news feed from JSON using TableView and Prototype Cell with three Labels but meet a problem. All lines of feed fetch same data although JSON has differents. 
JSON give to my app 15 blocks with data. All lines show content which has to be last.
Its seem like array has error and doing not correct. But I can't understand why tableview pull from him only last line data and put in to each cells.
What the reason my problem? What I do wrong? Please help me.

class SecondViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "newsfeedCell", for: indexPath) as! NewsFeedCell
    cell.newsfeed_title.text = self.news?[indexPath.item].headline
    //cell.newsfeed_title.text = "Динамо обыграло Шахтер"
    cell.newsfeed_topic.text = self.news?[indexPath.item].topic
    //cell.newsfeed_topic.text = "Премьер-лига"
    cell.newsfeed_time.text = self.news?[indexPath.item].time
    //cell.newsfeed_time.text = "17:22"
    return cell
}

func numberOfSections(in tableView: UITableView) -> Int {
    return 1
} 

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return self.news?.count ?? 0
} //number of rows

@IBOutlet weak var tableview: UITableView!
var news: [Newsfeed]? = []

override func viewDidLoad() {
    super.viewDidLoad()
    getJSON()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func getJSON(){

    let urlRequest = URLRequest(url: URL(string: "any_json_url")!)

    let task = URLSession.shared.dataTask(with: urlRequest) { (data,response,error) in

        if error != nil {
            print(error as Any)
            return
        }
        self.news = [Newsfeed]()
        do {
            let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! NSArray

            let NF = Newsfeed()
            for arrayX in json as! [[String: AnyObject]] {

                if let ID = arrayX["id"],
                    let date = arrayX["date"],
                    let status = arrayX["status"],
                    let title0 = arrayX["title"] as? [String: Any],
                    let title = title0["rendered"] {

                        NF.headline = title as? String
                        NF.topic = status as? String
                        NF.id = ID as? String
                        NF.time = date as? String

                        print(ID)
                        print(title)
                        print(date)
                        print(status)
                }
                self.news?.append(NF)

             }

            DispatchQueue.main.async {
                self.tableview.reloadData()
            }

        } catch let error {
            print(error)
        }
    }
    task.resume()

}
}

A:

You are writing always into the same Newsfeed instance and if it's a class – it obviously is – you are using always the same object.
Change the order. Replace 
 let NF = Newsfeed()
 for arrayX in json as! [[String: AnyObject]] {

with (by the way a JSON dictionary in Swift 3+ is always [String:Any])
for arrayX in json as! [[String: Any]] {
    let NF = Newsfeed()

And declare the data source array as non optional
var news = [Newsfeed]()

then you get rid of a lot of question marks and ugly syntax like return self.news?.count ?? 0. Just return self.news.count

