From a23ec47050a6991be28d0496e045ad2fc174d377 Mon Sep 17 00:00:00 2001 From: Nicholas Bellucci Date: Tue, 8 Sep 2020 17:51:28 -0400 Subject: [PATCH] Added EnumRawValueRepresentable to support enums with raw values --- Sources/SociableWeaver/Protocols/Argument.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/SociableWeaver/Protocols/Argument.swift b/Sources/SociableWeaver/Protocols/Argument.swift index 17a2fca..54e68a8 100644 --- a/Sources/SociableWeaver/Protocols/Argument.swift +++ b/Sources/SociableWeaver/Protocols/Argument.swift @@ -7,9 +7,16 @@ import Foundation */ typealias Argument = (key: String, value: ArgumentValueRepresentable) -public protocol EnumValueRepresentable: ArgumentValueRepresentable, RawRepresentable { } +public protocol EnumValueRepresentable: ArgumentValueRepresentable { } +public protocol EnumRawValueRepresentable: ArgumentValueRepresentable, RawRepresentable { } public extension EnumValueRepresentable { + var argumentValue: String { + "\(self)".uppercased() + } +} + +public extension EnumRawValueRepresentable { var argumentValue: String { "\(self.rawValue)".uppercased() }