ios - Cannot invoke method snackbarWithMessage with an argument list -
i can't understand why method call incorrect. i'm trying use sssnackbar ios swift. has method following signature:
@implementation sssnackbar + (instancetype)snackbarwithmessage:(nsstring *)message actiontext:(nsstring *)actiontext duration:(nstimeinterval)duration actionblock:(void (^)(sssnackbar *sender))actionblock dismissalblock:(void (^)(sssnackbar *sender))dismissalblock {
my call of method:
var bar = sssnackbar.snackbarwithmessage("success auth" nsstring, actiontext: "ok" nsstring, duration : nstimeinterval(5), actionblock: {(sender: sssnackbar) -> () in println("snackbar action") }, dismissalblock:nil)
documentations says dismissalblock can nil. compile error: error:(48, 38) cannot invoke 'snackbarwithmessage' argument list of type '(nsstring, actiontext: nsstring, duration: double, actionblock: (sssnackbar) -> (), dismissalblock: nil)'
i tried without casting string
nsstring
, not nil
dismissalblock
upd: have fixed this:
var bar = sssnackbar(message:"success auth", actiontext: "ok", duration : nstimeinterval(5) , actionblock: {snackbar in println("clicked")}, dismissalblock:nil)
i solved issue:
var bar = sssnackbar(message:"success auth", actiontext: "ok", duration : nstimeinterval(5) , actionblock: {snackbar in println("clicked")}, dismissalblock:nil)
i don't understand why should call constructor instead of call static class member, seems same in question.
Comments
Post a Comment