This is a basic app that let’s patients respond to the alarms set by the caretake in Caretaker app.
To read the complete app documentation, go to this link: https://likhongomes.github.io/Smart-Prompter-iOS/
Clone the repository and open it using xcode. click the run button or press cmd+R on keyboard to run the app, on a simulator or your iPhone.
Requirement: iOS 10 or above and xcode version 10 and above.
class Alarm: PersistableRecord, Codable, FetchableRecord
Codable
, FetchableRecord
, PersistableRecord
init()
init()
init(label:hour:minute:year:month:day:active:)
init(label: String, hour: Int, minute: Int, year: Int, month: Int, day: Int, active: Bool)
id
var id: Int?
firebaseID
var firebaseID: String?
label
var label: String?
year
var year: Int?
month
var month: Int?
day
var day: Int?
hour
var hour: Int?
minute
var minute: Int?
active
var active: Bool?
status
var status: String?
deleteRequest
var deleteRequest: String?
encode(to:)
func encode(to container: inout PersistenceContainer)
let alarmDB
Alarm scheduling class to schedule alarm
class AlarmScheduler
scheduleNotification(title:dateComponents:id:)
Function to schedule alarm for the first time after doanloaded from Firebase. Simply call this function and it will push the alarm to the OS notification center
func scheduleNotification(title: String, dateComponents: DateComponents, id: String?)
rescheduleNotification(title:id:)
Reschedule alam once the the alarm is delayed
public func rescheduleNotification(title: String, id: String?)
clearNotifications(title:)
Request OS to remove notification from pending list and clear the notification list already delivered
func clearNotifications(title: String)
The alarm view controller that is show after a row on the table is tapped
class AlarmVC: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate
UIImagePickerControllerDelegate
, UINavigationControllerDelegate
, UIViewController
backButton
let backButton
saveButton
let saveButton
cancelButton
let cancelButton
deleteButton
let deleteButton
buttonStack
let buttonStack
alarmDetailsLabel
let alarmDetailsLabel
instructionLabel
let instructionLabel
dateLabel
let dateLabel
timeLabel
let timeLabel
alarmDelegate
var alarmDelegate: AlarmVCDelegate?
alarm
var alarm
alarmNameTextField
let alarmNameTextField
alarmDateTextField
let alarmDateTextField
alarmTimeTextField
let alarmTimeTextField
statusLabel
let statusLabel
statusStatusLabel
let statusStatusLabel
datePicker
let datePicker
timePicker
let timePicker
slider
let slider
pictureSlider
let pictureSlider
imageView
let imageView
notificationTitle
var notificationTitle: Any?
takenImageViewer
let takenImageViewer
alarmIndex
var alarmIndex
viewDidLoad()
Main function of the view controller, all the important UI and rest of the alarm meta data are downloaded here.
override func viewDidLoad()
imageViewSetup()
Sets up the size/location/shape and style of the imageview
func imageViewSetup()
showDatePicker()
Sets up the size/location/shape and style of the date picker
func showDatePicker()
takenImageViewSetup()
Sets up the size/location/shape and style of the imageview for take image
func takenImageViewSetup()
showTimePicker()
Sets up the size/location/shape and style of the time picker
func showTimePicker()
donedatePicker()
action when done button is tapped on date picker
@objc func donedatePicker()
donetimePicker()
action when done button is tapped on time picker
@objc func donetimePicker()
cancelDatePicker()
Action to cancel date picker and make it disappear
@objc func cancelDatePicker()
changeValue(_:)
Action when slider value is changed. Updates the current status of the alarm based on the direction of slide. If left, then add delay to the alarm. If right, update the data on firebase and prompt the user to the next step
@objc func changeValue(_ sender: UISlider)
changeValuePictureSlider(_:)
Action when slider value is changed. Updates the current status of the alarm based on the direction of slide. If left, then add delay to the alarm. If right, update the data on firebase and prompt the user to the next step
@objc func changeValuePictureSlider(_ sender: UISlider)
imagePickerController(_:didFinishPickingMediaWithInfo:)
Action when image picker is done picking image and returns it. It also uploads the image to firebase and updates the status of the alarm
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])
alarmDateTextFieldSetup()
Sets up the size/location/shape and style of the alarm date text field
func alarmDateTextFieldSetup()
instructionLabelSetup()
Sets up the size/location/shape and style of the instruction label
func instructionLabelSetup()
alarmDetailsLabelSetup()
Sets up the size/location/shape and style of the alarm details label
func alarmDetailsLabelSetup()
alarmNameTextFieldSetup()
Sets up the size/location/shape and style of the alarm name text field
func alarmNameTextFieldSetup()
backButtonSetup()
Sets up the size/location/shape and style of the back button
func backButtonSetup()
backButtonClicked()
Action for back button when clicked, takes the user back to the previous screen
@objc func backButtonClicked()
statusStatusLabelSetup()
Sets up the size/location/shape and style of the label for the status label
func statusStatusLabelSetup()
sliderSetup()
Sets up the size/location/shape and style of the slider
func sliderSetup()
pictureSliderSetup()
Sets up the size/location/shape and style of the slider
func pictureSliderSetup()
protocol AlarmVCDelegate
func reloadTableDelegate()
A type responsible for initializing the application database.
struct AppDatabase
See AppDelegate.setupDatabase()
openDatabase(atPath:)
Creates a fully initialized database at path
static func openDatabase(atPath path: String) throws -> DatabaseQueue
@available(iOS 10.0, *) @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate
UIApplicationDelegate
, UIResponder
, UNUserNotificationCenterDelegate
window
var window: UIWindow?
application(_:didFinishLaunchingWithOptions:)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
application(_:performFetchWithCompletionHandler:)
Background fetch function. Tries the fetch data when the app is in background
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
applicationWillResignActive(_:)
func applicationWillResignActive(_ application: UIApplication)
applicationDidEnterBackground(_:)
func applicationDidEnterBackground(_ application: UIApplication)
applicationWillEnterForeground(_:)
func applicationWillEnterForeground(_ application: UIApplication)
applicationDidBecomeActive(_:)
func applicationDidBecomeActive(_ application: UIApplication)
applicationWillTerminate(_:)
func applicationWillTerminate(_ application: UIApplication)
application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
application(_:didFailToRegisterForRemoteNotificationsWithError:)
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
setupDatabase(_:)
Sets up the internal swl database which is currently not in use
private func setupDatabase(_ application: UIApplication) throws
registerForPushNotifications()
Registers the app for push notification
func registerForPushNotifications()
getNotificationSettings()
Gets the notification settings for local notification
func getNotificationSettings()
userNotificationCenter(_:willPresent:withCompletionHandler:)
@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
userNotificationCenter(_:didReceive:withCompletionHandler:)
@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
downloadNotificationSound()
Download the custom notifcation sound that's to be used
func downloadNotificationSound()
class FirebaseUtil
fetchOneObject(firebaseID:)
Fetch one particular firebase object using the given firebase ID. Returns a single alarm
func fetchOneObject(firebaseID: String) -> Alarm
firebaseID: The id of the element trying to fetch from firebase
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.
class MainVC: UIViewController
AlarmVCDelegate
, UITableViewDataSource
, UITableViewDelegate
, UIViewController
, UNUserNotificationCenterDelegate
welcomeTextView
let welcomeTextView
clockLabel
let clockLabel
topBar
let topBar
timeLabel
let timeLabel
timer
var timer
date
var date
calendar
let calendar
dateFormatter
let dateFormatter
logoutButton
let logoutButton
refreshControl
var refreshControl
summaryLabel
let summaryLabel
ref
var ref: DatabaseReference!
alarmTable
let alarmTable
reloadTableDelegate()
func reloadTableDelegate()
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
override func viewDidLoad()
updateTimeLabel()
Updates the time label for the clock shown on screen. Also refreshes the table view after certain time period
@objc func updateTimeLabel()
reloadTable()
Reloads data in the table view
@objc func reloadTable()
summaryLabelSetup()
Sets up the summary label. This label shows how many alarms are remaining to be completed for the day.
func summaryLabelSetup()
logoutButtonClicked()
Logout button action. Logout the user from the app
@objc func logoutButtonClicked()
fetchFromFirebase()
Fetches data from firebase and loads them in an array to be supplied to table view
func fetchFromFirebase()
tableView(_:numberOfRowsInSection:)
Built in tablie view function. Determines how many rows to be shown in the table
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
tableView(_:cellForRowAt:)
Sorts out the data to be shown in each row of the table
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
tableView(_:didSelectRowAt:)
Action to be done when a row is tapped
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
userNotificationCenter(_:willPresent:withCompletionHandler:)
@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
userNotificationCenter(_:didReceive:withCompletionHandler:)
@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
logoutButtonSetup()
Sets up the size/location/shape and style of the logout button
func logoutButtonSetup()
alarmTableSetup()
Sets up the size/location/shape and style of the alarm table
func alarmTableSetup()
topViewSetup()
Sets up the size/location/shape and style of the top view
func topViewSetup()
timeLabelSetup()
Sets up the size/location/shape and style of the time label
func timeLabelSetup()
welcomeTextViewSetup()
Sets up the size/location/shape and style of the welcome text
func welcomeTextViewSetup()
clockLabelSetup()
Sets up the size/location/shape and style of the clock label
func clockLabelSetup()
viewWillAppear(_:)
Refreshes the data in the alarm table when the view is loaded
override func viewWillAppear(_ animated: Bool)
class RewardVC: UIViewController
UIViewController
circleHolder
let circleHolder
percentageLabel
let percentageLabel
button
let button
textView
let textView
fraction
var fraction
imageView
let imageView
imageArray
let imageArray
viewDidLoad()
override func viewDidLoad()
imageViewSetup()
Sets up the size/location/shape and style of the imageview
func imageViewSetup()
progressCircleSetup()
Sets up the size/location/shape and style of the progress circle
func progressCircleSetup()
buttonSetup()
Sets up the size/location/shape and style of the button
func buttonSetup()
buttonClicked()
Action when the button is tapped. Takes user back
@objc func buttonClicked()
textViewSetup()
Sets up the size/location/shape and style of the textview
func textViewSetup()
class RootViewController: UIViewController
UIViewController
viewDidLoad()
override func viewDidLoad()
class SignInVC: UIViewController
UIViewController
loginButton
let loginButton
signUpButton
let signUpButton
guestButton
let guestButton
emailTF
let emailTF
passwordTF
let passwordTF
backButton
let backButton
logoImage
let logoImage
errorMessageView
let errorMessageView
viewWillAppear(_:)
Adds a authentication listener to see if the user is signed in
override func viewWillAppear(_ animated: Bool)
keyboardWillShow(notification:)
Raises the view when the keybaord appears
@objc func keyboardWillShow(notification: NSNotification)
keyboardWillHide(notification:)
Lowers the view when the keyboard disappears
@objc func keyboardWillHide(notification: NSNotification)
viewDidLoad()
Main function of this view controller. All the important tasks are done here such as loading the UI, adding listener for the keyboard etc.
override func viewDidLoad()
errorMessageViewSetup()
Sets up the size/location/shape and style of the error message textview
func errorMessageViewSetup()
logoImageSetup()
Sets up the size/location/shape and style of the logo image
func logoImageSetup()
loginButtonSetup()
Sets up the size/location/shape and style of the login button
func loginButtonSetup()
loginButtonTapped()
Action when the login button is tapped. Checks if all of the required fields are full and checks with firebase to authenticate
@objc func loginButtonTapped()
signUpButtonSetup()
Sets up the size/location/shape and style of the signup button
func signUpButtonSetup()
signUpButtonTapped()
Action when the signup button is tapped. Registers the user in firebase
@objc func signUpButtonTapped()
emailTFSetup()
Sets up the size/location/shape and style of the email textfield
func emailTFSetup()
passwordTFSetup()
Sets up the size/location/shape and style of the password textfield
func passwordTFSetup()
backButtonSetup()
Sets up the size/location/shape and style of the back button
func backButtonSetup()
Generated at 2020-05-02T13:21:48-0400 using swift-doc 1.0.0-beta.2.
var activeAlarm
var completedTask
var dbQueue: DatabaseQueue!
let fUtil
Get the document directory
func getDocumentsDirectory() -> URL
var inactiveAlarm
var ref: DatabaseReference!
let scheduler
var totalTask
let userID
data structure the alarm
class Alarm: PersistableRecord, Codable, FetchableRecord
Codable
, FetchableRecord
, PersistableRecord
init()
empty initializer
init()
init(label:hour:minute:year:month:day:active:status:)
initializer
init(label: String, hour: Int, minute: Int, year: Int, month: Int, day: Int, active: Bool, status: String)
id
var id: Int?
firebaseID
var firebaseID: String?
label
var label: String?
scheduledHour
var scheduledHour: Int?
scheduledMinute
var scheduledMinute: Int?
active
var active: Bool?
scheduledYear
var scheduledYear: Int?
scheduledMonth
var scheduledMonth: Int?
scheduledDay
var scheduledDay: Int?
acknowledgedDay
var acknowledgedDay: Int?
acknowledgedMonth
var acknowledgedMonth: Int?
acknowledgedYear
var acknowledgedYear: Int?
acknowledgedHour
var acknowledgedHour: Int?
acknowledgedMinute
var acknowledgedMinute: Int?
completedDay
var completedDay: Int?
completedMonth
var completedMonth: Int?
completedYear
var completedYear: Int?
completedHour
var completedHour: Int?
completedMinute
var completedMinute: Int?
status
var status: String?
deleteRequest
var deleteRequest: String?
let alarmDB
A type responsible for initializing the application database.
struct AppDatabase
See AppDelegate.setupDatabase()
openDatabase(atPath:)
Creates a fully initialized database at path
static func openDatabase(atPath path: String) throws -> DatabaseQueue
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate
UIApplicationDelegate
, UIResponder
window
var window: UIWindow?
application(_:didFinishLaunchingWithOptions:)
main function of the app delegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
applicationWillResignActive(_:)
func applicationWillResignActive(_ application: UIApplication)
applicationDidEnterBackground(_:)
func applicationDidEnterBackground(_ application: UIApplication)
applicationWillEnterForeground(_:)
func applicationWillEnterForeground(_ application: UIApplication)
applicationDidBecomeActive(_:)
func applicationDidBecomeActive(_ application: UIApplication)
applicationWillTerminate(_:)
func applicationWillTerminate(_ application: UIApplication)
application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
application(_:didFailToRegisterForRemoteNotificationsWithError:)
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
setupDatabase(_:)
private func setupDatabase(_ application: UIApplication) throws
registerForPushNotifications()
func registerForPushNotifications()
fetchFromFirebase()
func fetchFromFirebase()
Class for recording audio for alarm sound
class AudioRecordVC: RootViewController, AVAudioRecorderDelegate, AVAudioPlayerDelegate
RootViewController
, AVAudioPlayerDelegate
, AVAudioRecorderDelegate
recordButton
var recordButton
playButton
let playButton
instruction
let instruction
nextButton
let nextButton
recordingSession
var recordingSession: AVAudioSession!
audioRecorder
var audioRecorder: AVAudioRecorder!
audioPlayer
var audioPlayer: AVAudioPlayer?
audioFilename
var audioFilename: URL?
viewDidLoad()
override func viewDidLoad()
loadAudioPlayer()
loads the audio player to play the sound on device
func loadAudioPlayer()
audioPlayerDidFinishPlaying(_:successfully:)
Checks if the audio player finished playing the sound, then change the play button
func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool)
loadRecordingUI()
Loads the button button to record. Sets title and adds target
func loadRecordingUI()
startRecording()
Starts the recording session on device
func startRecording()
getDocumentsDirectory()
Gets the documents directory of the audio stored
func getDocumentsDirectory() -> URL
finishRecording(success:)
Finishes the recording session and clears memory to nil
func finishRecording(success: Bool)
topLeftButtonTapped()
Action for top left button when tapped. Takes the user back to the main vc
override func topLeftButtonTapped()
recordTapped()
action for when the record button is tapped. Starts the audio session or stops
@objc func recordTapped()
audioRecorderDidFinishRecording(_:successfully:)
Checks if the audio recorder did finish recording. Sets the flag according to that
func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool)
uploadToFirebase()
Uploads the recorded audio to firebase
func uploadToFirebase()
playButtonSetup()
Setup function for play button on the view. Specifies the location, size and the syle of it
func playButtonSetup()
playButtonTapped()
action for when play button is tapped. Plays the audio if not playing, stops the audio if playing
@objc func playButtonTapped()
recordButtonSetup()
Setup function for record button on the view. Specifies the location, size and the syle of it
func recordButtonSetup()
instructionTextViewSetup()
Setup function for instruction text view on the view. Specifies the location, size and the syle of it
func instructionTextViewSetup()
nextButtonSetup()
Setup function for next button on the view. Specifies the location, size and the syle of it
func nextButtonSetup()
nextButtonTapped()
Action for when next buton is tapped. Takes the usre to Main VC
@objc func nextButtonTapped()
View controller for create new alarm
class CreateNewAlarmVC: RootViewController, UITextFieldDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate
RootViewController
, UIImagePickerControllerDelegate
, UINavigationControllerDelegate
, UITextFieldDelegate
saveButton
let saveButton
deleteButton
let deleteButton
alarmNameLabel
let alarmNameLabel
dateLabel
let dateLabel
timeLabel
let timeLabel
imageView
let imageView
imageButtonStack
let imageButtonStack
alarmNameTextField
let alarmNameTextField
alarmDateTextField
let alarmDateTextField
alarmTimeTextField
let alarmTimeTextField
statusLabel
let statusLabel
statusStatusLabel
let statusStatusLabel
selectedTextField
var selectedTextField
datePicker
let datePicker
timePicker
let timePicker
topImageView
let topImageView
addImageButton
let addImageButton
vcName
let vcName
cameraButton
let cameraButton
imagePickerButton
let imagePickerButton
imageBackButton
let imageBackButton
status
var status
editable
var editable
screenName
var screenName
alarm
var alarm
image
var image
viewDidLoad()
override func viewDidLoad()
imagePickerController(_:didFinishPickingMediaWithInfo:)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])
imageButtonStackSetup()
Setup function for image button stacks on the view. Specifies the location, size and the syle of it
func imageButtonStackSetup()
topImageViewSetup()
Setup function for top image view on the view. Specifies the location, size and the syle of it
func topImageViewSetup()
addImageButtonSetup()
Setup function for add image button on the view. Specifies the location, size and the syle of it
func addImageButtonSetup()
addImageTapped()
action for when add image is tapped. Opens image picker
@objc func addImageTapped()
cameraButtonSetup()
Setup function for camera button on the view. Specifies the location, size and the syle of it
func cameraButtonSetup()
cameraButtonTapped()
action for when camera button is tapped. Opens the camera
@objc func cameraButtonTapped()
imagePickerButtonSetup()
Setup function for image picker button on the view. Specifies the location, size and the syle of it
func imagePickerButtonSetup()
imagePickerButtonTapped()
action for when image picker button is tapped. Set the image to be displayed
@objc func imagePickerButtonTapped()
imageBackButtonSetup()
Setup function for image back button on the view. Specifies the location, size and the syle of it
func imageBackButtonSetup()
imageBackButonTapped()
action for when image back button is tapped.
@objc func imageBackButonTapped()
topLeftButtonTapped()
action for when top left button is clicked. Takes the user back to the previous screen
override func topLeftButtonTapped()
vcNmaeSetup()
Setup function for view controller name on the view. Specifies the location, size and the syle of it
func vcNmaeSetup()
showData()
show the data in alarm textfield
func showData()
textFieldDidBeginEditing(_:)
checks if the textfield did begin editing, set the inputview accordingly
func textFieldDidBeginEditing(_ textField: UITextField)
textFieldDidEndEditing(_:)
checks if textfield did end editing then format the date accordingly
func textFieldDidEndEditing(_ textField: UITextField)
showDatePicker()
shows the date picker on screen
func showDatePicker()
donedatePicker()
done editing the date picker
@objc func donedatePicker()
donetimePicker()
done editing the time picker
@objc func donetimePicker()
cancelDatePicker()
cancels editing the date picker
@objc func cancelDatePicker()
alarmNameTextFieldSetup()
Setup function for alarm name text field on the view. Specifies the location, size and the syle of it
func alarmNameTextFieldSetup()
alarmDateTextFieldSetup()
Setup function for alarm date text field on the view. Specifies the location, size and the syle of it
func alarmDateTextFieldSetup()
alarmTimeTextFieldSetup()
Setup function for alarm time textfield on the view. Specifies the location, size and the syle of it
func alarmTimeTextFieldSetup()
alarmNameLabelSetup()
Setup function for alarm name label on the view. Specifies the location, size and the syle of it
func alarmNameLabelSetup()
dateLabelSetup()
Setup function for date label on the view. Specifies the location, size and the syle of it
func dateLabelSetup()
timeLabelSetup()
Setup function for time label on the view. Specifies the location, size and the syle of it
func timeLabelSetup()
backButtonClicked()
action for when save button is clicked
@objc func backButtonClicked()
saveButtonSetup()
Setup function for save button on the view. Specifies the location, size and the syle of it
func saveButtonSetup()
saveButtonClicked()
action for when save button is clicked. Creates an alarm and send it to firebase
@objc func saveButtonClicked()
statusStatusLabelSetup()
Setup function for lable for status label on the view. Specifies the location, size and the syle of it
func statusStatusLabelSetup()
view controller to show list of current alarms
class CurrentAlarmListVC: RootViewController, UITableViewDataSource, UITableViewDelegate
RootViewController
, UITableViewDataSource
, UITableViewDelegate
activeAlarm
var activeAlarm
alarmTable
let alarmTable
tableView(_:numberOfRowsInSection:)
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
tableView(_:cellForRowAt:)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
tableView(_:didSelectRowAt:)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
viewDidLoad()
override func viewDidLoad()
topLeftButtonTapped()
override func topLeftButtonTapped()
alarmTableSetup()
Setup function for alarm table on the view. Specifies the location, size and the syle of it
func alarmTableSetup()
fetchFromFirebase()
fetch data from firebase
func fetchFromFirebase()
Current view controller that shows current alarms active
class CurrentAlarmViewVC: RootViewController, UITextFieldDelegate
RootViewController
, UITextFieldDelegate
backButton
let backButton
saveButton
let saveButton
deleteButton
let deleteButton
alarmDetailsLabel
let alarmDetailsLabel
alarmNameLabel
let alarmNameLabel
dateLabel
let dateLabel
timeLabel
let timeLabel
imageView
let imageView
alarmNameTextField
let alarmNameTextField
alarmDateTextField
let alarmDateTextField
alarmTimeTextField
let alarmTimeTextField
statusLabel
let statusLabel
statusStatusLabel
let statusStatusLabel
selectedTextField
var selectedTextField
datePicker
let datePicker
timePicker
let timePicker
status
var status
editable
var editable
screenName
var screenName
alarm
var alarm
viewDidLoad()
override func viewDidLoad()
topLeftButtonTapped()
action for when top left button is tapped. Takes the user back to the previous screen.
override func topLeftButtonTapped()
showData()
Show the data in textviews
func showData()
textFieldDidBeginEditing(_:)
Check if text view did beging editing, set the keyboard to date picker
func textFieldDidBeginEditing(_ textField: UITextField)
textFieldDidEndEditing(_:)
Checks if the text field did end editing. Formats the date accordingly and put on textview
func textFieldDidEndEditing(_ textField: UITextField)
imageViewSetup()
Setup function for imageview on the view. Specifies the location, size and the syle of it
func imageViewSetup()
showDatePicker()
Setup function for date picker on the view. Specifies the location, size and the syle of it
func showDatePicker()
donedatePicker()
wrapper function for when date picker is done
@objc func donedatePicker()
donetimePicker()
wrapper function for when timer is done
@objc func donetimePicker()
cancelDatePicker()
wrapper function when cancel date
@objc func cancelDatePicker()
alarmNameTextFieldSetup()
Setup function for alarm name textfield on the view. Specifies the location, size and the syle of it
func alarmNameTextFieldSetup()
alarmDateTextFieldSetup()
Setup function for alarm date textfield on the view. Specifies the location, size and the syle of it
func alarmDateTextFieldSetup()
alarmTimeTextFieldSetup()
Setup function for alarm time text field on the view. Specifies the location, size and the syle of it
func alarmTimeTextFieldSetup()
statusLabelSetup()
Setup function for logo on the view. Specifies the location, size and the syle of it
func statusLabelSetup()
alarmNameLabelSetup()
Setup function for alarm name label on the view. Specifies the location, size and the syle of it
func alarmNameLabelSetup()
alarmDetailsLabelSetup()
Setup function for alarm details label on the view. Specifies the location, size and the syle of it
func alarmDetailsLabelSetup()
dateLabelSetup()
Setup function for date label on the view. Specifies the location, size and the syle of it
func dateLabelSetup()
timeLabelSetup()
Setup function for time label on the view. Specifies the location, size and the syle of it
func timeLabelSetup()
backButtonSetup()
Setup function for back button on the view. Specifies the location, size and the syle of it
func backButtonSetup()
backButtonClicked()
action for when button is clicked
@objc func backButtonClicked()
saveButtonSetup()
Setup function for save button on the view. Specifies the location, size and the syle of it
func saveButtonSetup()
saveButtonClicked()
action button for when save button is clicked. Updates data on firebase
@objc func saveButtonClicked()
cancelButtonClicked()
actiong for when cancel button is clicked
@objc func cancelButtonClicked()
deleteButtonSetup()
Setup function for delete button on the view. Specifies the location, size and the syle of it
func deleteButtonSetup()
deleteButtonClicked()
action for when delete button is clicked. Send a request to firebase to delete the data
@objc func deleteButtonClicked()
statusStatusLabelSetup()
Setup function for label for status lable on the view. Specifies the location, size and the syle of it
func statusStatusLabelSetup()
Controller for firebase actions
class FirebaseController
init()
init()
uploadImage(image:imageName:)
upload image to firebase
func uploadImage(image: UIImage, imageName: String)
The main view controller of the app, users see this viewcontroller first when they open the app
class MainVC: RootViewController
newAlarmButton
let newAlarmButton
viewAlarmButton
let viewAlarmButton
pastAlarmsButton
let pastAlarmsButton
stack
let stack
upperQuad
let upperQuad
lowerQuad
let lowerQuad
secondTextView
let secondTextView
viewDidLoad()
override func viewDidLoad()
topLeftButtonTapped()
action for when the top left button is tapped. It prompts the user to record the alarm sound and preview it
override func topLeftButtonTapped()
topRightButtonTapped()
Action for when the top right button is tapped. Here it logs out the user
override func topRightButtonTapped()
secondTextViewSetup()
Setup function for second text view on the view. Specifies the location, size and the syle of it
func secondTextViewSetup()
newAlarmButtonSetup()
Setup function for new alarm button on the view. Specifies the location, size and the syle of it
func newAlarmButtonSetup()
newAlarmButtonClicked()
Action for when new alarm button is clicked. It takes the user to Create New Alarm View Controller
@objc func newAlarmButtonClicked()
viewAlarmButtonSetup()
Setup function for view alarm button on the view. Specifies the location, size and the syle of it
func viewAlarmButtonSetup()
viewAlarmButtonClicked()
action for when the view alarm button is clicked. Takes the user to Current Alarm ListVC
@objc func viewAlarmButtonClicked()
pastAlarmsButtonSetup()
Setup function for past alarm button on the view. Specifies the location, size and the syle of it
func pastAlarmsButtonSetup()
pastAlarmButtonClicked()
Action for when past alarm button is clicked. Presents pastAlarmVC
@objc func pastAlarmButtonClicked()
View controller to show list of past alarms
class PastAlarmListVC: RootViewController, UITableViewDelegate, UITableViewDataSource
RootViewController
, UITableViewDataSource
, UITableViewDelegate
inactiveAlarm
var inactiveAlarm
backButton
let backButton
alarmTable
let alarmTable
tableView(_:numberOfRowsInSection:)
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
tableView(_:cellForRowAt:)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
tableView(_:didSelectRowAt:)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
viewDidLoad()
override func viewDidLoad()
topLeftButtonTapped()
action button for top left button. Takes the user back
override func topLeftButtonTapped()
alarmTableSetup()
Setup function for table view on the view. Specifies the location, size and the syle of it
func alarmTableSetup()
fetchFromFirebase()
fetch data from firebase
func fetchFromFirebase()
View controller to show past alarms
class PastAlarmViewVC: RootViewController, UITextFieldDelegate
RootViewController
, UITextFieldDelegate
backButton
let backButton
detailTextView
let detailTextView
cancelButton
let cancelButton
deleteButton
let deleteButton
alarmDetailsLabel
let alarmDetailsLabel
alarmNameLabel
let alarmNameLabel
dateLabel
let dateLabel
timeLabel
let timeLabel
imageView
let imageView
alarmNameTextField
let alarmNameTextField
alarmDateTextField
let alarmDateTextField
alarmTimeTextField
let alarmTimeTextField
statusLabel
let statusLabel
statusStatusLabel
let statusStatusLabel
selectedTextField
var selectedTextField
status
var status
editable
var editable
screenName
var screenName
alarm
var alarm
viewDidLoad()
override func viewDidLoad()
topLeftButtonTapped()
action for when the top left button is tapped. Takes the user back to the previous view controller
override func topLeftButtonTapped()
detailTextViewSetup()
Setup function for detail text view on the view. Specifies the location, size and the syle of it
func detailTextViewSetup()
prepareDataforDetailTextView()
prepares the data to be show on detail text view
func prepareDataforDetailTextView()
imageViewSetup()
Setup function for image view on the view. Specifies the location, size and the syle of it
func imageViewSetup()
donedatePicker()
done function for when date picker is done
@objc func donedatePicker()
donetimePicker()
done function for when time picker is done
@objc func donetimePicker()
cancelDatePicker()
cancels the date picker
@objc func cancelDatePicker()
alarmNameTextFieldSetup()
Setup function for alarm name text field on the view. Specifies the location, size and the syle of it
func alarmNameTextFieldSetup()
alarmDateTextFieldSetup()
Setup function for alarm date text field on the view. Specifies the location, size and the syle of it
func alarmDateTextFieldSetup()
alarmTimeTextFieldSetup()
Setup function for alarm time text field on the view. Specifies the location, size and the syle of it
func alarmTimeTextFieldSetup()
statusLabelSetup()
Setup function for status label on the view. Specifies the location, size and the syle of it
func statusLabelSetup()
alarmNameLabelSetup()
Setup function for alarm name label on the view. Specifies the location, size and the syle of it
func alarmNameLabelSetup()
alarmDetailsLabelSetup()
Setup function for alarm detail lable on the view. Specifies the location, size and the syle of it
func alarmDetailsLabelSetup()
dateLabelSetup()
Setup function for date label on the view. Specifies the location, size and the syle of it
func dateLabelSetup()
timeLabelSetup()
Setup function for time label on the view. Specifies the location, size and the syle of it
func timeLabelSetup()
cancelButtonSetup()
Setup function for cancel button on the view. Specifies the location, size and the syle of it
func cancelButtonSetup()
cancelButtonClicked()
action for when cancel button is clicked
@objc func cancelButtonClicked()
deleteButtonSetup()
Setup function for delete button on the view. Specifies the location, size and the syle of it
func deleteButtonSetup()
deleteButtonClicked()
action place holder for delete button
@objc func deleteButtonClicked()
statusStatusLabelSetup()
Setup function for status lable on the view. Specifies the location, size and the syle of it
func statusStatusLabelSetup()
class RootViewController: UIViewController
UIViewController
topLeftButton
let topLeftButton
topRightButton
let topRightButton
viewContollerLabel
let viewContollerLabel
buttonStack
let buttonStack
topButtonSize
let topButtonSize
viewDidLoad()
override func viewDidLoad()
topLeftButtonSetup(buttonType:)
func topLeftButtonSetup(buttonType: ButtonType)
topLeftButtonTapped()
@objc func topLeftButtonTapped()
topRightButtonSetup(buttonType:)
func topRightButtonSetup(buttonType: ButtonType)
topRightButtonTapped()
@objc func topRightButtonTapped()
viewControllerLabelSetup(labelType:)
func viewControllerLabelSetup(labelType: VCType)
buttonStackSetup()
func buttonStackSetup()
enum ButtonType
rectangle
case rectangle
square
case square
enum VCType
main
case main
sub
case sub
View controller to handle sign in functionalities
class SignInVC: UIViewController
UIViewController
loginButton
let loginButton
signUpButton
let signUpButton
guestButton
let guestButton
emailTF
let emailTF
passwordTF
let passwordTF
backButton
let backButton
logoImage
let logoImage
errorMessageView
let errorMessageView
viewWillAppear(_:)
Attaches a user listener before the view appears
override func viewWillAppear(_ animated: Bool)
keyboardWillShow(notification:)
raises the view when the keyboard shows up
@objc func keyboardWillShow(notification: NSNotification)
keyboardWillHide(notification:)
lowers the view when the keyboard disappears
@objc func keyboardWillHide(notification: NSNotification)
viewDidLoad()
override func viewDidLoad()
logoImageSetup()
Setup function for logo on the view. Specifies the location, size and the syle of it
func logoImageSetup()
loginButtonSetup()
Setup function for login button on the view. Specifies the location, size and the syle of it
func loginButtonSetup()
loginButtonTapped()
action for when login button is tapped. Checks with firebase and logs the user in
@objc func loginButtonTapped()
errorMessageViewSetup()
Setup function for error mesage on the view. Specifies the location, size and the syle of it
func errorMessageViewSetup()
signUpButtonSetup()
Setup function for signup button on the view. Specifies the location, size and the syle of it
func signUpButtonSetup()
signUpButtonTapped()
action for when signup button is tapped. It registers the user on firebase
@objc func signUpButtonTapped()
emailTFSetup()
Setup function for email textfield on the view. Specifies the location, size and the syle of it
func emailTFSetup()
passwordTFSetup()
Setup function for password textfield on the view. Specifies the location, size and the syle of it
func passwordTFSetup()
backButtonSetup()
Setup function for back button on the view. Specifies the location, size and the syle of it
func backButtonSetup()
View controller that asks for user's information
class UserInfoVC: UIViewController, UITextFieldDelegate
UITextFieldDelegate
, UIViewController
careTakerFirstNameTF
let careTakerFirstNameTF
careTakerLastNameTF
let careTakerLastNameTF
patientFirstNameTF
let patientFirstNameTF
patientLastNameTF
let patientLastNameTF
doneButton
let doneButton
informationLabel
let informationLabel
selectedTextField
var selectedTextField
viewDidLoad()
override func viewDidLoad()
textFieldDidBeginEditing(_:)
Checks when the text field begins editing, assigns the responder based on that
func textFieldDidBeginEditing(_ textField: UITextField)
keyboardWillShow(notification:)
raises the view when keyboard appears
@objc func keyboardWillShow(notification: NSNotification)
keyboardWillHide(notification:)
lowers the view when keybaord disappers
@objc func keyboardWillHide(notification: NSNotification)
informationLabelSetup()
Setup function for information label on the view. Specifies the location, size and the syle of it
func informationLabelSetup()
careTakerFirstNameTFSetup()
Setup function for caretaker first name textfield on the view. Specifies the location, size and the syle of it
func careTakerFirstNameTFSetup()
careTakerLastNameTFSetup()
Setup function for care taker last name textfield on the view. Specifies the location, size and the syle of it
func careTakerLastNameTFSetup()
patientFirstNameTFSetup()
Setup function for patient first name text field on the view. Specifies the location, size and the syle of it
func patientFirstNameTFSetup()
patientLastNameTFSetup()
Setup function for patient last name text field on the view. Specifies the location, size and the syle of it
func patientLastNameTFSetup()
doneButtonSetup()
Setup function for done button on the view. Specifies the location, size and the syle of it
func doneButtonSetup()
doneButtonClicked()
action for when the done button is tapped. It uploads the data to firebase
@objc func doneButtonClicked()
Generated at 2020-05-02T13:30:21-0400 using swift-doc 1.0.0-beta.2.
var dbQueue: DatabaseQueue!
var ref: DatabaseReference!
let userID