4 Replies
      Latest reply on Sep 13, 2019 10:46 AM by ssshhh
      ssshhh Level 1 Level 1 (0 points)

        In the XCode Playground editor, there is result views at the right hand side after the code is executed in playground. I notice that some of the displayed variable values has a description "fixed". What does "fixed" mean in this context?

        Thank you!

        • Re: Playground Editor: what does the "fixed" in view results mean?
          eskimo Apple Staff Apple Staff (12,305 points)

          I’m not entirely sure what you’re getting at here, so some questions:

          • Are all the variables that exhibit this behaviour of the same type?

          • What type (or types) are they?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Playground Editor: what does the "fixed" in view results mean?
              ssshhh Level 1 Level 1 (0 points)

              Hi eskimo

               

              I think posting some code can make what I am referring to clear:

               

              // create calendar

              var calGreg: Calendar

              calGreg = Calendar(identifier: .gregorian)

              var calBudd: Calendar

              calBudd = Calendar(identifier: .buddhist)

               

              After running in the playground, the result displayed at the right hand side for the two assignment statements are:

               

              gregorian (fixed)

              buddhist (fixed)

               

              I am just wondering what does the "(fixed)" indicate.

               

              Thank you.

                • Re: Playground Editor: what does the "fixed" in view results mean?
                  eskimo Apple Staff Apple Staff (12,305 points)

                  I think posting some code can make what I am referring to clear:

                  It did indeed.  Thanks.

                  In this context, the (fixed) is not a feature of the playground but a feature of Calendar.  Consider this snippet:

                  import Foundation
                  
                  let cal = Calendar.autoupdatingCurrent

                  It logs gregorian (autoupdatingCurrent).  In the world of Calendar, there are two types of calendars:

                  • An auto-updating calendar tracks user settings.  For example, if the user goes to Settings > General > Language & Region > Calendar and changes their calendar, the auto-updating calendar will start returning results based on that new calendar.

                  • A fixed calendar is… well… fixed.  Once you create a calendar value, it will continue return results based on that calendar, regardless of any user settings changes.

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"