Post

Replies

Boosts

Views

Activity

Is there any documentation available on how to work with FocusState for a custom control using UIViewRepresentable?
So I am trying to implement a custom control using UIViewRepresentable. Basically I want to wrap a UITextField to have more precise control over the focus behavior. I would like to have this control integrate with the SwiftUI focus system. As far as I have gotten, I understand that I would probably need to have my custom coordinator refer events back and fourth between the UITextField and the @FocusState somehow, but I cannot find any documentation on this. Is there an example out there somewhere, or else is there any open-source code which shows how @FocusState is working with existing controls?
1
2
692
Apr ’22
I'm observing an extremely bizzare behavior where the top control in a view doesn't respond to touch
So I have asked this question on Stack Overflow as well: https://stackoverflow.com/questions/71374690/touch-events-seemingly-not-registering-at-top-of-screen I'm seeing very strange behavior within a view. Here's my layout: struct EventDetailViewContainer: View { let eventID: EventRecord.ID @State var event: EventRecord = EventRecord(keyResults: [], text: "", achievesKR: false) @State var editing: Bool = true var body: some View { if #available(iOS 15.0, *) { VStack { HStack { Spacer() Toggle("Editing", isOn: $editing) .padding() } EventDetailView(event: $event, editing: $editing) } } else { // Fallback on earlier versions } } } @available(iOS 15.0, *) struct EventDetailView: View { @Binding var event: EventRecord @Binding var editing: Bool @FocusState var textIsFocused: Bool var body: some View { VStack { TextField( "Event text", text: $event.text ) .focused($textIsFocused) .disabled(!editing) .padding() DatePicker("Event Date:", selection: $event.date) .disabled(!editing) .padding() Toggle("Goal is Reached?", isOn: $event.achievesKR) .disabled(!editing) .padding() HStack { Text("Notes:") Spacer() } .padding() TextEditor(text: $event.notes) .disabled(!editing) .padding() Spacer() } } } struct EventRecord: Identifiable, Equatable { typealias ID = Identifier struct Identifier: Identifiable, Equatable, Hashable { typealias ID = UUID let id: UUID = UUID() } let id: ID var keyResults: [KeyResult.ID] var date: Date var text: String var notes: String var achievesKR: Bool init( id: ID = ID(), keyResults: [KeyResult.ID], date: Date = Date(), text: String, notes: String = "", achievesKR: Bool ) { self.id = id self.keyResults = keyResults self.date = date self.text = text self.notes = notes self.achievesKR = achievesKR } } So this works perfectly when I run it as an iPad app, but when I run it on the simulator, the the top toggle doesn't respond to text input. The strange thing is, when I simply duplicate the toggle, the top one doesn't work and the bottom one works perfectly: struct EventDetailViewContainer: View { let eventID: EventRecord.ID @State var event: EventRecord = EventRecord(keyResults: [], text: "", achievesKR: false) @State var editing: Bool = true var body: some View { if #available(iOS 15.0, *) { VStack { HStack { Spacer() Toggle("Editing", isOn: $editing) .padding() } HStack { Spacer() Toggle("Editing", isOn: $editing) .padding() } EventDetailView(event: $event, editing: $editing) } } else { // Fallback on earlier versions } } } It seems like this should be totally unrelated to the touch behavior of the other views. Btw this is being displayed in the context of a navigation view. Is there anything that can explain this? And how can I fix it? Here's a gif of the behavior being demonstrated:
0
0
407
Mar ’22
MessageSendFailure: Message send failure for update
So I am trying to load a preview for a SwiftUI view, and it always fails with this error: MessageSendFailure: Message send failure for update ================================== |  RemoteHumanReadableError: The operation couldn’t be completed. XPC error received on message reply handler |   |  BSServiceConnectionErrorDomain (3): |  ==NSLocalizedFailureReason: XPC error received on message reply handler |  ==BSErrorCodeDescription: OperationFailed What does this mean and how can I fix it? The previews on my other views are working fine. Here's the view in question: import SwiftUI @available(iOS 15.0, *) struct EventEntryView: View {     @Environment(\.dismiss) var dismiss     let keyResult: KeyResult     @State var text: String = ""     @FocusState var textIsFocused: Bool     @State var completesKeyResult: Bool = false     var body: some View {         VStack {             Button("Cancel") {                 dismiss()             }             Text("Key Result: \(keyResult.text)")                 .padding()             Toggle("Goal is Reached?", isOn:$completesKeyResult)                 .padding()             TextField(                 "Event note",                 text: $text             )             .focused($textIsFocused)             .onSubmit {                 print("Note: \(text)")             }             .padding()             Button("Record Event") {                 print("Recording: \(text) goal is reached? \(completesKeyResult)")             }             .padding()         }     } } struct EventEntryView_Previews: PreviewProvider {     static var previews: some View {         if #available(iOS 15.0, *) {             EventEntryView(keyResult: KeyResult.default)         } else {             Text("preview")         }     } } This view also works when it's included in other views for preview, it's only not working for this preview.
0
0
680
Feb ’22
Tester stuck in "Tester removed" even with a public link
So we're trying to distribute an app to one of our investors. He was previously in our internal testing group, and we have since switched to distributing the app using external testing via public link, so we've taken him out of our internal testing group and started to distribute the app that way. However, when he tries to download the app, he sees this on the app page inside of testflight: Tester Removed The developer removed you from the test program So it seems like somehow his status as a former internal tester is overriding the public link. How can we solve this? It's extremely important to get him access to the app.
4
2
1.7k
Oct ’21
Is it possible to get the wifi credentials and currently connected network from a user's iPhone?
I'm working on an IoT device, and we would like to streamline the onboarding process as much as possible.We have looked at the Apple TV as a good example: the user just touches their phone to the device, and the Apple TV copies the login for the network the iPhone is currently connected to.Is it possible to achieve something like this for a 3rd party device?
3
0
1.8k
Mar ’20
Is it possible to get a unique identifier for a photo during the Aperture export process?
I'm attemptig to build a custom aperture exporter to get all my photos out so I can migrate to catalina. It would be extremely useful to be able to get a unique ID for each image as it's being exported. It looks like the export plugin idetifies images via an index which is relative to the export; is there a way to get some kind of a uuid for each image? I assume aperture must somehow identify images internally.
0
0
516
Jan ’20
where can I find the Aperture SDK and example code?
So now that Aperture is no longer supported on Catalina, I want to implement a simple export plugin to get my photos out.I found some documentation here:https://developer.apple.com/library/archive/documentation/Aperture/Conceptual/AppleApp_Aperture_3.4/Overview/Overview.htmlBut I can't find the examples on disk. I assume they're just not shipped with the newer versions of XCode since Aperture has been EOL for so long.Is there anywhere to get the code examples, and whatever libraries I need to implement an Aperture plugin?
2
0
644
Jan ’20
What's the plan for Python on macOS following EOL in 2020?
I got this message when installing something via PIP today:DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.Is there a plan in place to update the default version for macOS? I believe the current default is stil 2.7.
5
0
5.4k
Feb ’19