#911 Added/dictionary filter using multiple keys

Merged MaratIbragimov
Coverage Reach
UIKit/UIViewExtensions.swift UIKit/UIImageExtensions.swift UIKit/UIButtonExtensions.swift UIKit/UITextFieldExtensions.swift UIKit/UIScrollViewExtensions.swift UIKit/UITableViewExtensions.swift UIKit/UICollectionViewExtensions.swift UIKit/UIViewControllerExtensions.swift UIKit/UITabBarExtensions.swift UIKit/UIAlertControllerExtensions.swift UIKit/UIImageViewExtensions.swift UIKit/UIBezierPathExtensions.swift UIKit/UIApplicationExtensions.swift UIKit/UINavigationBarExtensions.swift UIKit/UITextViewExtensions.swift UIKit/UINavigationControllerExtensions.swift UIKit/UILabelExtensions.swift UIKit/UISegmentedControlExtensions.swift UIKit/UIWindowExtensions.swift UIKit/UIStackViewExtensions.swift UIKit/UIFontExtensions.swift UIKit/UISearchBarExtensions.swift UIKit/UISliderExtensions.swift UIKit/UIBarButtonItemExtensions.swift UIKit/UIRefreshControlExtensions.swift UIKit/UIStoryboardExtensions.swift UIKit/UIColorExtensions.swift UIKit/UINavigationItemExtensions.swift UIKit/UILayoutPriorityExtensions.swift UIKit/UIDatePickerExtensions.swift UIKit/UIGestureRecognizerExtensions.swift UIKit/UISwitchExtensions.swift SwiftStdlib/StringExtensions.swift SwiftStdlib/SequenceExtensions.swift SwiftStdlib/IntExtensions.swift SwiftStdlib/RangeReplaceableCollectionExtensions.swift SwiftStdlib/DictionaryExtensions.swift SwiftStdlib/ArrayExtensions.swift SwiftStdlib/CharacterExtensions.swift SwiftStdlib/CollectionExtensions.swift SwiftStdlib/SignedIntegerExtensions.swift SwiftStdlib/OptionalExtensions.swift SwiftStdlib/FloatingPointExtensions.swift SwiftStdlib/MutableCollectionExtensions.swift SwiftStdlib/StringProtocolExtensions.swift SwiftStdlib/KeyedDecodingContainerExtensions.swift SwiftStdlib/SignedNumericExtensions.swift SwiftStdlib/DoubleExtensions.swift SwiftStdlib/FloatExtensions.swift SwiftStdlib/BoolExtensions.swift SwiftStdlib/ComparableExtensions.swift SwiftStdlib/BinaryFloatingPointExtensions.swift SwiftStdlib/DecodableExtensions.swift SwiftStdlib/BidirectionalCollectionExtensions.swift Foundation/DateExtensions.swift Foundation/NSAttributedStringExtensions.swift Foundation/URLExtensions.swift Foundation/NSRegularExpressionExtensions.swift Foundation/FileManagerExtensions.swift Foundation/URLRequestExtensions.swift Foundation/LocaleExtensions.swift Foundation/NSPredicateExtensions.swift Foundation/UserDefaultsExtensions.swift Foundation/DataExtensions.swift Foundation/NotificationCenterExtensions.swift Foundation/CalendarExtensions.swift Shared/ColorExtensions.swift Shared/EdgeInsetsExtensions.swift CoreGraphics/CGSizeExtensions.swift CoreGraphics/CGPointExtensions.swift CoreGraphics/CGFloatExtensions.swift CoreGraphics/CGVectorExtensions.swift CoreGraphics/CGRectExtensions.swift CoreGraphics/CGColorExtensions.swift CoreGraphics/CGAffineTransformExtensions.swift SceneKit/SCNVector3Extensions.swift SceneKit/SCNBoxExtensions.swift SceneKit/SCNCylinderExtensions.swift SceneKit/SCNCapsuleExtensions.swift SceneKit/SCNConeExtensions.swift SceneKit/SCNPlaneExtensions.swift SceneKit/SCNSphereExtensions.swift SceneKit/SCNShapeExtensions.swift SceneKit/SCNMaterialExtensions.swift SceneKit/SCNGeometryExtensions.swift AppKit/NSViewExtensions.swift AppKit/NSImageExtensions.swift AppKit/NSColorExtensions.swift CoreAnimation/CATransform3DExtensions.swift CoreAnimation/CAGradientLayerExtensions.swift CoreLocation/CLLocationExtensions.swift CoreLocation/CLLocationArrayExtensions.swift CoreLocation/CLVisitExtensions.swift SpriteKit/SKNodeExtensions.swift MapKit/MKMapViewExtensions.swift MapKit/MKPolylineExtensions.swift Dispatch/DispatchQueueExtensions.swift StoreKit/SKProductExtensions.swift WebKit/WKWebViewExtensions.swift HealthKit/HKActivitySummaryExtensions.swift

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.

Showing 1 of 3 files from the diff.

@@ -110,6 +110,23 @@
Loading
110 110
    func compactMapKeysAndValues<K, V>(_ transform: ((key: Key, value: Value)) throws -> (K, V)?) rethrows -> [K: V] {
111 111
        return [K: V](uniqueKeysWithValues: try compactMap(transform))
112 112
    }
113 +
114 +
    /// SwifterSwift: Creates a new dictionary using specified keys
115 +
    ///
116 +
    ///        var dict =  ["key1": 1, "key2": 2, "key3": 3, "key4": 4]
117 +
    ///        dict.pick(keys: ["key1", "key3", "key4"]) -> ["key1": 1, "key3": 3, "key4": 4]
118 +
    ///        dict.pick(keys: ["key2"]) -> ["key2": 2]
119 +
    ///
120 +
    /// - Complexity: O(K), where _K_ is the length of the keys array.
121 +
    ///
122 +
    /// - Parameter keys: An array of keys that will be the entries in the resulting dictionary.
123 +
    ///
124 +
    /// - Returns: A new dictionary that contains the specified keys only. If none of the keys exist, an empty dictionary will be returned.
125 +
    func pick(keys: [Key]) -> [Key: Value] {
126 +
        keys.reduce(into: [Key: Value]()) { result, item in
127 +
            result[item] = self[item]
128 +
        }
129 +
    }
113 130
}
114 131
115 132
// MARK: - Methods (Value: Equatable)

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
Sources/SwifterSwift +<.01% 92.83%
Project Totals (100 files) 92.83%
Loading