SwiftUITerminal - TJohn2017/Laputa GitHub Wiki

SwiftUITerminal.swift

Note that the code for SwiftUITerminal is maintained on the same page as SSHTerminalViewController.

General Attributes

SwiftUI receives a number of inputs on initializing:

Attribute Type Description
canvas Canvas? a binding Canvas optional that SwiftUITerminal will pass to SSHTerminalViewController for code-card saving
connections [SSHConnection] array of connections for SwiftUITerminal to select the it's target connection
connectionIdx Int index that indicates which connection to pass (from connections) to SSHTerminalViewController
modifyTerminalHeight Bool boolean that indicates whether to initialize in a split-state or normal state.
splitScreenHeight CGFloat indicates what height to set the terminal component to
id Int id value meant to uniquely identify a stored static variable SSHTerminalViewController (for multiple terminal functionality)
sshVCsNormal [Int: SSHTerminalViewController] static array of SSHTerminalViewControllers in normal state
sshVCsSplit [Int: SSHTerminalViewController] static array of SSHTerminalViewControllers in split state

Methods

All methods in SwiftUITerminal are default with the UIViewControllerRepresentable protocol except for one method that was added:

dismantleAllSessionStates()

This function clears all the elements from the SSHTerminalViewController static arrays. Meant to be used when a session ends and these view controllers don't need to be saved any more.