How can I create a base64 encoded string from 4 UInt64 integers? I presume there are a few steps to this that i'm not sure how to approach, such as combing integers, converting to binary, or perhaps constructing string using some loop over integers? I'd appreciate any code example or pointers on how to achieve this.
Asked
Active
Viewed 145 times
1 Answers
0
It this what you want?
func base64String(integers: [UInt64]) throws -> String {
let data = try JSONEncoder().encode(integers)
let string = data.base64EncodedString()
return string
}
// call
let result = try? base64String(integers: [234, 23, 3, 1002, 3])

wzso
- 3,482
- 5
- 27
- 48