SmartPrompter Documentation Beta

Class Main​VC

class MainVC: UIViewController

The main view controlller of the app. Users often see this view controller as a default. This is where all the alarms are fetched from firebase and alarm requests are made to the OS.

%3 MainVC MainVC UNUserNotificationCenterDelegate UNUserNotificationCenterDelegate MainVC->UNUserNotificationCenterDelegate AlarmVCDelegate AlarmVCDelegate MainVC->AlarmVCDelegate UIViewController UIViewController MainVC->UIViewController UITableViewDataSource UITableViewDataSource MainVC->UITableViewDataSource UITableViewDelegate UITableViewDelegate MainVC->UITableViewDelegate

Conforms To

AlarmVCDelegate
UITableViewDataSource
UITableViewDelegate
UIViewController
UNUserNotificationCenterDelegate

Properties

welcome​Text​View

let welcomeTextView

clock​Label

let clockLabel

top​Bar

let topBar

time​Label

let timeLabel

timer

var timer

date

var date

calendar

let calendar

date​Formatter

let dateFormatter

logout​Button

let logoutButton

refresh​Control

var refreshControl

summary​Label

let summaryLabel

ref

var ref: DatabaseReference!

alarm​Table

let alarmTable

Methods

reload​Table​Delegate()

func reloadTableDelegate()

view​Did​Load()

override func viewDidLoad()

This is tha main function where all the important tasks are called, such as loading the UI, Fetching from firebase and loading data into array

update​Time​Label()

@objc func updateTimeLabel()

Updates the time label for the clock shown on screen. Also refreshes the table view after certain time period

reload​Table()

@objc func reloadTable()

Reloads data in the table view

summary​Label​Setup()

func summaryLabelSetup()

Sets up the summary label. This label shows how many alarms are remaining to be completed for the day.

logout​Button​Clicked()

@objc func logoutButtonClicked()

Logout button action. Logout the user from the app

fetch​From​Firebase()

func fetchFromFirebase()

Fetches data from firebase and loads them in an array to be supplied to table view

table​View(_:​number​OfRows​InSection:​)

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

Built in tablie view function. Determines how many rows to be shown in the table

Parameters

table​View UITable​View

table view class

section Int

number of rows

table​View(_:​cell​For​Row​At:​)

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

Sorts out the data to be shown in each row of the table

table​View(_:​did​Select​Row​At:​)

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

Action to be done when a row is tapped

user​Notification​Center(_:​will​Present:​with​Completion​Handler:​)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)

user​Notification​Center(_:​did​Receive:​with​Completion​Handler:​)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)

logout​Button​Setup()

func logoutButtonSetup()

Sets up the size/location/shape and style of the logout button

alarm​Table​Setup()

func alarmTableSetup()

Sets up the size/location/shape and style of the alarm table

top​View​Setup()

func topViewSetup()

Sets up the size/location/shape and style of the top view

time​Label​Setup()

func timeLabelSetup()

Sets up the size/location/shape and style of the time label

welcome​Text​View​Setup()

func welcomeTextViewSetup()

Sets up the size/location/shape and style of the welcome text

clock​Label​Setup()

func clockLabelSetup()

Sets up the size/location/shape and style of the clock label

view​Will​Appear(_:​)

override func viewWillAppear(_ animated: Bool)

Refreshes the data in the alarm table when the view is loaded