Skip to content

Commit

Permalink
Merge pull request #2020 from marcelofabri/enclosedSwiftAttributes-4.1
Browse files Browse the repository at this point in the history
Fix enclosedSwiftAttributes in Swift 4.1
  • Loading branch information
marcelofabri authored Jan 25, 2018
2 parents 203d243 + 19edf26 commit 0105b1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
[Marcelo Fabri](https://github.com/marcelofabri)
[#2017](https://github.com/realm/SwiftLint/issues/2017)

* Fix several rules that use attributes when linting with Swift 4.1 toolchain.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2019](https://github.com/realm/SwiftLint/issues/2019)

## 0.24.2: Dented Tumbler

#### Breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ extension Dictionary where Key: ExpressibleByStringLiteral {

var enclosedSwiftAttributes: [String] {
let array = self["key.attributes"] as? [SourceKitRepresentable] ?? []
return array.flatMap { ($0 as? [String: String])?["key.attribute"] }
let dictionaries = array.flatMap { ($0 as? [String: SourceKitRepresentable]) }
return dictionaries.flatMap { $0["key.attribute"] as? String }
}

var substructure: [[String: SourceKitRepresentable]] {
Expand Down

0 comments on commit 0105b1c

Please sign in to comment.