1

What is the purpose of using:

case `default`

in the following code-snippet?

private enum AnimationType: String {
    case linear
    case easeIn
    case easeOut
    case easeInOut
    case `default`

    var rawValue: String {
        switch self {
        case .linear:
            return CAMediaTimingFunctionName.linear.rawValue
        case .easeIn:
            return CAMediaTimingFunctionName.easeIn.rawValue
        case .easeOut:
            return CAMediaTimingFunctionName.easeOut.rawValue
        case .easeInOut:
            return CAMediaTimingFunctionName.easeInEaseOut.rawValue
        case .`default`:
            return CAMediaTimingFunctionName.default.rawValue
        }
    }
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
lal
  • 7,410
  • 7
  • 34
  • 45
  • 1
    `default` is a reserved keyword, so the backticks have to be added to use it. I would recommend just using a different word. – vacawama Oct 08 '19 at 00:24
  • Are you asking about the backtics or the name "default"? – rmaddy Oct 08 '19 at 00:24
  • ```default``` is keyword, but developer want use the keyword as enum's element. because although ```default``` is keyword, the element is clear representation as developer's purpose. – InKwon Devik Kim Oct 08 '19 at 00:44

0 Answers0