0

I am using a library TTGSnackbar in iOS that is written in swift and I have used -Swift.h header to use swift library in objective C.

You can find TTGSnackbar here: http://cocoadocs.org/docsets/TTGSnackbar/0.2.2/

let snackbar = TTGSnackbar(message: "TTGSnackBar !",
                       duration: .middle,
                       actionText: "Action!",
                       actionBlock: { (snackbar) in
        print("Click action!")
})
snackbar.show()

I am stuck while calling action block of ttg library. Ho do I achieve that in objective C? So far what I have done is (and it gives me bug at action block):

TTGSnackbar *ttg = [[TTGSnackbar alloc]init];
        ttg.actionText = @"OK";
        ttg.message = [[remoteMessage appData]valueForKey:@"message"];
        ttg.actionTextColor = [UIColor redColor];
        ttg.duration = TTGSnackbarDurationForever;
        ttg.actionBlock(TTGSnackbar * _Nonnull^{})
        [ttg show];

I wnat TTGSnackbar to dismiss on click of OK button

1 Answer 1

1

You can set actionBlock like this:

[ttg setActionBlock:^(TTGSnackbar * snackbar) {
    NSLog(@"snackbar action");
}];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.