Skip to content

Commit d305b71

Browse files
author
Heart
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents 54dfe52 + e8737ad commit d305b71

File tree

11 files changed

+158
-144
lines changed

11 files changed

+158
-144
lines changed

.DS_Store

6 KB
Binary file not shown.

ExampleProject/.DS_Store

6 KB
Binary file not shown.

ExampleProject/ExampleProject.xcodeproj/project.pbxproj

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -15,7 +15,6 @@
1515
3EC5EF8523C447EE0063A687 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3EC5EF8423C447EE0063A687 /* Preview Assets.xcassets */; };
1616
3EC5EF8823C447EE0063A687 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3EC5EF8623C447EE0063A687 /* LaunchScreen.storyboard */; };
1717
3EC5EF9223C448A20063A687 /* ModalScannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EC5EF9123C448A20063A687 /* ModalScannerView.swift */; };
18-
3ECBC9C2267C4E1E00C1089D /* CarBode in Frameworks */ = {isa = PBXBuildFile; productRef = 3ECBC9C1267C4E1E00C1089D /* CarBode */; };
1918
/* End PBXBuildFile section */
2019

2120
/* Begin PBXFileReference section */
@@ -29,14 +28,14 @@
2928
3EC5EF8723C447EE0063A687 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
3029
3EC5EF8923C447EE0063A687 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3130
3EC5EF9123C448A20063A687 /* ModalScannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalScannerView.swift; sourceTree = "<group>"; };
31+
B4DA34042CA7D61900A817E5 /* CarBode-Barcode-Scanner-For-SwiftUI-master */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "CarBode-Barcode-Scanner-For-SwiftUI-master"; path = ..; sourceTree = "<group>"; };
3232
/* End PBXFileReference section */
3333

3434
/* Begin PBXFrameworksBuildPhase section */
3535
3EC5EF7523C447EA0063A687 /* Frameworks */ = {
3636
isa = PBXFrameworksBuildPhase;
3737
buildActionMask = 2147483647;
3838
files = (
39-
3ECBC9C2267C4E1E00C1089D /* CarBode in Frameworks */,
4039
);
4140
runOnlyForDeploymentPostprocessing = 0;
4241
};
@@ -87,6 +86,7 @@
8786
4FE393DE2521C1FD007165D3 /* Frameworks */ = {
8887
isa = PBXGroup;
8988
children = (
89+
B4DA34042CA7D61900A817E5 /* CarBode-Barcode-Scanner-For-SwiftUI-master */,
9090
);
9191
name = Frameworks;
9292
sourceTree = "<group>";
@@ -108,7 +108,6 @@
108108
);
109109
name = ExampleProject;
110110
packageProductDependencies = (
111-
3ECBC9C1267C4E1E00C1089D /* CarBode */,
112111
);
113112
productName = ExampleProject;
114113
productReference = 3EC5EF7823C447EA0063A687 /* ExampleProject.app */;
@@ -139,7 +138,6 @@
139138
);
140139
mainGroup = 3EC5EF6F23C447EA0063A687;
141140
packageReferences = (
142-
3ECBC9C0267C4E1E00C1089D /* XCRemoteSwiftPackageReference "CarBode-Barcode-Scanner-For-SwiftUI" */,
143141
);
144142
productRefGroup = 3EC5EF7923C447EA0063A687 /* Products */;
145143
projectDirPath = "";
@@ -310,9 +308,10 @@
310308
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
311309
CODE_SIGN_STYLE = Automatic;
312310
DEVELOPMENT_ASSET_PATHS = "\"ExampleProject/Preview Content\"";
313-
DEVELOPMENT_TEAM = 5PN9LL8N5M;
311+
DEVELOPMENT_TEAM = Y9Y97FRR32;
314312
ENABLE_PREVIEWS = YES;
315313
INFOPLIST_FILE = ExampleProject/Info.plist;
314+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
316315
LD_RUNPATH_SEARCH_PATHS = (
317316
"$(inherited)",
318317
"@executable_path/Frameworks",
@@ -330,9 +329,10 @@
330329
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
331330
CODE_SIGN_STYLE = Automatic;
332331
DEVELOPMENT_ASSET_PATHS = "\"ExampleProject/Preview Content\"";
333-
DEVELOPMENT_TEAM = 5PN9LL8N5M;
332+
DEVELOPMENT_TEAM = Y9Y97FRR32;
334333
ENABLE_PREVIEWS = YES;
335334
INFOPLIST_FILE = ExampleProject/Info.plist;
335+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
336336
LD_RUNPATH_SEARCH_PATHS = (
337337
"$(inherited)",
338338
"@executable_path/Frameworks",
@@ -366,25 +366,6 @@
366366
defaultConfigurationName = Release;
367367
};
368368
/* End XCConfigurationList section */
369-
370-
/* Begin XCRemoteSwiftPackageReference section */
371-
3ECBC9C0267C4E1E00C1089D /* XCRemoteSwiftPackageReference "CarBode-Barcode-Scanner-For-SwiftUI" */ = {
372-
isa = XCRemoteSwiftPackageReference;
373-
repositoryURL = "https://github.com/heart/CarBode-Barcode-Scanner-For-SwiftUI";
374-
requirement = {
375-
branch = develop;
376-
kind = branch;
377-
};
378-
};
379-
/* End XCRemoteSwiftPackageReference section */
380-
381-
/* Begin XCSwiftPackageProductDependency section */
382-
3ECBC9C1267C4E1E00C1089D /* CarBode */ = {
383-
isa = XCSwiftPackageProductDependency;
384-
package = 3ECBC9C0267C4E1E00C1089D /* XCRemoteSwiftPackageReference "CarBode-Barcode-Scanner-For-SwiftUI" */;
385-
productName = CarBode;
386-
};
387-
/* End XCSwiftPackageProductDependency section */
388369
};
389370
rootObject = 3EC5EF7023C447EA0063A687 /* Project object */;
390371
}

