@@ -111,83 +111,28 @@ public protocol HandlerRecastRequestProtocol : class
111
111
Implement those metods in your ViewController.
112
112
113
113
``` swift
114
- import RecastAI
115
-
116
114
/**
117
- Class ViewController Example of implementations for Text & Voice Requests
118
- */
119
- class ViewController : UIViewController , HandlerRecastRequestProtocol
120
- {
121
- // Outlets
122
- @IBOutlet weak var requestTextField: UITextField!
123
-
124
- // Vars
125
- var app : RecastAPI?
126
- var recording : Bool = true
127
-
128
- override func viewDidLoad ()
129
- {
130
- super .viewDidLoad ()
131
- // Do any additional setup after loading the view, typically from a nib.
115
+ Method called when the request was successful
132
116
133
- // Initialise app with token & handlerRecastProtocol
134
- self .app = RecastAPI (token : " YOUR_APP_TOKEN" , handlerRecastRequestProtocol : self )
135
- }
136
-
137
- /**
138
- Method called when the request was successful
117
+ - parameter response: the response returned from the Recast API
139
118
140
- - parameter response: the response returned from the Recast API
141
-
142
- - returns: void
143
- */
144
- func recastRequestDone (response : Response)
145
- {
146
- print (response.source )
147
- }
148
-
149
- /**
150
- Method called when the request failed
151
-
152
- - parameter error: error returned from the Recast API
119
+ - returns: void
120
+ */
121
+ func recastRequestDone (response : Response)
122
+ {
123
+ print (response.source )
124
+ }
153
125
154
- - returns: void
155
- */
156
- func recastRequestError (error : NSError)
157
- {
158
- print (" Delegate Error : \( error ) " )
159
- }
126
+ /**
127
+ Method called when the request failed
160
128
161
- /**
162
- Make text request to Recast.AI API
163
- */
164
- @IBAction func makeRequest ()
165
- {
166
- if (! (self .requestTextField .text ? .isEmpty )! )
167
- {
168
- // Call makeRequest with string parameter to make a text request
169
- self .app ? .makeRequest (self .requestTextField .text ! )
170
- }
171
- }
129
+ - parameter error: error returned from the Recast API
172
130
173
- /**
174
- Make Voice request to Recast.AI API
175
- */
176
- @IBAction func makeVoiceRequest ()
177
- {
178
- if (self .recording )
179
- {
180
- self .recording = ! self .recording
181
- // Call startVoiceRequest to start recording your voice
182
- self .app ! .startVoiceRequest ()
183
- }
184
- else
185
- {
186
- self .recording = ! self .recording
187
- // Call stopVoiceRequest to stop recording your voice and launch the request to the Recast.AI API
188
- self .app ! .stopVoiceRequest ()
189
- }
190
- }
131
+ - returns: void
132
+ */
133
+ func recastRequestError (error : NSError)
134
+ {
135
+ print (" Delegate Error : \( error ) " )
191
136
}
192
137
```
193
138
0 commit comments