Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To perform barcode recognition using the Aspose.BarCode.Cloud SDK for Swift, you need to set the source of the barcode image. Methods of this SDK support loading barcode images from multiple sources, such as file URL, Data, and base64 encoded data. This guide provides detailed examples on how to set barcode image source through different API methods.
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let barcodeImageURL =
ProcessInfo.processInfo.environment["TEST_CONFIGURATION_BARCODE_IMAGE_URL"]
?? "https://raw.githubusercontent.com/aspose-barcode-cloud/Aspose.BarCode-Cloud-SDK-for-Swift/main/testdata/QR_and_Code128.png"
let response = try await ScanAPI.scan(
fileUrl: barcodeImageURL,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "qr.png"))
let request = ScanBase64Request(fileBase64: imageData.base64EncodedString())
let response = try await ScanAPI.scanBase64(
scanBase64Request: request,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "qr.png"))
let response = try await ScanAPI.scanMultipart(
file: imageData,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let barcodeImageURL =
ProcessInfo.processInfo.environment["TEST_CONFIGURATION_BARCODE_IMAGE_URL"]
?? "https://raw.githubusercontent.com/aspose-barcode-cloud/Aspose.BarCode-Cloud-SDK-for-Swift/main/testdata/QR_and_Code128.png"
let response = try await RecognizeAPI.recognize(
barcodeType: .qr,
fileUrl: barcodeImageURL,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "qr.png"))
let request = RecognizeBase64Request(
barcodeTypes: [.qr],
fileBase64: imageData.base64EncodedString()
)
let response = try await RecognizeAPI.recognizeBase64(
recognizeBase64Request: request,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
import AsposeBarcodeCloud
import Foundation
let client = AsposeBarcodeCloudClient(
clientId: "Client Id from https://dashboard.aspose.cloud/applications",
clientSecret: "Client Secret from https://dashboard.aspose.cloud/applications"
)
let imageData = try Data(contentsOf: URL(fileURLWithPath: "qr.png"))
let response = try await RecognizeAPI.recognizeMultipart(
barcodeType: .qr,
file: imageData,
apiConfiguration: client.apiConfiguration
)
print(response.barcodes?.first?.barcodeValue ?? "No barcode found")
Using the Aspose.BarCode.Cloud SDK for Swift, you can easily load and recognize barcode images in file URL, Data, and base64 encoded formats.
Optimize your barcode recognition workflows by selecting the most appropriate method based on your specific image format and application requirements.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.