Tusker/Tusker/Screens/Preferences/SilentActionPermissionsTabl...

50 lines
1.6 KiB
Swift

//
// SilentActionPermissionsTableViewController.swift
// Tusker
//
// Created by Shadowfacts on 9/30/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
class SilentActionPermissionsTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UINib(nibName: "SilentActionPermissionCell", bundle: nil), forCellReuseIdentifier: "permissionCell")
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Preferences.shared.silentActions.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "permissionCell", for: indexPath) as? SilentActionPermissionTableViewCell else { fatalError() }
let index = Preferences.shared.silentActions.index(Preferences.shared.silentActions.startIndex, offsetBy: indexPath.row)
let (source, permission) = Preferences.shared.silentActions[index]
cell.updateUI(source: source, permission: permission)
return cell
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}