 
 class NewsViewController: UITableViewController {
 
-    fileprivate var parser: MWFeedParser?
+    fileprivate let parser: MWFeedParser = MWFeedParser(feedURL: URL(string: RSSFeedURL)!)
+    fileprivate var parsingFeedItems: [MWFeedItem]?
     fileprivate var feedItems = [MWFeedItem]()
 
     init() {
         super.init(style: .plain)
         title = "News"
+        parser.delegate = self
     }
 
     required init?(coder aDecoder: NSCoder) {

extension NewsViewController: MWFeedParserDelegate {

    func feedParser(_ parser: MWFeedParser!, didParseFeedItem item: MWFeedItem!) {
        feedItems.append(item)
    }

    func feedParserDidFinish(_ parser: MWFeedParser!) {

private extension NewsViewController {

    @objc func parse() {
        guard !parser.isParsing else { return }

        DispatchQueue.global().async {
            self.parsingFeedItems = []
            if self.parser.parse() {
                self.feedItems = self.parsingFeedItems ?? []
            }

            DispatchQueue.main.async {
                self.refreshControl?.endRefreshing()
                self.tableView?.reloadData()
            }
        }
    }

}
