@@ -16,7 +16,6 @@ class ChatViewController: UIViewController {
16
16
@IBOutlet weak var textFieldBottomConstraint : NSLayoutConstraint !
17
17
18
18
// MARK: - Variables
19
-
20
19
var vm : ChatViewModelProtocols !
21
20
22
21
// MARK: - ViewController Life Cycle
@@ -42,7 +41,6 @@ class ChatViewController: UIViewController {
42
41
}
43
42
44
43
// MARK: - Keyboard
45
-
46
44
@objc func keyboardWillShow( _ notification: Notification ) {
47
45
if let keyboardSize = ( notification. userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? NSValue ) ? . cgRectValue {
48
46
let keyboardHeight = keyboardSize. height
@@ -81,8 +79,8 @@ class ChatViewController: UIViewController {
81
79
sendMessageToChatGPT ( message)
82
80
}
83
81
}
84
- // MARK: - NetworkCall
85
82
83
+ // MARK: - NetworkCall
86
84
func sendMessageToChatGPT( _ message: String ) {
87
85
88
86
vm. reloadTableView = {
@@ -105,7 +103,9 @@ class ChatViewController: UIViewController {
105
103
}
106
104
}
107
105
}
106
+
108
107
}
108
+
109
109
// MARK: - UITableViewDataSource
110
110
extension ChatViewController : UITableViewDataSource {
111
111
func tableView( _ tableView: UITableView , numberOfRowsInSection section: Int ) -> Int {
@@ -131,6 +131,7 @@ extension ChatViewController: UITableViewDataSource {
131
131
132
132
}
133
133
}
134
+
134
135
// MARK: - UITableViewDelegate
135
136
extension ChatViewController : UITableViewDelegate {
136
137
func tableView( _ tableView: UITableView , heightForRowAt indexPath: IndexPath ) -> CGFloat {
@@ -141,6 +142,7 @@ extension ChatViewController: UITableViewDelegate {
141
142
return labelHeight + 20 // Add padding
142
143
}
143
144
}
145
+
144
146
// MARK: - UITextFieldDelegate
145
147
extension ChatViewController : UITextFieldDelegate {
146
148
func textField( _ textField: UITextField , shouldChangeCharactersIn range: NSRange , replacementString string: String ) -> Bool {
@@ -152,8 +154,6 @@ extension ChatViewController: UITextFieldDelegate {
152
154
}
153
155
}
154
156
155
-
156
-
157
157
extension String {
158
158
func height( withConstrainedWidth width: CGFloat , font: UIFont ) -> CGFloat {
159
159
let constraintRect = CGSize ( width: width, height: . greatestFiniteMagnitude)
0 commit comments