From f6dc900400a8ee55c2ab675c62355123fed5f8fc Mon Sep 17 00:00:00 2001 From: Ornithologist Coder Date: Wed, 18 Oct 2017 10:58:26 +0200 Subject: [PATCH] Adds more examples with closures --- Rules.md | 16 ++++++++++++++++ .../Rules/MultilineParametersRuleExamples.swift | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/Rules.md b/Rules.md index a329d5309..111d56808 100644 --- a/Rules.md +++ b/Rules.md @@ -7059,6 +7059,22 @@ class Foo { } ``` +```swift +class Foo { + class func foo(param1: Int, + param2: @escaping ((Int) -> Void)? = { _ in }, + param3: Bool) { } +} +``` + +```swift +class Foo { + class func foo(param1: Int, + param2: @escaping ((Int) -> Void)? = { _ in }, + param3: @escaping (Int, Int) -> Void = { _, _ in }) { } +} +``` +
Triggering Examples diff --git a/Source/SwiftLintFramework/Rules/MultilineParametersRuleExamples.swift b/Source/SwiftLintFramework/Rules/MultilineParametersRuleExamples.swift index 54fb82f36..f5963eb5e 100644 --- a/Source/SwiftLintFramework/Rules/MultilineParametersRuleExamples.swift +++ b/Source/SwiftLintFramework/Rules/MultilineParametersRuleExamples.swift @@ -112,6 +112,16 @@ internal struct MultilineParametersRuleExamples { " class func foo(param1: Int,\n" + " param2: Bool,\n" + " param3: @escaping ((Int) -> Void)? = { _ in }) { }\n" + + "}", + "class Foo {\n" + + " class func foo(param1: Int,\n" + + " param2: @escaping ((Int) -> Void)? = { _ in },\n" + + " param3: Bool) { }\n" + + "}", + "class Foo {\n" + + " class func foo(param1: Int,\n" + + " param2: @escaping ((Int) -> Void)? = { _ in },\n" + + " param3: @escaping (Int, Int) -> Void = { _, _ in }) { }\n" + "}" ]