title: swift : Cannot convert value of type '()' to expected argument type '[Double]'
body: <p>I am Using Charts on iOS App.</p>
  
  <p>It will get data from bluetooth and save as Array = []</p>
  
  <p>It has to convert to [Double] when It draws charts</p>
  
  <pre><code>func setChart(values: [Double]) {
          // mChart.noDataText = "No data available!"
          for i in 0..&lt;values.count {
              print("chart point : \(values[i])")
              let dataEntry = ChartDataEntry(x: Double(i), y: values[i])
              dataEntries.append(dataEntry)
          }
  </code></pre>
  
  <p>These are the codes that draw graph.</p>
  
  <pre><code>for i in 1...transferedData.endIndex-1{
          setChart(values : transferedData[i]) // Cannot convert value of type 'String' to expected argument type '[Double]'
         setChart(values: transferedData.map{ Double($0)}) //Cannot convert value of type 'Double?' to closure result type 'Double'
      }
  </code></pre>
  
  <p>These are the codes that I have tried to add data to setChart from transferedData.</p>
  
  <p>I have found the internet but I couldn't solve this.</p>
  
  <p>What should I do for this problem?</p>
  
  <p>************************** Edited ********************************</p>
  
  <p>I have two Swift file Now.</p>
  
  <p>One is for data transfer and the other is for draw graph.</p>
  
  <p>this is for saving and processing data.
  (SerialViewController.swift)</p>
  
  <pre><code>public var UserDis : Array&lt;String&gt; = []
  
  func getRealDataProcess(){        
          splitUserData = receivedDataForReal.split(separator: ";") 
          for j in 0...splitUserData.endIndex-1 { 
              if splitUserData[j].count == 14{ 
                  checkedUser14Data.append(String(splitUserData[j]))
              }
          }
  
          for k in 0...checkedUser14Data.endIndex-1{
              var strForCal = checkedUser14Data[k]
              var valDis = strForCal[strForCal.startIndex...strForCal.index(strForCal.startIndex, offsetBy: 4)] 
              UserDis.append(String(valDis))
          }
  
      }
  </code></pre>
  
  <p>And this is for drawing graph.
  (GraphViewController.swift)</p>
  
  <pre><code>for i in 0...transferedData.endIndex-1{
              let inputData = Double(transferedData[i])!
              setChart(values: [inputData])
          }
  </code></pre>
  
  <p>Thread 1: Fatal error: Can't form Range with upperBound &lt; lowerBound is occurring now at the transferredData.endIndex-1</p>