NetNewsWire/iOS/Add/SelectURLBuilderTableViewCo...

66 lines
1.9 KiB
Swift
Raw Normal View History

2020-04-23 11:44:26 +02:00
//
// SelectURLBuilderTableViewController.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 4/23/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import UIKit
class SelectURLBuilderTableViewController: UITableViewController, SelectURLBuilder {
weak var delegate: SelectURLBuilderDelegate?
2020-04-23 11:44:26 +02:00
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
2020-05-12 18:17:47 +02:00
return 2
2020-04-23 11:44:26 +02:00
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "URLBuilderCell", for: indexPath) as! SelectComboTableViewCell
2020-05-12 18:17:47 +02:00
switch indexPath.row {
case 0:
cell.icon?.image = AppAssets.extensionPointReddit
cell.label?.text = NSLocalizedString("Reddit", comment: "Reddit")
case 1:
cell.icon?.image = AppAssets.extensionPointTwitter
cell.label?.text = NSLocalizedString("Twitter", comment: "Twitter")
default:
break
}
2020-04-23 11:44:26 +02:00
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
2020-05-12 18:17:47 +02:00
switch indexPath.row {
case 0:
let redditURLBuilder = UIStoryboard.redditAdd.instantiateInitialViewController() as! RedditSelectTypeTableViewController
redditURLBuilder.delegate = delegate
navigationController?.pushViewController(redditURLBuilder, animated: true)
case 1:
let twitterURLBuilder = UIStoryboard.twitterAdd.instantiateInitialViewController() as! TwitterSelectTypeTableViewController
twitterURLBuilder.delegate = delegate
navigationController?.pushViewController(twitterURLBuilder, animated: true)
default:
break
}
2020-04-23 11:44:26 +02:00
}
// MARK: Actions
@IBAction func cancel(_ sender: Any) {
dismiss(animated: true)
}
}