In this tutorial we will be creating an iOS 14 tweak named
I assume you've already completed the iOS 14 Tweak Development: Beginner Tutorial. If not, I highly recommend checking it out before continuing.
Here's the final result we want to achieve by the end of this tutorial:
Make sure you have all the required tools installed. You can follow my guide to get started.
Name the project
PinAnim, and use the default values for
MobileSubstrate Bundle filter and
List of applications:
Next, open your project in your favorite editor and let's start coding.
First, we need to know what exactly to hook. Bring up Flex and select the Lock Screen dot.
SBFTouchPassThroughViewon the first try - just move it away until you're able to select the dots):
Click on the info button.
We need to find a method that is called whenever a dot reveals/changes:
setRevealed - exactly what we need. Let's see what parameters it accepts:
Excellent, let's do something with it in the code.
Let's create a new hook on
SBSimplePasscodeEntryFieldButton and override a method
remLogis a remote log function from my previous tutorial. It's very powerful, and easy to setup.
Build and install by running
make do and try pressing button. In our Python server we should see
setRevealed printed out multiple times.
Add the following code to the
- We need to call original function somewhere in the override, otherwise the functionality will most likely break.
- Because we want our dots to bounce up and down, we have to tell one of superviews to disable
clipToBounds. I figured out how
superviewsare needed here, so you don't need to. (Stupid code, don't use it in production please)
- Here we call the
animatefunction. Your IDE will give you an error, but don't worry, we will implement it in a second.
Now, let's make dots bounce. Using
UIView.animate we can create beautiful animations in a couple of lines. You can read more about it here. Here's my way of animating:
Woah, that's a lot of code. Let's break it down once again:
// orion:newcreates a new function.
UIView.animateanimates the animatable properties over time. For
withDurationset the value to
time, delay is not nessesary, so leave it at
0, for transition let's use
curveEaseInOut, because it's the smoothest of provided, and for
animationscreate a new block.
- Inside ths block, we need to determine whether the dot should bounce up or down. Create the variable that will store the multiplier.
- Set the final transform of the dot.
UIView.animatewill handle the rest.
- But we also need the dot to come back to it's original position!
- Same as step 2.
- Set the transform to (0,0), resetting the transform.
Build and run.