mirror of
https://github.com/Aminark/legado-ios.git
synced 2026-10-23 04:11:22 +08:00
feat: open-source 小浣熊阅读 for iOS
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import Foundation
|
||||
import Vision
|
||||
|
||||
public struct QRCodeDecoder: Sendable {
|
||||
public init() {}
|
||||
public func detect(in data: Data) throws -> [String] {
|
||||
let request = VNDetectBarcodesRequest()
|
||||
request.symbologies = [.qr]
|
||||
try VNImageRequestHandler(data: data).perform([request])
|
||||
var seen = Set<String>()
|
||||
return (request.results ?? []).compactMap(\.payloadStringValue).filter { seen.insert($0).inserted }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user