45 lines
1.5 KiB
Swift
45 lines
1.5 KiB
Swift
//
|
|
// RedditSelectAccountTableViewController.swift
|
|
// NetNewsWire-iOS
|
|
//
|
|
// Created by Maurice Parker on 5/12/20.
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
import UIKit
|
|
import Account
|
|
|
|
class RedditSelectAccountTableViewController: UITableViewController, SelectURLBuilder {
|
|
|
|
private var redditFeedProviders = [RedditFeedProvider]()
|
|
|
|
var redditFeedType: RedditFeedType?
|
|
weak var delegate: SelectURLBuilderDelegate?
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
redditFeedProviders = ExtensionPointManager.shared.activeExtensionPoints.values.compactMap { $0 as? RedditFeedProvider }
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return redditFeedProviders.count
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
|
cell.textLabel?.text = redditFeedProviders[indexPath.row].title
|
|
return cell
|
|
}
|
|
|
|
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
|
selectSort.redditFeedType = redditFeedType
|
|
selectSort.username = redditFeedProviders[indexPath.row].username
|
|
selectSort.delegate = delegate
|
|
navigationController?.pushViewController(selectSort, animated: true)
|
|
}
|
|
|
|
}
|