Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify contains(where:) with Key Paths #2471

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/Layers/ShapeItemLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ShapeItemLayer: BaseAnimationLayer {
"`ShapeItemLayer` must contain exactly one `ShapeItem` that draws a `GPPath`")

try context.compatibilityAssert(
!otherItems.contains(where: { $0.item.drawsCGPath }),
!otherItems.contains(where: \.item.drawsCGPath),
"`ShapeItemLayer` must contain exactly one `ShapeItem` that draws a `GPPath`")

super.init()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Private/CoreAnimation/Layers/ShapeLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ extension CALayer {
// but in practice can be any combination of items. The implementation expects all path-drawing
// shape items to be managed by a `GroupLayer`, so if there's a top-level path item we
// have to create a placeholder group.
if parentGroup == nil, otherItems.contains(where: { $0.item.drawsCGPath }) {
if parentGroup == nil, otherItems.contains(where: \.item.drawsCGPath) {
groupItems = [Group(items: items.map { $0.item }, name: "")]
otherItems = []
}
Expand Down
Loading