Uploaded image for project: 'Swift'
  1. Swift
  2. SR-6753

CodingUserInfoKey's init?(rawValue:) shouldn't be failable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Standard Library
    • Labels:
    • Environment:

      Swift version 4.1-dev (LLVM db86aaee13, Clang c336c4829f, Swift cd7600cca2)
      Target: x86_64-apple-darwin17.3.0

      Description

      Currently, CodingUserInfoKey's init?(rawValue:) is failable (despite never returning nil), so you have to force unwrap the result. In addition, SE-0166 proposed a non-failable init(_ value: String), which is yet to be implemented.

      IMO, the API should be changed to have both a non-failable init(rawValue:) and (convenience) init(_ rawValue:).

        Attachments

          Activity

            People

            • Assignee:
              itaiferber Itai Ferber
              Reporter:
              originaluser2 Hamish Knight
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: