Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContactPicker: closes parent sheet when ContactPicker is closed #22

Open
dderg opened this issue Jan 28, 2021 · 1 comment
Open

ContactPicker: closes parent sheet when ContactPicker is closed #22

dderg opened this issue Jan 28, 2021 · 1 comment

Comments

@dderg
Copy link

dderg commented Jan 28, 2021

removing line 58 fixes it,

viewModel.dummy.dismiss(animated: true)

but I believe it was there for some reason. I'm new to Swift so I need some help in making a PR for that.

@michaelrowe01
Copy link

I also see this issue... However, once I added in logic to validate Permissions (and stop crashing when they are denied), I no longer get the ContactPicker presented...

                                    HStack {
                                        Button(action: {
                                            saveRecipient()
                                            self.presentationMode.wrappedValue.dismiss()
                                        }, label: {
                                            Image(systemName: "square.and.arrow.down")
                                                .font(.largeTitle)
                                                .foregroundColor(.green)
                                        })
                                        Button(action: {
                                            let contactsPermsissions = checkContactsPermissions()
                                            if contactsPermsissions == true {
                                                self.showPicker.toggle()
                                            }
                                        }, label: {
                                            Image(systemName: "magnifyingglass")
                                                .font(.largeTitle)
                                                .foregroundColor(.green)
                                        })
                                        Button(action: {
                                            self.presentationMode.wrappedValue.dismiss()
                                        }, label: {
                                            Image(systemName: "chevron.down.circle.fill")
                                                .font(.largeTitle)
                                                .foregroundColor(.green)
                                            
                                        })
                                    }
            )
            
            ContactPicker(showPicker: $showPicker, onSelectContact: {contact in
                firstName = contact.givenName
                lastName = contact.familyName
                if contact.postalAddresses.count > 0 {
                    if let addressString = (((contact.postalAddresses[0] as AnyObject).value(forKey: "labelValuePair") as AnyObject).value(forKey: "value")) as? CNPostalAddress {
                        let mailAddress = CNPostalAddressFormatter.string(from:addressString, style: .mailingAddress)
                        addressLine1 = "\(addressString.street)"
                        addressLine2 = ""
                        city = "\(addressString.city)"
                        state = "\(addressString.state)"
                        zip = "\(addressString.postalCode)"
                        country = "\(addressString.country)"
                        print(mailAddress)
                    }
                    saveRecipient()
                }
            },  onCancel: nil)```

Anything obvious....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants