How to write Java byte array in Swift
问题 I'm trying to write the following Java code in Swift: private static final byte[] ENCRYPTION_KEY = new byte[] { 'N', 'r', 'q', 'V', '2', 'h', 'V', 'j', 'z', 'D', 'N', 'p', 'V', 'T', '3', 'X' }; private static final byte[] VECTOR = new byte[] { 'f', 'e', 'l', 'c', 'd', 'a', '1', '8', '7', '2', '5', '4', '3', '2', '8', '0' }; How can this be done? 回答1: You can simply add those characters into a String and use that string utf8 property to initialize a new array of bytes from it. The result will