Post

Replies

Boosts

Views

Activity

Email to iMessage Phone Number
I need to send an OTP authorization code to verify a user's phone number. For testing, I've been using an e-mail sent to a phone number via AT&T's gateway but I don't want this app to be limited to AT&T customers only so I'm looking for a better solution. It occurred to me that perhaps I could use iMessage for this instead, as long as the user has their phone number setup in their iMessage account. The question is, is there an e-mail address I could send to like I do with AT&T such as 5551234567 @ imessage.com? I do not want iMessage to open on the user's device. That would defeat the entire purpose. I am trying to figure out a way to send an e-mail to user's phone number that is already setup in iMessage on their device/account.
2
0
944
Jun ’22
SwiftUI Dynamically Creating Enum Cases
I have a custom picker where the contents of the picker are created from a downloaded JSON file. In an effort to provide better accessibility for challenged users, I am trying to use the .accessibilityFocused modifier to focus VO on a user's previous selection. This means that when the user first views the picker it should start at the top, but if they go back in to change their selection, it should auto-focus on their previous selection instead of having them start over from the top of the list. The issue is that to use .accessibilityFocused you really need to do so via an enum so you can call something like .accessibilityFocused($pickerAccessFocus, equals: .enumValue). As I am using a ForEach loop to create the picker based off of the array that is created when the JSON is parsed and then stored in the struct, I haven't figured out how to create the various enum cases based off of that array. So, to recap: Inside the ForEach loop, I need to have a .accessibilityFocused modifier identifying each of the picker options The onAppear needs to say something along the lines of... if salutation == salutation.salutation { DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { pickerAccessFocus = .ENUMCASE } } else { pickerAccessFocus = Optional.none } Though apparently onAppear does not like to have a ForEach statement, so I'm not sure how to solve that issue either. I know there's a lot of code in the example I provided, but I tried to combine it all into as simple as example as possible. Hoping it makes sense. If I'm thinking about it wrong, and there's a better solution, I'm all ears. import SwiftUI struct Picker: View { @AccessibilityFocusState var pickerAccessFocus: PickerAccessFocus? @State private var salutation = "" var salutationList: [SalutationOptions] = [] // SalutationOptions is the struct from the parsed JSON enum PickerAccessFocus: Hashable { case ? // These cases need to be dynamically created as the same values the ForEach loop uses } static func nameSalutationPicker(name: String) -> LocalizedStringKey { LocalizedStringKey(String("NAME_SALUTATION_PICKER_\(name)")) } var body: some View { List { Section { ForEach(salutationList, id: \.id) { salutation in HStack { Text(nameSalutationPicker(name: salutation.salutation)) } // End HStack .contentShape(Rectangle()) .accessibilityFocused(salutation == salutation.salutation ? ($pickerAccessFocus, equals: .ENUMCASE) : ($pickerAccessFocus, equals: Optional.none)) } // End ForEach } // End Section } // End List .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { pickerAccessFocus = .ENUMCASE } } } }
1
0
1.6k
Mar ’22
SwiftUI - Detect when voiceover has finished
I am using AccesibilityFocusState with an enum to change focus to an error message if a user fills out a field incorrectly. @AccessibilityFocusState private var accessFocus = Field? Once the error message has been read, I would like to have the focus move back to the form field. I've seen some old UIKit ways of attempting this, but haven't found anything that would do it with SwiftUI. The other issue is that I can't use an onChange event because it's just reading back text (the error msg). I need to allow voiceover to read the entire error message, and when it has completed reading, set my AccessibilityFocusState to a new value via: accessFocus = .formField Is there a way to do this with SwiftUI?
0
1
637
Mar ’22
SwiftUI Accessibility Focus
I've got a page where there is a text field for the user to enter a value. If they enter an incorrect value it shows an error message (text and a systemImage, not an alert) and when they enter a correct value it shows a continue button. Once the user has entered anything and dismissed the keyboard I want voiceover to automatically focus on either the error message or the continue button. The only way I've sort of been able to make this work is by using accessibilitySortPriority with a ternary conditional that says if the field is not empty and the keyboard is not focused then make this the highest sort priority. Sure, that works (kind of) because it will in fact focus on the correct element once the keyboard is dismissed, but if the user changes their entry in the text field, then dismisses the keyboard, it stays on the text field instead of focusing once again on the error message or continue button. Also, changing the sort priority of the entire page is a bit problematic because everything is out of order if the user needs to swipe to move around the page elements properly. I've also looked into AccessibilityFocusState because the docs say that the element will gain VO focus when the bool is true and when you move away from that element the bool becomes false. However, nothing I've tried with this seems to do anything at all. What I want to have happen is as follows: User loads the page VO reads the elements from top to bottom User taps to enter a value in the text field User dismisses the keyboard Either the error msg or continue button appears on screen and VO immediately focuses on it User taps to change their entry in the text field User dismisses the keyboard Either the error msg or continue button appears on screen and VO immediately focuses on it
3
1
4.5k
Mar ’22
XCode 13.3 and XCBuild Bug
XCode 13.3's new ability for you to enable XCBuild and use more cores for faster build times is quite impressive. The build times are incredibly fast and it's not a small difference between how it used it to be. That being said, there seems to be a major bug with this feature. While building within XCode and running in Simulator works fine, building on a real device while this feature is enabled does not. The build succeeds but an error message appears in XCode stating your iPhone is busy and it's downloading symbols. Very strange. So, if you want to use this new feature, here's how you do it: Open terminal defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 You can verify that it worked by typing: defaults read com.apple.dt.XCBuild However, if you need to build to a real device and are receiving strange errors, you need to disable this feature like this: Open terminal defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 0 Hopefully Apple will resolve this issue in the next update as it would be really amazing to have super fast build times, even when building to a real device.
0
0
935
Mar ’22