55 lines
1.2 KiB
Swift
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
|
|
}
|
|
|