Converting between String and Data without optionalsBasics article available: Strings
While Swift offers many APIs for converting between
String, these two let us do so without any optionals — usually resulting in simpler code:
// String -> Data let data = Data("Hello, world!".utf8) // Data -> String let string = String(decoding: data, as: UTF8.self)
Enter Manning’s September Showdown — a 30-day challenge that gives developers a chance to test their knowledge against their peers. A new trivia question, and a brand new prize to win, is published every day throughout September.