feat: open-source 小浣熊阅读 for iOS

This commit is contained in:
Aminark
2026-10-14 11:37:36 +08:00
commit ffc9e9d91d
193 changed files with 41382 additions and 0 deletions
@@ -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 }
}
}