Skip to content

Instantly share code, notes, and snippets.

@Mcrich23
Last active January 3, 2026 20:56
Show Gist options
  • Select an option

  • Save Mcrich23/5316273d374f1b3530bbfa3d9452d7c9 to your computer and use it in GitHub Desktop.

Select an option

Save Mcrich23/5316273d374f1b3530bbfa3d9452d7c9 to your computer and use it in GitHub Desktop.
A function that creates a _UIViewGlass object with the correctly numbered variant. All in swift!
public func _UIViewGlass(variant: Int) -> NSObject? {
let glassClass = objc_lookUpClass("_UIViewGlass")! as AnyObject
let glass = glassClass._alloc()._init(variant: variant)
return glass as? NSObject
}
/// Registers Objective-C methods Swift needs.
fileprivate final class PrivateSelectors: NSObject {
@objc(alloc)
func _alloc() -> AnyObject {
fatalError("Do not call")
}
@objc(initWithVariant:)
func _init(variant: Int) -> AnyObject {
fatalError("Do not call")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment