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

@escaping and inout should work together but don't

    XMLWordPrintable

    Details

      Description

      The following code does not work, but according to Joe Groff it should: https://twitter.com/jckarter/status/1082421111982219264

      // 'inout' may only be used on parameters
      func foo(f: @escaping inout () -> Void) {}
      
      // @escaping attribute may only be used in function parameter position
      func foo(f: inout @escaping () -> Void) {}
      

      It must be possible to combine these attributes in order to capture a copy of an inout argument and call it later.

        Attachments

          Activity

            People

            Assignee:
            rayfix Ray Fix
            Reporter:
            Anandabits Matthew Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: