title: Initialise property wrapper with dynamic values in Swift 5
body: <p><strong>Scenario:</strong> </p>
  
  <ol>
  <li><p>I want to have different types of Bonds which has a minimum value, 
      flexi interest current bond worth(calculated on basis of some logic) and bond growth prediction.</p></li>
  <li><p>Whenever bond value
  goes more than minimum value, then the growth prediction becomes
  appreciating and depreciating in vice versa.</p></li>
  <li>I can have multiple
  bonds with their own set of values.</li>
  </ol>
  
  <p>I am trying to use property wrappers for the same so that I do not replicate the same behaviour for every bond:</p>
  
  <pre><code> @propertyWrapper
  struct BondValue {
      private var bondCurrentWorth: Int
      private var minimumValue: Int
      private var flexiInterest: Int
  
      var projectedValue: BondGrowth = .appreciating // The projected value projects the growth for the bond
  
      var wrappedValue: Int {
  
          get {
              return bondCurrentWorth
          }
  
          set {
              bondCurrentWorth = newValue + (newValue * flexiInterest/100)
              projectedValue = bondCurrentWorth &lt; minimumValue ? .depriciating : .appreciating
          } 
   }
  
      init(wrappedValue: Int = 0, minimumValue: Int, flexiInterest: Int, value: Int) {
          self.minimumValue = minimumValue
          self.flexiInterest = flexiInterest
          self.bondCurrentWorth = value
      }
  }
  </code></pre>
  
  <p>No for creating any bond, I do:</p>
  
  <pre><code>struct FoodBond {
      var bondName: String
      @BondValue(minimumValue: 200, flexiInterest: 30, value: 200) var value = 30
  
      init(bondName: String, minimumValue: Int, flexiInterest: Int, value: Int) {
          self.bondName = bondName
      }
  }
  </code></pre>
  
  <p><strong>Problem statement:</strong>
  - I am not able to initialise the bondvalue with dynamic values.</p>
  
  <p><strong>Possible workaround:</strong>
  I would use the same approach as a normal struct in the below implementation. Though this way of using property wrapper is also specified in the docs, <strong><em>but I would loose the syntactic flavour of the property wrappers.</em></strong></p>
  
  <blockquote>
    <p>You could write code that uses the behavior of a property wrapper,
    without taking advantage of the special attribute syntax. For example,
    here’s a version of SmallRectangle from the previous code listing that
    wraps its properties in the TwelveOrLess structure explicitly, instead
    of writing @TwelveOrLess as an attribute</p>
  </blockquote>
  
  <pre><code>@propertyWrapper
  struct BondValue {
      private (set) var bondCurrentWorth: Int
      private (set) var minimumValue: Int
      private (set) var flexiInterest: Int
  
      var projectedValue: BondGrowth = .appreciating // The projected value projects the growth for the bond
  
      var wrappedValue: Int { .... }
  
      init(wrappedValue: Int = 0, minimumValue: Int, flexiInterest: Int, value: Int) { ... }
  }
  
  struct FoodBond {
      var bondName: String
      var value = BondValue(minimumValue: 0, flexiInterest: 0, value: 0) // Provide a default value
  
      init(bondName: String, minimumValue: Int, flexiInterest: Int, value: Int) {
          self.bondName = bondName
          self.value = BondValue(minimumValue: minimumValue, flexiInterest: flexiInterest, value: value)
      }
  }
  
  var foodBond = FoodBond(bondName: "Food Bond", minimumValue: 200, flexiInterest: 10, value: 200)
  print("Initial bond current worth - \(foodBond.value.bondCurrentWorth)")
  print("Bond growth - \(foodBond.value.projectedValue)")
  </code></pre>
  
  <p>Any suggestions will be really helpful.</p>