Skip to content

Added ShortHandler#37

Merged
sgr-ksmt merged 4 commits intodevelopfrom
refactor_handler
Jul 5, 2019
Merged

Added ShortHandler#37
sgr-ksmt merged 4 commits intodevelopfrom
refactor_handler

Conversation

@sgr-ksmt
Copy link
Copy Markdown
Owner

@sgr-ksmt sgr-ksmt commented Jul 5, 2019

I just implemented ShortHandler.
By using this ShortHandler, it is possible to avoid writing `(_, _, _) in closure if you don't use closure arguments.

Before

Alertift.alert(title: "Sample 2",message: "Do you like 🍣?")
    .action(.default("Yes"), isPreferred: true) { _, _, _ in
        Alertift.alert(message: "🍣🍣🍣")
            .action(.default("Close"))
            .show()
    }
    .action(.cancel("No")) { _, _, _ in
        Alertift.alert(message: "😂😂😂")
            .action(.destructive("Close"))
            .show()
    }
    .show()

After

Alertift.alert(title: "Sample 2",message: "Do you like 🍣?")
    .action(.default("Yes"), isPreferred: true) {
        Alertift.alert(message: "🍣🍣🍣")
            .action(.default("Close"))
            .show()
    }
    .action(.cancel("No")) {
        Alertift.alert(message: "😂😂😂")
            .action(.destructive("Close"))
            .show()
    }
    .show()

Diff

+     .action(.default("Yes"), isPreferred: true) {
-     .action(.default("Yes"), isPreferred: true) { _, _, _ in

@sgr-ksmt sgr-ksmt merged commit 51ac554 into develop Jul 5, 2019
@sgr-ksmt sgr-ksmt deleted the refactor_handler branch July 5, 2019 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant