title: Find the common prefix of two strings in idiomatic Swift
body: <p>Other than the brute force approach of iterating over string characters and comparing them, what is the most idiomatic approach to finding the longest common prefix of two Strings in Swift?</p>
  
  <p>For example, the implementation of <code>commonPrefixWith()</code> in this snippet:</p>
  
  <p><code>let firstString = "The quick brown fox jumps over the lazy dog"
  let secondString = "The quick brown fox has a pogo stick"
  let result = firstString.commonPrefixWith(secondString) // result == "The quick brown fox "
  </code></p>
  
  <p>It has that kind of feel about it of something which has a really elegant functional solution, but I cannot see the best starting point for an approach.</p>