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!
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Xcode 13 "Missing package product" using local Swift Packages
In my case on Xcode 13.1, this issue get fixed after applying File -> Packages -> Reset Package Caches enjoy!
Replies
Boosts
Views
Activity
Nov ’21
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!
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to An alternative Swift method to PHP `pack()` method
I found an accepted answer here for the same issue in Objective-C but I only need to convert the returned data type NSData to a binary string in Swift. Can you check this accepted answer? [(https://stackoverflow.com/a/8950667/7262400)]
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to An alternative Swift method to PHP `pack()` method
Thank you @Claude31 for your reply The point is I am looking to implement a feature in Swift to simulate the same feature in a PHP library and to do the job, I need an alternative Swift method to PHP pack() method
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21