XCTest force touch automation - ios

We just implemented force touch in to our app where user can access few of the app features directly through force touch pop up. So just wondering whether XCTest in Xcode support force touch automation Something similar to this. So what I'm trying to do is forceTap on the our app icon and make the test to tap one of the options as shown linked image. Thanks in advance.

Related

Can the click method in XCUIElement be used outside of the testing framework?

I would like to click an element without user input. I see it's possible in XCUIElement which is a part of the XCTest framework to ensure things are working correctly, and I'm aware of various other testing frameworks that support E2E testing with simulated clicks. But is it possible to trigger this in production outside of testing? E.g. How app remotes work for a TV - pressing a button on the app will move right, left, or click an object on the TV (only remove the TV from this question and have it target the OS it's running on)
It seems accessing other apps might not be possible - https://developer.apple.com/forums/thread/698795?login=true
But they did recommend a way to programmatically click a button that was found in another stack overflow post here - how to programmatically fake a touch event to a UIButton?

Arkit iOS ( how to make a button to choose from mutiple models)

I’m just starting in iOS development. I’m currently working on a AR app that allows me to choose from different models/equipment to place. I cannot seem to figure out how to add a button or option for the user to choose from the multiple models and select one.
There's no AR button that is offered natively with RealityKit at the moment, but you can add something to your scene and pick it up with a tap gesture on the ARView.
Self promotion warning, but as it's exactly relevant to what you're looking for, I tried to solve this issue recently. Here's a GitHub repo and swift package you can use in your app to add a button in AR pretty easily, handling the gestures for you:
https://github.com/maxxfrazer/RealityUI

How to provide 3D Touch quick actions inside iOS app

If you were using Home app in iOS, you may have noticed that there's Quick Actions-like menu when you force touch on accessory. If device doesn't support 3D touch, then you do it with the long press. Here's two videos, first from iPhone 5, that doesn't support 3D Touch, and the second from iPhone 7 that does, https://imgur.com/a/jdQXPg7, https://imgur.com/a/W4cVnNI
How to realize such functionality? What class can be used as a view for this? Should I write custom UIView subclass? There are a few similar questions, but they do not provide specific answer.
EDIT:
I do not mean how to create quick actions, I mean how to create actions view when I force touch UICollectonViewCell.
Any help wold be appreciated.

Can you hide app widgets from appearing under the 3D touch quick actions?

I'd like to remove my apps Today Widget from appearing when 3D touching the app icon on the home screen because showing the quick actions and the Today Widget just doubles up the actions app provides (seen in screenshot). Is there anyway to hide widgets from the 3D touch quick actions using the Info.plist or some other method?
Thanks
So, if you have multiple homescreen widgets, you can set UIApplicationShortcutWidget to determine which one should be shown. I haven't been able to find a way to disable them altogether from appearing in the 3d touch shortcut menu.
One option you may be able to try (this works for me on the simulator) is to set this value in your Info.plist to the value of nil.
<key>UIApplicationShortcutWidget</key>
<string>nil</string>
Your other option is to create a different widget, with more useful functionality, perhaps such as showing the currently running timer, or other stats.
Apple released this has a new feature, where user can see the handy information when force touching the App icon for shortcut items. I presume we cannot remove widget during 3D touch quick actions.
Unfortunately, there's now way to hide app widget. If you set UIApplicationShortcutWidget to nil, your app will get rejected.

Show taps in iOS App Demo Video

I am making demo videos of my iOS apps, some of which I made with XCode and others of which I made in Unity3D. I plan to use the Elgato Game Capture HD to capture my demo videos but I am not sure how to show the "taps." I found Touchpose, but when I changed the main.m as suggested by the instructions on the GitHub page I got error messages saying that QAppDelegate and QTouchposeApplication were undefined. I added import "QTouchposeApplication" but got an error message suggesting I change QAppDelegate to AppDelegate. When I did this the build failed. When I left it as QAppDelegate, added QAppDelegate to the project and imported it into the main.m the error messages went away but the build still failed. Am I doing something incorrectly? I found no tutorials on Touchpose online and am confused. Alternatively, is there some other easy solution, for example using the Elgato software or some other software or framework? I also tried Reflector but my wifi is not fast enough to support good frame rates with it. I am aware that I could use unity and "build for OSX" or in the case of XCode apps just screen record the simulator but I would prefer a single, foolproof solution for all of my apps. Thanks!
One way is to use assistive touch and create your own touch. You can do this by going to Settings > General > Accessibility > AssistiveTouch, turn it on, then tap the thing that pops up, click Custom, then create your own touch. Then use that touch to show taps in a screen recording.
It's a bad solution, but I'll post it in case it fits your needs.
You would have to superimpose multiple videos to make it so that only the tap shows and not the AssistiveTouch icon. Also, you can't scroll while using it.
It's also explained here: https://www.youtube.com/watch?v=4JqjU0-4Cek
Are you able to demo on a simulator? If so, Giphy Capture is a good solution. It has an option for showing taps in the settings.
If you can make your screen recording on iOS simulator, you can enable displaying taps with following code. Open your terminal and run it and restart your simulator.
defaults write com.apple.iphonesimulator ShowSingleTouches 1
I had trouble with Touchpose initially but figured out how to use it. The issue is that you have to go to build phases and add the .m. In regard to screen recording I am using the Elgato Game Capture HD. My only problem is showing the dots on Unity 3D applications, which is something I am still working on.

Resources