Skip to content

[SR-1009] Add methods to an Array containing a specific type #43621

Description

@swift-ci
Previous ID SR-1009
Radar rdar://problem/17821143
Original Reporter mattdipasquale (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels New Feature
Assignee @slavapestov
Priority Medium

md5: b6b1e530310ef2059d8fb2110e717e5f

is duplicated by:

  • SR-1447 Concrete same-type requirements

Issue Description:

For example, if I'd like to activate the constraints inside of constraints: [NSLayoutConstraint], instead of writing NSLayoutConstraint.activateConstraints(constraints), I'd like to write constraints.activate(). However, the compiler should only allow calling activate() on an array if the contained type implements activate(). Note: Apple's documentation says: "Typically, using [the activateConstraints()] method is more efficient than activating each constraint individually." So, constraints.activate() would be faster than constraints.map { $0.active = true }.

Metadata

Metadata

Assignees

Labels

compilerThe Swift compiler itselfgenericsFeature: generic declarations and types

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions