Skip to content

Commit 87a6c59

Browse files
Merge pull request #32 from Dynamsoft/02162023
Merging changes on 02102023
2 parents 5b02099 + 7101ee0 commit 87a6c59

File tree

23 files changed

+133
-46
lines changed

23 files changed

+133
-46
lines changed

ios/Swift/DecodeWithAVCaptureSession/DecodeWithAVCaptureSession/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppDelegate.swift
33
// DecodeWithAVCaptureSession
44
//
5-
// Created by admin on 2022/3/15.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import UIKit

ios/Swift/DecodeWithAVCaptureSession/DecodeWithAVCaptureSession/CameraViewController.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// CameraViewController.swift
33
// DecodeWithAVCaptureSession
44
//
5-
// Created by admin on 2022/6/16.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import Foundation
@@ -11,8 +11,8 @@ import DynamsoftBarcodeReader
1111

1212
class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate, ImageSource, DBRTextResultListener{
1313

14-
var barcodeReader:DynamsoftBarcodeReader! = nil
15-
var imageData:iImageData! = nil
14+
var barcodeReader:DynamsoftBarcodeReader!
15+
var imageData:iImageData!
1616
override func viewDidLoad() {
1717
super.viewDidLoad()
1818
setDBR()
@@ -37,21 +37,21 @@ class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampleBuff
3737
func setSession() {
3838
let session = AVCaptureSession.init()
3939
session.sessionPreset = .hd1920x1080
40-
let device = AVCaptureDevice.default(
41-
for: .video)
42-
var input: AVCaptureDeviceInput? = nil
40+
let device = AVCaptureDevice.default(for: .video)
41+
var input: AVCaptureDeviceInput?
4342
do {
44-
if let device = device {
45-
input = try AVCaptureDeviceInput(
46-
device: device)
43+
if let device {
44+
input = try AVCaptureDeviceInput(device: device)
4745
}
4846
} catch {
47+
print("\(error)")
4948
}
5049

5150
if (input == nil) {
5251
// Handling the error appropriately.
52+
}else{
53+
session.addInput(input!)
5354
}
54-
session.addInput(input!)
5555

5656
let output = AVCaptureVideoDataOutput.init()
5757
session.addOutput(output)
@@ -82,7 +82,7 @@ class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampleBuff
8282
var msgText:String = ""
8383
let title:String = "Results"
8484
for item in results! {
85-
msgText = msgText + String(format:"\nFormat: %@\nText: %@\n", item.barcodeFormatString!,item.barcodeText ?? "noResuslt")
85+
msgText = msgText + String(format:"\nFormat: %@\nText: %@\n", item.barcodeFormatString!,item.barcodeText ?? "No Resuslt")
8686
}
8787
showResult(title, msgText, "OK") {
8888
}
@@ -111,7 +111,6 @@ class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampleBuff
111111
imageData.height = height
112112
imageData.stride = bpr
113113
imageData.format = .ARGB_8888
114-
115114
}
116115

117116
private func showResult(_ title: String, _ msg: String, _ acTitle: String, completion: @escaping () -> Void) {

ios/Swift/DecodeWithAVCaptureSession/DecodeWithAVCaptureSession/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ViewController.swift
33
// DecodeWithAVCaptureSession
44
//
5-
// Created by admin on 2022/3/15.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import UIKit

ios/Swift/GeneralSettingsSwift/GeneralSettingsSwift/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ViewController: UIViewController, DBRTextResultListener {
6262
GeneralSettings.shared.barcodeReader = DynamsoftBarcodeReader.init()
6363
GeneralSettings.shared.barcodeReader.setDBRTextResultListener(self)
6464

65-
GeneralSettings.shared.ipublicRuntimeSettings = try! GeneralSettings.shared.barcodeReader.getRuntimeSettings()
65+
GeneralSettings.shared.ipublicRuntimeSettings = try? GeneralSettings.shared.barcodeReader.getRuntimeSettings()
6666
}
6767

6868
func configureDefaultDCE() -> Void {
@@ -154,7 +154,7 @@ class ViewController: UIViewController, DBRTextResultListener {
154154
var msgText:String = ""
155155
let title:String = "Results"
156156
for item in results! {
157-
msgText = msgText + String(format:"\nFormat: %@\nText: %@\n", item.barcodeFormatString!,item.barcodeText ?? "noResuslt")
157+
msgText = msgText + String(format:"\nFormat: %@\nText: %@\n", item.barcodeFormatString!,item.barcodeText ?? "No Resuslt")
158158
}
159159

160160
showSingleResult(title, msgText, "OK") {

ios/Swift/HelloWorldSwift/HelloWorldSwift/AppDelegate.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//
2+
// AppDelegate.swift
3+
// HelloWorldSwift
4+
//
5+
// Copyright © Dynamsoft. All rights reserved.
6+
//
7+
18
import UIKit
29

310
@UIApplicationMain
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}

ios/Swift/HelloWorldSwift/HelloWorldSwift/ViewController.swift

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
//
22
// ViewController.swift
3+
// HelloWorldSwift
34
//
5+
// Copyright © Dynamsoft. All rights reserved.
46
//
57

68
import UIKit
79

810
class ViewController: UIViewController, DBRTextResultListener {
911

10-
var dce:DynamsoftCameraEnhancer! = nil
11-
var dceView:DCECameraView! = nil
12-
var barcodeReader:DynamsoftBarcodeReader! = nil
12+
var dce:DynamsoftCameraEnhancer!
13+
var dceView:DCECameraView!
14+
var barcodeReader:DynamsoftBarcodeReader!
1315

1416
override func viewWillAppear(_ animated: Bool) {
1517
super.viewWillAppear(animated)
@@ -32,11 +34,16 @@ class ViewController: UIViewController, DBRTextResultListener {
3234

3335
func configurationDBR() {
3436
barcodeReader = DynamsoftBarcodeReader.init()
35-
barcodeReader.updateRuntimeSettings(EnumPresetTemplate.videoSingleBarcode)
37+
barcodeReader.updateRuntimeSettings(EnumPresetTemplate.videoSingleBarcode)
38+
3639
/*
37-
let settings:iPublicRuntimeSettings = try!barcodeReader.getRuntimeSettings()
40+
let settings:iPublicRuntimeSettings = try?barcodeReader.getRuntimeSettings()
3841
settings.barcodeFormatIds = EnumBarcodeFormat.ONED.rawValue | EnumBarcodeFormat.QRCODE.rawValue | EnumBarcodeFormat.DATAMATRIX.rawValue | EnumBarcodeFormat.PDF417.rawValue
39-
try?barcodeReader.updateRuntimeSettings(settings)
42+
do{
43+
try barcodeReader.updateRuntimeSettings(settings)
44+
}catch{
45+
print("\(error)")
46+
}
4047
*/
4148
}
4249

ios/Swift/ImageDecodingSwift/ImageDecodingSwift/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppDelegate.swift
33
// ImageDecodingSwift
44
//
5-
// Created by dynamsoft's mac on 2022/12/27.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import UIKit

ios/Swift/ImageDecodingSwift/ImageDecodingSwift/PCH/Dynamsoft.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Dynamsoft.swift
33
// ImageDecodingSwift
44
//
5-
// Created by dynamsoft's mac on 2022/12/27.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import Foundation

ios/Swift/ImageDecodingSwift/ImageDecodingSwift/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ViewController.swift
33
// ImageDecodingSwift
44
//
5-
// Created by dynamsoft's mac on 2022/12/27.
5+
// Copyright © Dynamsoft. All rights reserved.
66
//
77

88
import UIKit

0 commit comments

Comments
 (0)