m1entus / MZSelectableLabel

A simple to use drop in replacement for UILabel for iOS 7 that provides automatic detection of colors.
MIT License
102 stars 16 forks source link

use in Swift #7

Closed shjnbe closed 8 years ago

shjnbe commented 8 years ago

self.label.selectionHandler = ^(NSRange range, NSString *string) { // Put up an alert with a message if it's not an URL

    NSString *message = [NSString stringWithFormat:@"You tapped %@", string];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello"
                                                    message:message
                                                   delegate:nil
                                          cancelButtonTitle:@"Dismiss"
                                          otherButtonTitles:nil];
    [alert show];
};

i can't convert this code to swift code. Help me

m1entus commented 8 years ago

label.selectionHandler = { range, string in /* show alert*/ }