ExampleProject/ExampleProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 0 additions & 16 deletions
This file was deleted.
6 KB
Binary file not shown.

ExampleProject/ExampleProject/ModalScannerView.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct cameraFrame: Shape {
5252
struct ModalScannerView: View {
5353
@State var barcodeValue = ""
5454
@State var torchIsOn = false
55+
@State var zoom = 2.0
5556
@State var showingAlert = false
5657
@State var cameraPosition = AVCaptureDevice.Position.back
5758

@@ -63,6 +64,15 @@ struct ModalScannerView: View {
6364

6465
if cameraPosition == .back{
6566
Text("Using back camera")
67+
68+
Picker("Zoom", selection: $zoom) {
69+
Text("0.5x")
70+
.tag(1.0)
71+
Text("1.0x")
72+
.tag(2.0)
73+
}
74+
.pickerStyle(.segmented)
75+
.padding(.horizontal)
6676
}else{
6777
Text("Using front camera")
6878
}
@@ -93,6 +103,7 @@ struct ModalScannerView: View {
93103
CBScanner(
94104
supportBarcode: .constant([.qr, .code128]),
95105
torchLightIsOn: $torchIsOn,
106+
zoom:$zoom,
96107
cameraPosition: $cameraPosition,
97108
mockBarCode: .constant(BarcodeData(value:"My Test Data", type: .qr))
98109
){

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.3
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "CarBode",
88
platforms: [
9-
.iOS(.v13)
9+
.iOS(.v14)
1010
],
1111
products: [
1212
// Products define the executables and libraries produced by a package, and make them visible to other packages.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<img src="./logo/coffee.png" height="100">
44

5-
[Buy me a coffee.](#donation)
5+
[Buy me a coffee.](#donate-to-support-this-project)
66

77
---
88

Sources/CarBode/BarcodeFrame.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import UIKit
99

10+
1011
public struct BarcodeFrame {
1112

1213
public let corners:[CGPoint]

Sources/CarBode/CBScanner.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import SwiftUI
1010
import AVFoundation
1111

12-
13-
1412
public struct CBScanner: UIViewRepresentable {
1513

1614
public typealias OnFound = (BarcodeData)->Void
@@ -24,6 +22,9 @@ public struct CBScanner: UIViewRepresentable {
2422
@Binding
2523
public var torchLightIsOn:Bool
2624

25+
@Binding
26+
public var zoom:Double
27+
2728
@Binding
2829
public var scanInterval: Double
2930

@@ -40,6 +41,7 @@ public struct CBScanner: UIViewRepresentable {
4041

4142
public init(supportBarcode:Binding<[AVMetadataObject.ObjectType]> ,
4243
torchLightIsOn: Binding<Bool> = .constant(false),
44+
zoom: Binding<Double> = .constant(2.0),
4345
scanInterval: Binding<Double> = .constant(3.0),
4446
cameraPosition: Binding<AVCaptureDevice.Position> = .constant(.back),
4547
mockBarCode: Binding<BarcodeData> = .constant(BarcodeData(value: "barcode value", type: .qr)),
@@ -48,6 +50,7 @@ public struct CBScanner: UIViewRepresentable {
4850
onDraw: OnDraw? = nil
4951
) {
5052
_torchLightIsOn = torchLightIsOn
53+
_zoom = zoom
5154
_supportBarcode = supportBarcode
5255
_scanInterval = scanInterval
5356
_cameraPosition = cameraPosition
@@ -73,8 +76,9 @@ public struct CBScanner: UIViewRepresentable {
7376
}
7477

7578
public func updateUIView(_ uiView: CameraPreview, context: UIViewRepresentableContext<CBScanner>) {
76-
79+
7780
uiView.setTorchLight(isOn: torchLightIsOn)
81+
uiView.zoom(to: zoom)
7882
uiView.setCamera(position: cameraPosition)
7983
uiView.scanInterval = scanInterval
8084
uiView.setSupportedBarcode(supportBarcode: supportBarcode)

0 commit comments

Comments
 (0)