DefaultNameSetupViewController

class DefaultNameSetupViewController : UITableViewController, UITextFieldDelegate

It is an editor for the default file name.

  • text field for user to key in file name format.

    Declaration

    Swift

    var cellTextField: UITextField
  • sample text to depict possible date time format.

    Declaration

    Swift

    var cellSampleLabel: UILabel
  • proccessed date format text, such as ‘TIME’ HH:MM:ss, instead of TIME {HH}:{MM}:{ss}

    also used for final date formatting for use in default name callup when saving.

    Declaration

    Swift

    var processedDateFormat: String
  • A value denoting the validity of the processed date format.

    Declaration

    Swift

    var dateFormatIsInvalid: Bool
  • Declaration

    Swift

    let defaultDateFormat: DefaultDateFormat
  • to use UTC time instead of local.

    Declaration

    Swift

    var useUTC: Bool
  • to use en_US_POSIX instead of usual locale. (Force English name scheme)

    Declaration

    Swift

    var useEN: Bool
  • Global Preferences

    Declaration

    Swift

    var preferences: Preferences
  • Built in presets. Should be made addable customs next time.

    Declaration

    Swift

    let presets: [(String, String, String)]
  • Sections of table view

    See more

    Declaration

    Swift

    private enum Sections : Int, CaseIterable
  • Declaration

    Swift

    override func viewDidLoad()
  • Declaration

    Swift

    func addNotificationObservers()

Text Field Related

  • Declaration

    Swift

    @objc
    func dateButtonTapped(_ sender: Notification)
  • Legacy date selection toolbar for iOS 8 use, as it lacks new API for the new toolbar layout.

    Declaration

    Swift

    func createSimpleDateSelectionBar() -> UIToolbar
  • Handles text insertion as per keyboard bar button pressed.

    Declaration

    Swift

    @objc
    func buttonTapped(_ sender: UIBarButtonItem, for event: UIEvent)
  • Call when text field is currently editing, and an update to sample label is required.

    Declaration

    Swift

    @objc
    func updateSampleTextField()

UITextField Delegate

  • Enables keyboard ‘done’ action to resign text field

    Declaration

    Swift

    func textFieldShouldReturn(_ textField: UITextField) -> Bool
  • handling of textfield when editing commence.

    Declaration

    Swift

    func textFieldDidBeginEditing(_ textField: UITextField)
  • handling of textfield when editing is done.

    Declaration

    Swift

    func textFieldDidEndEditing(_ textField: UITextField)
  • allows clear button to operate.

    Declaration

    Swift

    func textFieldShouldClear(_ textField: UITextField) -> Bool

Preference Setting

  • Saves date format to Preferences/UserDefaults

    Declaration

    Swift

    func saveDateFormat(_ dateFormat: String, input: String?, index: Int = -1)

Table View

  • Locks UTC cell such that it cannot be unchecked, for preset that require it.

    Declaration

    Swift

    func lockUTCCell(_ state: Bool)
  • return number of sections based on Sections

    Declaration

    Swift

    override func numberOfSections(in tableView: UITableView) -> Int
  • implement title of each section

    Declaration

    Swift

    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
  • implement footer for input section only

    Declaration

    Swift

    override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String?
  • return number of rows in each section

    Declaration

    Swift

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
  • setup each cell, according its requirements.

    Declaration

    Swift

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
  • handling of cell selection.

    Declaration

    Swift

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