title: How to get sorted struct into another struct/dictionary using swift3?
body: <p>I'm trying to create alphabetic sections in my TableView, so far I'v managed to get my database into struct and get the fist letter of every name from my database and sort it for the section header.
  My problem is that I don't get the sorted variable into the another struct and show it in the table.</p>
  
  <p>My structs:</p>
  
  <pre><code>struct CrimesInfo {
  
      let name: String
      let detail: String
      let time: String
  
  
      init(name:String, detail: String, time: String) {
          self.name = name
          self.detail = detail
          self.time = time
      }
  
      init(fromResultSet: FMResultSet) {
          self.init(
              name: fromResultSet.string(forColumn: "Name"),
              detail: fromResultSet.string(forColumn: "Detail"),
              time: fromResultSet.string(forColumn: "Time")
          )
  
      }
  }
  
  struct CrimeNameSection {
  
      var firstLetter: Character
      var crimes: [CrimesInfo]
  
      init(title: Character, objects: [CrimesInfo]) {
          firstLetter = title
          crimes = objects
      }
  }
  </code></pre>
  
  <p>My database store in struct 'CrimesInfo', after the sorting I want to insert it into the struct 'CrimeNameSection' (title: the first letter of 'name', objects: the rest of the data accordingly).</p>
  
  <p>My code:</p>
  
  <pre><code>class SectionData {
  
      var crimeInfo : [CrimesInfo] = []
  
      func getCrimesData() {
          crimeInfo = ModelManager.getInstance().getAllCrimeInfo() // get the database into the struct
      }
  
      func getSectionFromData() -&gt; [CrimeNameSection] { // get the fisrt letter of 'name', sort it and get in the another struct
          var crimeIndex = [Character: [CrimesInfo]]()
          var CrimeSections = [CrimeNameSection]()
          for crime in crimeInfo {
              if let firstCharacter = crime.name.characters.first {
                  if crimeIndex[firstCharacter] == nil {
                      crimeIndex[firstCharacter] = [crime]
                  } else {
                      crimeIndex[firstCharacter]?.append(crime)
              }
          }
      }
  
      let sortedIndex = crimeIndex.sorted { $0.0 &lt; $1.0 } // type: [(key: Character, value:[CrimesInfo])]
  
      for key in sortedIndex { // get the sorted data into struct 'CrimeNameSection'
          let sortedSections = CrimeNameSection(title: sortedIndex(key), objects: sortedIndex(value)) // error: 'Use of unresolved identifier 'value'
      }
  
      CrimeSections.append(sortedSections)
  
      return CrimeSections
      }
  }
  </code></pre>