Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added simulator check #110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Source/LBXScanViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ open class LBXScanViewController: UIViewController {
}

@objc open func startScan() {

if UIDevice.current.isSimulator { return }

if scanObj == nil {
var cropRect = CGRect.zero
if isOpenInterestRect {
Expand Down
19 changes: 19 additions & 0 deletions Source/UIDevice+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// UIDevice+Extensions.swift
// swiftScan
//
// Created by Bertug Yilmaz (Dogus Teknoloji) on 5/20/21.
// Copyright © 2021 xialibing. All rights reserved.
//

import UIKit

extension UIDevice {
var isSimulator: Bool {
#if targetEnvironment(simulator)
return true
#else
return false
#endif
}
}
12 changes: 12 additions & 0 deletions swiftScan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
7D42B9B71C05EE9A0084D045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D42B9B61C05EE9A0084D045 /* Assets.xcassets */; };
7D42B9BA1C05EE9A0084D045 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7D42B9B81C05EE9A0084D045 /* LaunchScreen.storyboard */; };
7DA82E091C19CE5E0028B5DB /* logo.JPG in Resources */ = {isa = PBXBuildFile; fileRef = 7DA82E081C19CE5E0028B5DB /* logo.JPG */; };
CE3CAD792656BE61007EFD9D /* UIDevice+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3CAD782656BE61007EFD9D /* UIDevice+Extensions.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -67,6 +68,7 @@
7D46320C1C18683A00D70CF1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
7D46320D1C18683A00D70CF1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
7DA82E081C19CE5E0028B5DB /* logo.JPG */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = logo.JPG; sourceTree = "<group>"; };
CE3CAD782656BE61007EFD9D /* UIDevice+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIDevice+Extensions.swift"; sourceTree = "<group>"; };
D6DC96F61F6D0C0200E1CCEB /* SwiftScanner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftScanner.h; sourceTree = "<group>"; };
D6DC96F71F6D0C0200E1CCEB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -85,6 +87,7 @@
488928DC1C1A7BE4005A8F83 /* Source */ = {
isa = PBXGroup;
children = (
CE3CAE9B2656C2E7007EFD9D /* Extensions */,
48D3BBD01C70104100823F87 /* LBXPermissions.swift */,
488928DD1C1A7BE4005A8F83 /* LBXScanLineAnimation.swift */,
488928DE1C1A7BE4005A8F83 /* LBXScanNetAnimation.swift */,
Expand Down Expand Up @@ -135,6 +138,14 @@
path = swiftScan;
sourceTree = "<group>";
};
CE3CAE9B2656C2E7007EFD9D /* Extensions */ = {
isa = PBXGroup;
children = (
CE3CAD782656BE61007EFD9D /* UIDevice+Extensions.swift */,
);
name = Extensions;
sourceTree = "<group>";
};
D6DC96F51F6D0C0200E1CCEB /* SwiftScanner */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -237,6 +248,7 @@
73FF0B8F1CF545FE0083F169 /* ScanResultController.swift in Sources */,
488928E31C1A7BE4005A8F83 /* LBXScanLineAnimation.swift in Sources */,
48D3BBD11C70104100823F87 /* LBXPermissions.swift in Sources */,
CE3CAD792656BE61007EFD9D /* UIDevice+Extensions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down