mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
29 lines
692 B
Swift
29 lines
692 B
Swift
import Foundation
|
|
import UIKit
|
|
import Display
|
|
import MetalKit
|
|
|
|
private final class BundleMarker: NSObject {
|
|
}
|
|
|
|
private var metalLibraryValue: MTLLibrary?
|
|
func metalLibrary(device: MTLDevice) -> MTLLibrary? {
|
|
if let metalLibraryValue {
|
|
return metalLibraryValue
|
|
}
|
|
|
|
let mainBundle = Bundle(for: BundleMarker.self)
|
|
guard let path = mainBundle.path(forResource: "CameraScreenBundle", ofType: "bundle") else {
|
|
return nil
|
|
}
|
|
guard let bundle = Bundle(path: path) else {
|
|
return nil
|
|
}
|
|
guard let library = try? device.makeDefaultLibrary(bundle: bundle) else {
|
|
return nil
|
|
}
|
|
|
|
metalLibraryValue = library
|
|
return library
|
|
}
|