Pinch Gesture in Swift Playground? - swift-playground

Initially I read you couldn't experiment with touches or gestures in a playground. Then I found that touchesMoved or a tap gesture would react. However, I now am testing a UIPinchGestureRecognizer. There isn't the feature that lets you simulate two fingers with the alt key in the playground. Are you telling me I have to create an Xcode project and compile and run for each iteration simply because its a pinch and not a tap?

As in 2020:
Option + Shift will do the trick. You might have to click into the live view first but then it should work.

Related

Xamarin Forms buttons stop receiving mouse clicks after clicking on SkiaSharp CanvasView on iOS

I use SkiaSharp canvas to draw the main game screen, and then there are various Xamarin.Forms Buttons around the UI. This all works fine on when used directly on iPhone or iPad using a finger. However, when I connect a mouse (e.g., through a MacBook or otherwise), the buttons start working with about 10% chance after mouse-clicking on the SkiaSharp canvas (and not receiving the mouse click events with 90% chance). The SkiaSharp canvas itself works just fine.
If I bring up the iOS app launch menu from the bottom (which probably somehow temporarily exists the mouse navigation on the app), the buttons start working again with the mouse. But if I click the SkiaSharp canvas again with the mouse, the buttons have a high chance of becoming disabled again. If I change to using a finger, all works fine (even if the mouse clicks were not being registered immediately before). However, mouse clicks are not being registered even after touching with a finger, so finger-touching does not reset the issue with the mouse (but bringing up the menu from the bottom does).
We found this bug by testing the iOS game on MacBook Pro (the iOS apps recently came available on the App Store) but the same issue persists also directly with an iPad / mouse combination. It seems to be some sort of an issue between using a mouse (on iPad or on MacBook Pro), SkiaSharp canvas and Xamarin.Forms buttons.
Does anyone know what the root cause of the problem is and what is the workaround?
Not an answer as such, but some more information about reproducing the issue: A simpler repro case may be this small project: https://github.com/jrc14/TraceMatching/ .
Don't worry too much about what it's doing, but note that you're mean to click in the grey Skia canvas in the middle to create 'targets' - and that after you've done that, mouse-clicks are getting lost.
If you run it on a Mac, you'll see that, though the clicks get lost after you've clicked on the Skia canvas, they will start being received again if you click on something else (another app, or the Mac background).
(further edit) - after some noodling around I did find a workaround. If, once you've finished processing the touch action on the SKCanvasView, you reset its EnableTouchEvents property (i.e. set it to false, then back to true again), it seems that the clicks don't get lost any more,

Detecting two-finger click on Siri remote

I'd like to detect when the user of my tvOS app clicks the Siri Remote with two fingers on the trackpad. (Currently, clicking with one finger increments; I'd like clicking with two fingers to decrement.) On iOS, detecting a two-finger tap is pretty easy: just attach a UITapGestureRecognizer with numberOfTouchesRequired set to 2. But I can't seem to make this work on tvOS. Any ideas?
I tried looking in the official tvos documentation, but i can't confirm that it is "one-touch" or "multi-touch".
Though, from my current testing and exploration with the siri remote, it only supports one touch.

Unity: GUI button with event trigger as virtual control pad on Android phone

Let's say I have two GUI buttons with EventTrigger as virtual key. The expectation is whenever a button is pressed, the camera will rotate until the button is released.
At the beginning, I used the pointer Down and pointer up function. It works, but it extremely sensitive, the camera rotation didn't stop at the moment when I release my finger. I've solved this problem by using drag function (whenever dragging is detected, the camera stop rotating something like that).
However, there is still a bug that I couldn't solve, that is if I swipe the button instead of touch&release, the button doesn't release. eventually the camera just keep rotating until I touch the button again. I've tried all the event trigger function such as pointer exist, end drag etc.
I just want the touch input works as perfectly as the keyboard input.
This problem doesn't shown when I debugging on unity remote, only when I build it on my phone. So is that hardware issue? (I'm using mi3)
Thanks for having time to read my broken English.
I'm so sorry that I've asked a stupid question, since I'm still kind of beginner. The problem is somehow it didn't update when I installed it in my phone. It actually works fine.

Using a textView and ScrollView in the same ViewController does not work? Swift

I am having a very strange problem.
I have a tableView, which when the cell is clicked it segues to the next VC, sending the data from that cell with it via prepareForSegue function. From the next VC I then segue from there to another VC (again passing the data needed via prepareForSegue). The final VC is a chat style VC, so it contains a scrollView and a textView, the three VCs look like so:
In the chatViewController I have set up a Parse backend so it queries the data and then places inside the scrollView like so:
The problem I am having is that the keyboard does not pop open. I know the code is CORRECT! As it pops open when I make the chatViewController the initial VC. it just doesn't work when it is segued to from multiple VC.
Does anybody have any ideas on this or ever had any problems with segueing into a scrollViewController. I've tried everything I can think off.
Thanks in advance.
If you're on ios simulator, the software keyboard may be turned off. For actual emulation you may try a ios phone instead of simulator.
If you wanna appear the soft-keypad in simulator try following
solution
iOS Simulator -> Hardware -> Keyboard
Uncheck "Connect Hardware Keyboard"
Mine was checked because I was using my mac keyboard, but if you make sure it is unchecked the iPhone keyboard will always come up.
solution is actually copied from here

Swipe Gesture not working in xcode

Since Xcode got updated, i can't use swipe gesture. I have 2 UIViewController, i dragged a Swipe Gesture in the first and in the second. I connected them with Modal Action Segue. I tried in the simulator and on my device and both didn't work. It's so simple and i used to be able to do it but now it just doesn't work. Am i missing something ? I tried playing with the "State: Enable button" but that didn't worked. Normally i would just do a navigation bar with a button to change view but for this app i really want to you swipe gesture... Thanks
That was a stupid mistake... I dragged the Swipe Gestures on the background images. You need do drag them on the view itself. Just move the background image and drag the swipe gesture on the UIView and it should work!
Lol, I'm having trouble with that too.
I fixed it by making swipe gesture programatically

Resources