Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-622

Use default values for variables rather than setting default values via initializer for options structs

    XMLWordPrintable

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • 2.0.0
    • None

    Description

      As of Swift 5.1 / SE-0242 the compiler will generate the initializers we need if we just provide the default values on the properties themselves.

      E.g. we can change any place we have something like the following:

      struct SomeOptions {
          var x: Int?
       
          init(x: Int? = nil) {
              self.x = x
          }
      }
      

      to just

      struct SomeOptions {
          var x: Int? = nil
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kaitlin.mahar@mongodb.com Kaitlin Mahar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: