I wants to convert String to binary(0/1 representation) and reverse.
This is my code for converting String to binary.
let String_Data: String = UI_Data.text!
let Binary_Data: Data? = String_Data.data(using: .utf8, allowLossyConversion: false)!
let String_Binary_Data = Binary_Data?.reduce("") { (acc, byte) -> String in
acc + String(byte, radix: 2)
}
But I do not know how to do the opposite. I would be very grateful if you could give me advice for this.