Files
GetGoing/ProjectClock/ViewController.swift
T
2021-01-13 13:43:39 -05:00

55 lines
1.2 KiB
Swift

//
// ViewController.swift
// ProjectClock
//
// Created by Hykilpikonna on 1/6/21.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet var table: UITableView!
var models = [MyAlarm]()
override func viewDidLoad() {
super.viewDidLoad()
table.delegate = self
table.dataSource = self
}
}
extension ViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
}
extension ViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = models[indexPath.row].title
return cell
}
}
struct MyAlarm {
let title: String
let date: Date
let identifier: String
}