CGA_CharacteristicViewController

class CGA_CharacteristicViewController : CGA_BaseViewController, CGA_WriteableElementContainer
extension CGA_CharacteristicViewController: CGA_UpdatableScreenViewController
extension CGA_CharacteristicViewController: UITableViewDataSource
extension CGA_CharacteristicViewController: UITableViewDelegate

This controls the Characteristic Information View.

  • The reuse ID that we use for creating new table cells.

    Declaration

    Swift

    private static let _descriptorRowReuseID: String
  • The ID of the segue that is executed to display the Descriptor Interaction Screen.

    Declaration

    Swift

    private static let _interactionDescriptorSegueID: String
  • This implements a “pull to refresh.”

    Declaration

    Swift

    private let _refreshControl: UIRefreshControl
  • The Characteristic that is associated with this view controller.

    Declaration

    Swift

    var writeableElementInstance: CGA_Bluetooth_Writable?
  • The Characteristic that is associated with this view controller, cast from the writable entity.

    Declaration

    Swift

    var myCharacteristicInstance: CGA_Bluetooth_Characteristic? { get }
  • This is the table that will list the descriptors.

    Declaration

    Swift

    @IBOutlet
    weak var descriptorsTableView: UITableView!
  • This button allows interaction with the Characteristic.

    Declaration

    Swift

    @IBOutlet
    weak var interactionButton: UIButton!

Callback/Observer Methods

  • This is called by the table’s “pull to refresh” handler.

    When this is called, the Characteristic wipes out its Descriptors, and starts over from scratch.

    Declaration

    Swift

    @objc
    func startOver(_: Any)

Private Methods

  • This sets up the accessibility and voiceover strings for the screen.

    Declaration

    Swift

    func setUpAccessibility()

Instance Methods

  • This forces a re-read of all descriptors.

    Declaration

    Swift

    func updateAllDescriptors()

CGA_UpdatableScreenViewController Conformance

  • This simply makes sure that the UI matches the state of the Characteristic.

    Declaration

    Swift

    func updateUI()

Base Class Override Methods

  • Called after the view data has been loaded.

    Declaration

    Swift

    override func viewDidLoad()
  • This is called just before we bring in the Interaction screen.

    Declaration

    Swift

    override func prepare(for inSegue: UIStoryboardSegue, sender inSender: Any?)

    Parameters

    for

    The segue being executed.

    sender

    The data we want passed into the destination (ignored).

UITableViewDataSource Conformance

  • This returns the number of available rows, in the given section.

    Declaration

    Swift

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

    Parameters

    inTableView

    The table view that is asking for the row count.

    numberOfRowsInSection

    The 0-based section index being queried.

    Return Value

    The number of rows in the given section.

  • This returns a view, with the data for the given row and section.

    Declaration

    Swift

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

    Parameters

    inTableView

    The table view that is asking for the cell.

    cellForRowAt

    The index path (section, row) for the cell.

UITableViewDelegate Conformance

  • Called when a row is selected.

    Declaration

    Swift

    func tableView(_ inTableView: UITableView, didSelectRowAt inIndexPath: IndexPath)

    Parameters

    inTableView

    The table view that is asking for the cell.

    didSelectRowAt

    The index path (section, row) for the cell.