Uploaded image for project: 'Swift'
  1. Swift
  2. SR-1009

Add methods to an Array containing a specific type

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
      None

      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 }

      .

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                slavapestov Slava Pestov
                Reporter:
                mattdipasquale Matthew Di Pasquale
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: