Skip to content

Commit

Permalink
Merge pull request #185 from gbreen12/master
Browse files Browse the repository at this point in the history
Add Support For SPM
  • Loading branch information
3lvis authored Oct 9, 2020
2 parents 6fe5bb5 + 0053a59 commit 616aa6e
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 5 additions & 17 deletions BarcodeScanner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

/* Begin PBXBuildFile section */
2DBF9E0E1F169DEF006B5AA8 /* FocusViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DBF9E0D1F169DEF006B5AA8 /* FocusViewType.swift */; };
CE8C0771252FBBAF007FF4A4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE8C0770252FBBAF007FF4A4 /* Images.xcassets */; };
D504555F1FD8714700E46826 /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D504555E1FD8714700E46826 /* UIView+Extensions.swift */; };
D50BE3E91C9FE7A80000A34C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D50BE3E51C9FE7A80000A34C /* [email protected] */; };
D50BE3EA1C9FE7A80000A34C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D50BE3E61C9FE7A80000A34C /* [email protected] */; };
D50BE3EB1C9FE7A80000A34C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D50BE3E71C9FE7A80000A34C /* [email protected] */; };
D5349DF8201E42D900CD53EA /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D5349DF7201E42D900CD53EA /* [email protected] */; };
D55281B62016758F00FF3CDD /* HeaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55281B52016758F00FF3CDD /* HeaderViewController.swift */; };
D55281B8201675D500FF3CDD /* MessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55281B7201675D500FF3CDD /* MessageViewController.swift */; };
D55281BA2016770800FF3CDD /* CameraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55281B92016770800FF3CDD /* CameraViewController.swift */; };
Expand All @@ -28,11 +25,8 @@

/* Begin PBXFileReference section */
2DBF9E0D1F169DEF006B5AA8 /* FocusViewType.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = FocusViewType.swift; sourceTree = "<group>"; tabWidth = 2; };
CE8C0770252FBBAF007FF4A4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
D504555E1FD8714700E46826 /* UIView+Extensions.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = "UIView+Extensions.swift"; sourceTree = "<group>"; tabWidth = 2; };
D50BE3E51C9FE7A80000A34C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D50BE3E61C9FE7A80000A34C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D50BE3E71C9FE7A80000A34C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D5349DF7201E42D900CD53EA /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D55281B52016758F00FF3CDD /* HeaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderViewController.swift; sourceTree = "<group>"; };
D55281B7201675D500FF3CDD /* MessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageViewController.swift; sourceTree = "<group>"; };
D55281B92016770800FF3CDD /* CameraViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -62,10 +56,7 @@
D50BE3E31C9FE7A80000A34C /* Images */ = {
isa = PBXGroup;
children = (
D5349DF7201E42D900CD53EA /* [email protected] */,
D50BE3E51C9FE7A80000A34C /* [email protected] */,
D50BE3E61C9FE7A80000A34C /* [email protected] */,
D50BE3E71C9FE7A80000A34C /* [email protected] */,
CE8C0770252FBBAF007FF4A4 /* Images.xcassets */,
);
path = Images;
sourceTree = "<group>";
Expand Down Expand Up @@ -95,7 +86,6 @@
D5B2E8951C3A780C00C0327D = {
isa = PBXGroup;
children = (
D50BE3E31C9FE7A80000A34C /* Images */,
D5C629691C3A809D007F7B7C /* Sources */,
D5C6295C1C3A800E007F7B7C /* BarcodeScanner */,
D5B2E8A01C3A780C00C0327D /* Products */,
Expand All @@ -121,6 +111,7 @@
D5C629691C3A809D007F7B7C /* Sources */ = {
isa = PBXGroup;
children = (
D50BE3E31C9FE7A80000A34C /* Images */,
D5CB3785201947D000B9319D /* Helpers */,
D5CB37842019477900B9319D /* DataStructures */,
D55281BD20167D9F00FF3CDD /* Extensions */,
Expand Down Expand Up @@ -218,10 +209,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D50BE3E91C9FE7A80000A34C /* [email protected] in Resources */,
D5349DF8201E42D900CD53EA /* [email protected] in Resources */,
D50BE3EB1C9FE7A80000A34C /* [email protected] in Resources */,
D50BE3EA1C9FE7A80000A34C /* [email protected] in Resources */,
CE8C0771252FBBAF007FF4A4 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "BarcodeScanner",
defaultLocalization: "en",
platforms: [.iOS(.v10)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "BarcodeScanner",
targets: ["BarcodeScanner"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "BarcodeScanner",
path: "Sources",
resources: [.copy("Images/[email protected]")]),
]
)
14 changes: 2 additions & 12 deletions Sources/Helpers/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ import AVFoundation
- Returns: An image.
*/
func imageNamed(_ name: String) -> UIImage {
let cls = BarcodeScannerViewController.self
var bundle = Bundle(for: cls)
let traitCollection = UITraitCollection(displayScale: 3)

if let resourceBundle = bundle.resourcePath.flatMap({ Bundle(path: $0 + "/BarcodeScanner.bundle") }) {
bundle = resourceBundle
}

guard let image = UIImage(named: name, in: bundle, compatibleWith: traitCollection) else {
guard let image = UIImage(named: name, in: Bundle.module, compatibleWith: traitCollection) else {
return UIImage()
}

Expand All @@ -28,11 +22,7 @@ func imageNamed(_ name: String) -> UIImage {
- Returns: An image.
*/
func localizedString(_ key: String) -> String {
if let path = Bundle(for: BarcodeScannerViewController.self).resourcePath,
let resourceBundle = Bundle(path: path + "/Localization.bundle") {
return resourceBundle.localizedString(forKey: key, value: nil, table: "Localizable")
}
return key
NSLocalizedString(key, bundle: Bundle.module, comment: key)
}

/// Checks if the app is running in Simulator.
Expand Down
6 changes: 6 additions & 0 deletions Sources/Images/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
21 changes: 21 additions & 0 deletions Sources/Images/Images.xcassets/cameraRotate.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
File renamed without changes
21 changes: 21 additions & 0 deletions Sources/Images/Images.xcassets/flashOff.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
File renamed without changes
21 changes: 21 additions & 0 deletions Sources/Images/Images.xcassets/flashOn.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
File renamed without changes
21 changes: 21 additions & 0 deletions Sources/Images/Images.xcassets/info.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 616aa6e

Please sign in to comment.