title: Where to declare extensions in SwiftUI?
body: <p>I have declared an extensions of Double at the end of ContentView. But it shows error "Initializeer 'init(_:) requires that 'Double' conform to 'StringProtocol'".</p>
  
  <pre class="lang-swift prettyprint-override"><code>struct ContentView : View {
      @State var demo: Double = 0
      var body: some View {
          VStack {
              Slider(value: $demo, from: 0.0, through: 100.0, by: 0.01)
                  .padding()
              Text(demo.roundTo(places: 5))
         }
      }
  }
  extension Double {
      public func roundTo(places: Int) -&gt; Double {
          let divisor = pow(10.0, Double(places))
          return (self * divisor).rounded() / divisor
      }
  }
  </code></pre>