Enum rawValueタイプエラー
異なるenumタイプをenumの元のタイプとして使用すると問題が発生します. 'Game' declares raw type 'GameResult', but does not conform to RawRepresentable and conformance could not be synthesized Do you want to add protocol stubs? Raw type 'GameResult' is not expressible by a string, integer, or floating-point literal Raw value for enum case must be a literal 元の値はテキスト値のみです.
文字は何ですか.String or Int or Floating-point
=enumタイプのcaseの元の値はliteralとして表すことはできませんか?
String or Inter Floating-pointではなくenumタイプ?
異種
enum GameResult {
case win
case loss
case tie
}
enum Game: GameResult {
case 가위바위보 = GameResult.win
case 묵찌빠 = GameResult.tie
}
enum GameResult: String {
case win = "win"
case loss
case tie
}
enum Game: GameResult {
case 가위바위보 = GameResult.win
case 묵찌빠 = GameResult.tie
}
上の2つのコードのエラー文
文字は何ですか.String or Int or Floating-point
=enumタイプのcaseの元の値はliteralとして表すことはできませんか?
String or Inter Floating-pointではなくenumタイプ?
異種
Swift Literals
A literal is a representation of a value in source code, such as a number or a string. Swift provides the following kinds of literals:
Reference
この問題について(Enum rawValueタイプエラー), 我々は、より多くの情報をここで見つけました
https://velog.io/@tiana/enum-rawValue-타입-에러
テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol
Reference
この問題について(Enum rawValueタイプエラー), 我々は、より多くの情報をここで見つけました https://velog.io/@tiana/enum-rawValue-타입-에러テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol