SebastianThiebaud / STTweetLabel

Deprecated - A UILabel with #hashtag @handle and links tappable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling detection block in swift

dcods22 opened this issue · comments

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

The syntax you're using looks wrong.

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.

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)

This works:

        label.detectionBlock = {
            hotword, string, prot, range in
            NSLog("%@", string)
        }