How can I detect (programmatically) when openPKPassLibrary() is 'opened' / closed? - swift5

I understand that calling openPKPassLibrary() will open it, however - I would like to know when it is closed and how I can detect that and write code for that.
I have a button that is animating when I tap it and the button calls openPKPassLibrary() and then I've tried stopping the button animation in viewDidDisappear() in the button's hosted UIViewController, but it doesn't work. I think this is because the system isn't changing view controllers.
Right now, I am running a dispatch to stop it after openPKPassLibrary() is called but I want to know when it closes.

Related

Properly handling touches with multiple views

I currently have a project where I present a HUD using this control:
https://github.com/samvermette/SVProgressHUD
I present the SVProgress HUD over a complicated hierarchy of UIViews and ScrollViews.
SVProgressHUD is a bit like a UIAlertView, it presents a message but it auto dismisses itself.
In one part of my app, I am using it each time the user pops through a page in my UIScrollView.
The autodismiss feature is good but I want the user to be able to tap the hud and dismiss it early if required.
So I know SVProgressHUD posts a notification to notification center
SVProgressHUDDidReceiveTouchEventNotification
This is good, and what i've done is add a notification observer in my main viewController which calls a class method on SVProgressHUD to dismiss any presented HUD's when the SVProgressHUDDidReceiveTouchEventNotification is posted.
My problem (and question is) how can I ensure this dismiss method doesn't interfere with my scrollview?
I want my users to be able to quickly swipe through scrollview content pages, however since I started listening to this notification the scrollview doesn't react to the first touch of the user, it uses the first touch to dismiss the HUD. This feels quite clunky.
The problem is SVProgressHUDDidReceiveTouchEventNotification is being posted even if the HUD isn't touched and instead my Scrollview underneath is touched. How can I add a hittest inside my dismiss method to check that SVProgressHUDDidReceiveTouchEventNotification was posted because the HUD itself was touched?
Thanks!
I implemented touchesEnded in SVProgressHUD and handle touches there.

Storyboards multiple buttons cause same segue

I'm working on trying to figure out storyboards and it all seems pretty cool but I'm having problems with moving from one screen with a few buttons to another screen no matter which button is pressed. Obviously I can control drag from each button but then I have segues all over the place on the story board and I feel like there has to be a better way to do it. I've tried highlighting all the buttons and control-dragging to the next screen but that only caused the one I dragged from to work.
Here's an illustration of what I have that works right now...
If I have to stick with this then so be it but I'm going to end up with 6 buttons on one page and 8 on another. That's alot of segues. Basically each button signifies a choice for the user. That choice will cause different things to happen behind the scenes but no matter which button they choose they move to the next screen.
What I've Tried:
Highlighting all the buttons and then dragging to the next view controller.
This failed because it only connected the segue to the button I clicked on when I control-dragged
Dragging out one segue then dragging from the second button to the circle part of the segue.
This caused nothing at all to happen.
I'm unaware of a way to give a single segue multiple triggers in a storyboard, however you could create a single segue with a particular identifier, and then have all of the buttons respond to a single IBAction that calls [self performSegueWithIdentifier:...];
Check out generic segues, which are tied to the source view controller instead of an IBAction:
https://stackoverflow.com/a/8868096/295130

iPhone - SVProgressHUD - Can not get to appear on UIView

I am using the SVProgressHUD progress indicator, and it works very well most of the time.
I am having some issues with it not appearing as expected in certain situations, however.
For example, I would like to show the indicator when I click a button on a view. This button launches a synch call to a web service. At the end of the svc call, the SVProgressHUD indicator window is removed.
What is happening is - the progress window pops up and disappears immediately after the svc call finishes.. even though my code to display the SVProgressHUD window is the first line in my 'buttonPressed' action.
I think there are some UIView concepts I am missing here... any insight?
Thanks
You shouldn't attempt to show user interface elements on a background thread. If you're in a background thread, access the main thread to update your interface.

Eclipse progress view stop button listener

I develop an eclipse plugin, and I created an progress view which indicates where the work runs. Everything works correctly, but I have a question. When I made this view an stop button appeared on it. But I haven't found any listener to control this. But the best should be that if there is an pause button within the view insted of the stop button. Please give me some idea! Thanks!
The Job where you do the work is given an IProgressMonitor when its run method is called. This progress monitor has an #isCanceled() method. I believe that when you click the stop botton in the progress view, then the isCanceled method on your progress monitor should return true.

Button works in simulator for not in App

I have a few different views in my App, all of which are viewed by tapping different buttons. All the buttons work on the simulator, but when I run the app on the device only one button does not work. I went over and over my code and re coded that one button and re-connected it in IB to make sure that i did not mess something dumb up, but it still freezes my app.
When the bad button is tapped the App will freeze but not shut off and the only way to unfreeze it is to press the home button.
Any thoughts on why this might be happing only to this one button?
I got it! It was something really dumb! In the view that is loaded when the button is tapped there is a picker. What was happening is that I have a BOOL value that needs to be set to true when the button is tapped and I forgot to set it. Without that BOOL value being set the picker was not being loaded the right way.