A non-App Store safe re-implementation of the 'slide to unlock' visual effect on iOS.
TOGlintyStringView
is a complete re-implementation of _UIGlintyStringView
, the internal UIKit UIView
responsible for the ‘> slide to unlock’ text on the lock screen of every iOS device running iOS 7 through to iOS 9.
It was created by copying the UIView
/ CALayer
configuration of _UIGlintyStringView
after introspecting it via Reveal app as well as a lot of console logging.
As this library (most likely) cannot be used in shipping iOS apps, it’s being presented here without warranty in the hopes it may have educational value to fellow developers!
I’ll improve this section down the line, but in a nutshell, it is comprised of 6 discrete CALayer
objects:
CAGradientLayer
that when blended with the gradient layers above and below it, creates a wedge shape falloff on either side of the sheen effect.CAShapeLayer
that takes a CGPath
outline of the text, and produces a blurred, dashed-line outline, that is then blended with the gradients to produce that subtle ‘fractal’ effect.All of this is possible in an (officially unsupported on iOS) feature of Core Animation allowing layers to be blended together using a variety of filters.
HAHAHAHA absolutely not. In order to make this effect possible, two private APIs needed to be invoked:
CALayer
objects, the allowsGroupBlending
property must be set to NO. This property is not officially exposed, but trivial to access, and probably easy to obfuscate from the app submission scanner.CAShapeLayer
, it is necessary to instantiate a CAFilter
instance. As this class definitely isn’t exposed on iOS, using it would immediately be caught by the automatic private API detection system Apple uses in app submissions.While you’re free to try, I wouldn’t recommend trying to submit an app to the App Store using this view.
TOGlintyStringView
was created by Tim Oliver as a Core Animation experiment.
It also incorporates the string-to-CGPathRef
library, created by Adrian Russell, 2014
iPhone 6s Plus device mockup by Pixeden.
TOGlintyStringView
is available under the MIT license. Please see the LICENSE file for more information.