Post

Replies

Boosts

Views

Activity

PersonNameComponentsFormatter returning familyName for single String
I am working on a feature where, upon completion of a form, we validate that the user has entered a "Full name". My assumption here was that I could use PersonNameComponentsFormatter here and simply check for familyName - if it is nil, they haven't entered a "Full name". However, it isn't behaving quite like I had assumed. For some, seemingly random, Strings it thinks the String is a familyName. I have reproduced this in a playground. See below let formatter = PersonNameComponentsFormatter() formatter.style = .default let strings = ["test", "name", "tester", "naming", "Stefan", "stefan", "card", "dog", "animal", "first", "string"] for string in strings {   print(formatter.personNameComponents(from: string)?.familyName ?? "") } The result of which is test name tester card first string Is there a bug here in the formatter or is my assumption on how to use it incorrect? i.e. should I check for both givenName and familyName, rather than relying on just familyName?
1
0
439
Oct ’22
Image Playground is not available Xcode 16.2 beta
Hello, I am trying to show an imagePlaygroundSheet but when I open it in the 16 Pro and 16 Pro Max iOS 18.2 simulator, I see "Image Playground is not available. Image Playground is not available on this iPhone". The environment variable supportsImagePlayground always returns false. I changed the simulator language and region to US but still see the error. Is this expected? Screenshot
1
0
227
2w