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

Wrong Action when select "No" in Alert #61

Open
GlebGamaunov opened this issue Mar 18, 2019 · 0 comments
Open

Wrong Action when select "No" in Alert #61

GlebGamaunov opened this issue Mar 18, 2019 · 0 comments

Comments

@GlebGamaunov
Copy link

GlebGamaunov commented Mar 18, 2019

Now in app, when showing alert with "Are you sure you want to delete this post?", when select "No" Post deleted :-( How to fix this problem? @sergdort

let deleteTrigger = deleteButton.rx.tap.flatMap {
            return Observable<Void>.create { observer in

                let alert = UIAlertController(title: "Delete Post",
                    message: "Are you sure you want to delete this post?",
                    preferredStyle: .alert
                )
                let yesAction = UIAlertAction(title: "Yes", style: .destructive, handler: { _ -> () in observer.onNext(()) })
                let noAction = UIAlertAction(title: "No", style: .cancel, handler: { _ -> () in observer.onNext(()) })
                alert.addAction(yesAction)
                alert.addAction(noAction)

                self.present(alert, animated: true, completion: nil)

                return Disposables.create()
            }
        }

let input = EditPostViewModel.Input(
            editTrigger: editButton.rx.tap.asDriver(),
            deleteTrigger: deleteTrigger.asDriverOnErrorJustComplete(),
            title: titleTextField.rx.text.orEmpty.asDriver(),
            details: detailsTextView.rx.text.orEmpty.asDriver()
        )
passerbyloo added a commit to passerbyloo/CleanArchitectureRxSwift that referenced this issue Mar 21, 2019
wangdu1005 pushed a commit to wangdu1005/CleanArchitectureRxSwift that referenced this issue Sep 10, 2019
mobiledev7 added a commit to mobiledev7/CleanArchitectureRxSwift that referenced this issue Dec 12, 2022
barba67 added a commit to barba67/CleanArchitectureRxSwift that referenced this issue Apr 4, 2023
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

1 participant