title: Get number of weeks for a given ISO 8601 calendar year
body: <p>I need to make a function for calculating the number of weeks of a given year in swift, according to the ISO-week-system (ISO8601). I need the number as an Int. First I figured I need to make a NSDate for december 31st and just ask what week that's in, then I realized sometimes december 31st is in week 1 of the following year (for example december 31st 2014)
  Anybody know of a way to do this?</p>
  
  <p>I tried</p>
  
  <pre><code>var calendarr = NSCalendar(calendarIdentifier: NSCalendar.Identifier.ISO8601)!
  var monday = "01-01-2005"
  
  var dateFormatter = DateFormatter()
  dateFormatter.dateFormat = "dd/MM/yyyy"
  var datumet = dateFormatter.date(from: monday)
  var weekRange = calendarr.range(of: .weekOfYear, in: .year, for: datumet!)
  var weeksCount = weekRange.length
  
  print("this many weeks", weeksCount)
  </code></pre>
  
  <p>But it gives me 53 weeks, no matter what year I put in. As a reference 2004 had 53 weeks and 2005 had 52 weeks</p>