You get this warning because it sorted(by...returns a new, sorted version of the array you are calling it on. Therefore, a warning indicates that you are not assigning it to a variable or anything else. You could say:
countsForLetter = countsForLetter.sorted(by: {$0.count < $1.count})
, " ", sorted(by sort(by, countsForLetter .