I have attempted to develop a game using swift that leverages the 3D touch hardware of iPhones. However, as I was submitting my app to the App Store, it got rejected because the game wasn't playable on iPads.
My question is, what is the best way of implementing a similar functionality for non 3D touch devices? The way I am doing right now is by implementing the following method
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
if self.didStartGame, let touch = touches.first {
let maximumPossibleForce = touch.maximumPossibleForce
let force = touch.force
let normalizedForce = min(force/maximumPossibleForce * 2.5, 1)
// Added game-related code here to modify scene accordingly
}
}
When running the latter on non 3D touch devices, debugging the value of touch.maximumPossibleForce returns 0.
You cannot detect force touch on devices that that don't support it.
But maybe you could use the
majorRadiusproperty onUITouch. It gives you the radius of the touch.With the radius you can allow users that don't have a 3d touch device to control your game with the angle of their finger:
This is the code for the above example: