title: How to convert a Swift enum: String into an Objective-C enum: NSString?
body: <p>I am having an issue converting this swift enum to Objective-C :</p>
  
  <pre><code> public enum ISO8601Format: String {
  
  case Year = "yyyy" // 1997
  case YearMonth = "yyyy-MM" // 1997-07
  case Date = "yyyy-MM-dd" // 1997-07-16
  case DateTime = "yyyy-MM-dd'T'HH:mmZ" // 1997-07-16T19:20+01:00
  case DateTimeSec = "yyyy-MM-dd'T'HH:mm:ssZ" // 1997-07-16T19:20:30+01:00
  case DateTimeMilliSec = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" // 1997-07-16T19:20:30.45+01:00
  
      init(dateString:String) {
          switch dateString.characters.count {
          case 4:
              self = ISO8601Format(rawValue: ISO8601Format.Year.rawValue)!
          case 7:
              self = ISO8601Format(rawValue: ISO8601Format.YearMonth.rawValue)!
          case 10:
              self = ISO8601Format(rawValue: ISO8601Format.Date.rawValue)!
          case 22:
              self = ISO8601Format(rawValue: ISO8601Format.DateTime.rawValue)!
          case 25:
              self = ISO8601Format(rawValue: ISO8601Format.DateTimeSec.rawValue)!
          default:// 28:
              self = ISO8601Format(rawValue: ISO8601Format.DateTimeMilliSec.rawValue)!
          }
      }
  }
  
  public enum DateFormat {
  case ISO8601(ISO8601Format?), DotNet, RSS, AltRSS, Custom(String)
  }
  </code></pre>
  
  <p>I already researched this everywhere and found this and this:</p>
  
  <p><a href="https://stackoverflow.com/questions/13171907/best-way-to-enum-nsstring">Best way to enum NSString</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6331762/enum-values-to-nsstring-ios">enum Values to NSString (iOS)</a></p>
  
  <p>Didn't quite understand those answers.I am looking for more elegant solutions (if there are any) or better explanations of those answers with modern objective-c syntax.</p>
  
  <p>Thank you !</p>