Sunday, November 8, 2026
HomeiOS Developmentios - Create "Invisible Ink" impact in Swift or SwiftUI

ios – Create “Invisible Ink” impact in Swift or SwiftUI

[ad_1]

I am attempting to create an “Invisible Ink” animated view, just like the one existed in Messages app.
As I might see, Apple have a framework for it referred to as CKInvisibleInkImageEffectView nevertheless it’s non-public.

I used to be in a position to get an analogous consequence utilizing the non-public one, however I would prefer to create it from scratch or utilizing an open supply framework.

End result utilizing the non-public API:

class ViewController: UIViewController {

  @IBOutlet non-public weak var contentView: UIView!

  override func viewDidLoad() {
    tremendous.viewDidLoad()
    updateUI()
  }

  non-public func updateUI() {
    if let invisibleInk = getInvisibleInkEffectView() {
      invisibleInk.body = CGRect(origin: .zero, measurement: contentView.bounds.measurement)

      contentView.addSubview(invisibleInk)

      invisibleInk.layer.cornerRadius = invisibleInk.bounds.top / 2
      invisibleInk.backgroundColor = .systemBrown
      invisibleInk.layer.masksToBounds = true
    }
  }

  non-public func getInvisibleInkEffectView() -> UIView? {
    dlopen("/System/Library/PrivateFrameworks/ChatKit.framework/ChatKit", RTLD_NOW)
    let invisibleInkView = NSClassFromString("CKInvisibleInkImageEffectView") as? UIView.Sort
    let view = invisibleInkView?.init()
    return view
  }
}

demo

Impact in Message App I want to implement:

enter image description here

Anybody is aware of if there’s any open supply framework or create it in Swift or SwiftUI?

Thanks

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments