I watched the talk "Formatters: Make data human-friendiy" from WWDC 2020 and want to understand/reproduce the examples, especially for "How we can make well-formated lists"
Question:
What do I have to change in my playground to reproduce the results of the examples.
Thank you for your time.
Question:
What do I have to change in my playground to reproduce the results of the examples.
Code Block // English localisation let items = [ "English", "French", "Spanish"] ListFormatter.localizedString(byJoining: items) let items1 = ["English", "Spanish"] ListFormatter.localizedString(byJoining: items1) let items2 = ["Spanish", "English"] ListFormatter.localizedString(byJoining: items2) // Spanisch Localisation let itemsInSpanish = ["Ingleés", "Espñol"] ListFormatter.localizedString(byJoining: itemsInSpanish) let itemsINSpanish2 = [ "Espanol", "Ingles" ] ListFormatter.localizedString(byJoining: itemsINSpanish2)
Thank you for your time.
This is working for me. Specifically, I created an iOS playground in Xcode 12.0b6 and saw these results:
Note that I had to allocate a ListFormatter so that I could override the locale. The examples in the session don’t have to do that because they just changed the locale of the entire device.
Also note that I used Xcode 12.0b6 and an iOS playground so I could get iOS 14 beta behaviour. I didn’t see the ‘and’ switch on older systems (that could be a limitation of those older systems or it could just be forward actuator stick error).
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Code Block import Foundation let items4 = [ "Inglés", "Español" ] let items5 = [ "Español", "Inglés" ] let es = ListFormatter() es.locale = Locale(identifier: "es_ES") es.string(from: items4)! // Inglés y Español es.string(from: items5)! // Español e Inglés
Note that I had to allocate a ListFormatter so that I could override the locale. The examples in the session don’t have to do that because they just changed the locale of the entire device.
Also note that I used Xcode 12.0b6 and an iOS playground so I could get iOS 14 beta behaviour. I didn’t see the ‘and’ switch on older systems (that could be a limitation of those older systems or it could just be forward actuator stick error).
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"