Skip to content

Commit d2a5de6

Browse files
committed
Swift 3.2 compatibility
1 parent 420f5a6 commit d2a5de6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Sources/TLVCodable.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,22 @@ public extension TLVEncodable where Self: RawRepresentable, Self.RawValue: RawRe
6464
}
6565
}
6666

67-
public extension TLVDecodable where Self: RawRepresentable, Self.RawValue: StringProtocol {
67+
public extension TLVDecodable where Self: RawRepresentable, Self.RawValue == String {
6868

6969
public init?(valueData: Foundation.Data) {
7070

71-
guard let string = String(data: valueData, encoding: .utf8) as? Self.RawValue
71+
guard let string = String(data: valueData, encoding: .utf8)
7272
else { return nil }
7373

7474
self.init(rawValue: string)
7575
}
7676
}
7777

78-
public extension TLVEncodable where Self: RawRepresentable, Self.RawValue: StringProtocol {
78+
public extension TLVEncodable where Self: RawRepresentable, Self.RawValue == String {
7979

8080
public var valueData: Foundation.Data {
8181

82-
guard let data = (self.rawValue as? String)?.data(using: .utf8)
82+
guard let data = self.rawValue.data(using: .utf8)
8383
else { fatalError("Could not encode string") }
8484

8585
return data

0 commit comments

Comments
 (0)