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

Nested functions need to be defined in code before they are used

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Medium
    • Resolution: Won't Do
    • Component/s: None
    • Labels:
      None

      Description

      One approach to using nested functions is grouping pieces of code, for instance, configuration of several views in a function called `configureViews`.

      In such task, the natural way of looking at it would be to call the functions first, as they serve as a sort of summary, and then define the functions later.

      Doing so will result in the following error being displayed:
      `Use of local variable `[functionName]` before its declaration`

      See attached Playground.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mariano Mariano Abdala
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: