Post

Replies

Boosts

Views

Activity

Reply to An alternative Swift method to PHP `pack()` method
I made some changes to @OOPer class and it worked for me. public class MyTag {     public let tag: UInt8     public let value: String     public init(tag: UInt8, value: String) {         self.tag = tag         assert(value.utf8.count < 256, "The length of `value` needs to be less than 256.")         self.value = value     }     public var length: UInt8 { UInt8(value.utf8.count) }     public var tlv: [UInt8] { return ([tag, length] + [UInt8](value.utf8)) } } Thank you @OOPer for your help!
Nov ’21