mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
00bfe3c77e
Extracting attribute values enclosed in SourcKit dictionary is common enough to warrant a utility function.
18 lines
458 B
Swift
18 lines
458 B
Swift
//
|
|
// DynamicInlineRule.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by Daniel Duan on 12/08/16.
|
|
// Copyright © 2015 Realm. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SourceKittenFramework
|
|
|
|
extension Dictionary where Key: ExpressibleByStringLiteral {
|
|
var enclosedSwiftAttributes: [String] {
|
|
let array = self["key.attributes"] as? [SourceKitRepresentable] ?? []
|
|
return array.flatMap { ($0 as? [String: String])?["key.attribute"] }
|
|
}
|
|
}
|