Calling detection block in swift
dcods22 opened this issue · comments
Daniel Cody commented
Hi I was wondering how to call detection block in swift
I get an error trying
label.detectionBlock{
(hotWord:STTweetHotWord, str:NSString, protocolStr:NSString, range:NSRange) -> Void in
}
Thanks
Sebastian Thiebaud commented
The syntax you're using looks wrong.
Daniel Cody commented
What would the proper syntax be?
Daniel Cody
631-365-9940
Daniel.Cody2@Marist.edu
Marist Class of 2015
On Apr 28, 2015, at 2:06 PM, Seb C. Thiebaud notifications@github.com wrote:
The syntax you're using look wrong.
—
Reply to this email directly or view it on GitHub.
Sebastian Thiebaud commented
I guess something like
let tweetLabel: STTweetLabel = STTweetLabel()
tweetLabel.detectionBlock = {
(hotword: STTweetHotWord, text: String!, protocolString: String!, range: NSRange) -> Void in
//do something here
}
should work. (not tested)
David Whetstone commented
This works:
label.detectionBlock = {
hotword, string, prot, range in
NSLog("%@", string)
}