0

I have secrets that need to be shared in my application, and would like to adopt the "Invisible Ink" feature that is new in iOS 10.

enter image description here https://youtu.be/n5jXg_NNiCA?t=1h27m30s

Since I'm creating a greenfield application (version 1) I think this visual element of consistency is a good thing to include in my app.

Is the invisible ink UX available for developers?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
makerofthings7
  • 60,103
  • 53
  • 215
  • 448

1 Answers1

2

First and foremost, the invisible ink view is inside a private framework, and using private frameworks will cause your app to be rejected in the App Store reviewing process. Still, for the community's sake, here's your answer (I'm sorry I got it to you in Obj-C, I'll try and come back later to update it to Swift):

You need to go around using dlopen to load the ChatKit framework manually in your app:

dlopen("/System/Library/PrivateFrameworks/ChatKit.framework/ChatKit", RTLD_LAZY);
// or use RTLD_NOW if you need it loaded immediately

Then, instantiate a CKInvisibleInkImageEffectView using NSClassFromString:

id invisibleInk = [[NSClassFromString(@"CKInvisibleInkImageEffectView") alloc] initWithFrame: yourFrame];
[invisibleInk performSelector:@selector(setImage:) withObject: yourUIImage];
//You likely want to put the InvisibleInkView right over an UIImageView containing the very same image

That should do the trick for you. Remember to actually add the InvisibleInk view wherever you want using yourView.addSubview(invisibleInk), and have fun.

Uzaak
  • 578
  • 3
  • 13