Last active
January 3, 2026 20:56
-
-
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!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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