title: Refactor your code to get this URI from a customizable parameter in Swift project for Sonarqube
body: <p>I am working on an iOS project, For code quality/coverage checking I have set up Sonarqube into my project. It is a good library to check code quality.</p>
  <p>It is running successfully and we have fixed most of the issues too.
  And for API URLs we have declared in some constant classes and calling each one to the corresponding class.
  But, Sonarqube throwing the following error for that, and I cannot understand that for resolve.</p>
  <p><code>SomeConstant.Swift</code></p>
  <pre><code>import Foundation
  
  struct SomeConstant {
      static let signInURL = &quot;https://somesigninurl.com&quot;
      static let signUpURL = &quot;https://somesignuprl.com&quot;
      static let baseURL = &quot;https://somebaseurl.com&quot;
      static let dashBoard = &quot;&quot;\(baseurl)&quot;/dashboard/&quot;
  }
  </code></pre>
  <p>Error</p>
  <blockquote>
  <p>Refactor your code to get this URI from a customizable parameter.</p>
  </blockquote>
  <p>Their documentation gave the following solution, But I am not getting why they call encoding and all other things. So, I did get properly understand below code</p>
  <p>How to resolve this, Any suggestions?</p>
  <pre><code>public class Foo {
      // Configuration is a class that returns customizable properties: it can be mocked to be injected during tests.
      private var config:Configuration
      public init(myConfig:Configuration) {
          config = myConfig
      }
      public func listUsers() -&gt; [User] {
          var users:[User]
          // Find here the way to get the correct folder, in this case using the Configuration object
          let location = config.getProperty(&quot;myApplication.listingFile&quot;)
          // and use this parameter instead of the hard coded path
          let fileContent = NSString(contentsOfFile: location, encoding: NSUTF8StringEncoding, error: nil)
          users = parse(fileContent!)
          return users
      }
  }
  </code></pre>