title: Static variables vs methods to store properties
body: <p>In my SwiftUI application I'm currently using a global struct that holds constants properties like colors or sizes.
  E.g.</p>
  <pre class="lang-swift prettyprint-override"><code>struct App {
      struct Colors {
          static let mainAppColor: UIColor = UIColor(red: 233/255, green: 230/255, blue: 231/255)
          static let mainWhiteColorMiddleOpacity: UIColor = UIColor.white.opacity(0.5)
      }
  }
  
  // usage
  struct ContentView: View {
      var body: some View {
          Rectangle().foregroundColor(App.Colors.mainBlueColor)
      }
  }
  
  </code></pre>
  <p>I was debating whether this is a bad practice since I have LOTS of static variables, and was wondering if replacing them with static methods or computed properties would decrease memory usage (since body gets computed lots of times). E.g. replacement:</p>
  <pre class="lang-swift prettyprint-override"><code>struct App {
      struct Colors {
          static var mainBlueColor: UIColor { UIColor.blue }
          static var mainWhiteColorMiddleOpacity: UIColor { UIColor.white.opacity(0.5) }
      }
  }
  
  // usage
  struct ContentView: View {
      var body: some View {
          Rectangle().foregroundColor(App.Colors.mainBlueColor)
      }
  }
  </code></pre>
  <p>One would increase heap usage and the other stack usage, right?
  What do you think would be the best practice?</p>