Commit 7f4f7a08 authored by domenicw's avatar domenicw
Browse files

Merge remote-tracking branch 'origin/zdenis'

# Conflicts:
#	Amiv.xcodeproj/project.pbxproj
#	Amiv/Amiv Micro Apps/Model/AmivMicroAppModel.swift
#	Amiv/Networking/Service/EndPointType.swift
parents a7985354 5aadf20d
[submodule "RSBarcodes_Swift"]
path = RSBarcodes_Swift
url = https://github.com/yeahdongcn/RSBarcodes_Swift.git
......@@ -7,6 +7,28 @@
objects = {
/* Begin PBXBuildFile section */
92232A5F217144E3000780A2 /* BarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92232A5E217144E3000780A2 /* BarcodeViewController.swift */; };
92232A6521716D99000780A2 /* BarcodeViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92232A6421716D99000780A2 /* BarcodeViewControllerDelegate.swift */; };
92F912F72172015F00B883BA /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E02172015D00B883BA /* StringExtension.swift */; };
92F912F82172015F00B883BA /* RSCodeLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E12172015D00B883BA /* RSCodeLayer.swift */; };
92F912F92172015F00B883BA /* RSCode128Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E22172015D00B883BA /* RSCode128Generator.swift */; };
92F912FA2172015F00B883BA /* RSCornersLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E32172015D00B883BA /* RSCornersLayer.swift */; };
92F912FB2172015F00B883BA /* UIColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E52172015D00B883BA /* UIColorExtension.swift */; };
92F912FC2172015F00B883BA /* RSCode39Mod43Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E62172015D00B883BA /* RSCode39Mod43Generator.swift */; };
92F912FD2172015F00B883BA /* RSCode93Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E72172015D00B883BA /* RSCode93Generator.swift */; };
92F912FE2172015F00B883BA /* RSCode39Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912E82172015D00B883BA /* RSCode39Generator.swift */; };
92F913002172015F00B883BA /* RSExtendedCode39Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912EA2172015E00B883BA /* RSExtendedCode39Generator.swift */; };
92F913012172015F00B883BA /* RSFocusMarkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912EB2172015E00B883BA /* RSFocusMarkLayer.swift */; };
92F913022172015F00B883BA /* ContextMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = 92F912EC2172015E00B883BA /* ContextMaker.m */; };
92F913032172015F00B883BA /* RSUnifiedCodeValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912EE2172015E00B883BA /* RSUnifiedCodeValidator.swift */; };
92F913042172015F00B883BA /* RSCodeDataMatrixGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912EF2172015E00B883BA /* RSCodeDataMatrixGenerator.swift */; };
92F913052172015F00B883BA /* RSCodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F02172015E00B883BA /* RSCodeGenerator.swift */; };
92F913062172015F00B883BA /* RSCodeReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F12172015E00B883BA /* RSCodeReaderViewController.swift */; };
92F913072172015F00B883BA /* RSEANGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F22172015F00B883BA /* RSEANGenerator.swift */; };
92F913082172015F00B883BA /* RSITF14Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F32172015F00B883BA /* RSITF14Generator.swift */; };
92F913092172015F00B883BA /* RSITFGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F42172015F00B883BA /* RSITFGenerator.swift */; };
92F9130A2172015F00B883BA /* RSUnifiedCodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F52172015F00B883BA /* RSUnifiedCodeGenerator.swift */; };
92F9130B2172015F00B883BA /* RSUPCEGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F912F62172015F00B883BA /* RSUPCEGenerator.swift */; };
B048377E21582D4E00AFA689 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B048377D21582D4E00AFA689 /* String+Extension.swift */; };
B050E120215169230090CB79 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B050E11F215169230090CB79 /* AppDelegate.swift */; };
B050E127215169250090CB79 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B050E126215169250090CB79 /* Assets.xcassets */; };
......@@ -118,6 +140,30 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
92232A5E217144E3000780A2 /* BarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeViewController.swift; sourceTree = "<group>"; };
92232A6421716D99000780A2 /* BarcodeViewControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarcodeViewControllerDelegate.swift; sourceTree = "<group>"; };
92F912E02172015D00B883BA /* StringExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; };
92F912E12172015D00B883BA /* RSCodeLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCodeLayer.swift; sourceTree = "<group>"; };
92F912E22172015D00B883BA /* RSCode128Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCode128Generator.swift; sourceTree = "<group>"; };
92F912E32172015D00B883BA /* RSCornersLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCornersLayer.swift; sourceTree = "<group>"; };
92F912E42172015D00B883BA /* ContextMaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMaker.h; sourceTree = "<group>"; };
92F912E52172015D00B883BA /* UIColorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColorExtension.swift; sourceTree = "<group>"; };
92F912E62172015D00B883BA /* RSCode39Mod43Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCode39Mod43Generator.swift; sourceTree = "<group>"; };
92F912E72172015D00B883BA /* RSCode93Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCode93Generator.swift; sourceTree = "<group>"; };
92F912E82172015D00B883BA /* RSCode39Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCode39Generator.swift; sourceTree = "<group>"; };
92F912EA2172015E00B883BA /* RSExtendedCode39Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSExtendedCode39Generator.swift; sourceTree = "<group>"; };
92F912EB2172015E00B883BA /* RSFocusMarkLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSFocusMarkLayer.swift; sourceTree = "<group>"; };
92F912EC2172015E00B883BA /* ContextMaker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContextMaker.m; sourceTree = "<group>"; };
92F912ED2172015E00B883BA /* RSBarcodes-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RSBarcodes-Bridging-Header.h"; sourceTree = "<group>"; };
92F912EE2172015E00B883BA /* RSUnifiedCodeValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSUnifiedCodeValidator.swift; sourceTree = "<group>"; };
92F912EF2172015E00B883BA /* RSCodeDataMatrixGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCodeDataMatrixGenerator.swift; sourceTree = "<group>"; };
92F912F02172015E00B883BA /* RSCodeGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCodeGenerator.swift; sourceTree = "<group>"; };
92F912F12172015E00B883BA /* RSCodeReaderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSCodeReaderViewController.swift; sourceTree = "<group>"; };
92F912F22172015F00B883BA /* RSEANGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSEANGenerator.swift; sourceTree = "<group>"; };
92F912F32172015F00B883BA /* RSITF14Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSITF14Generator.swift; sourceTree = "<group>"; };
92F912F42172015F00B883BA /* RSITFGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSITFGenerator.swift; sourceTree = "<group>"; };
92F912F52172015F00B883BA /* RSUnifiedCodeGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSUnifiedCodeGenerator.swift; sourceTree = "<group>"; };
92F912F62172015F00B883BA /* RSUPCEGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RSUPCEGenerator.swift; sourceTree = "<group>"; };
B048377D21582D4E00AFA689 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
B050E11C215169230090CB79 /* Amiv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Amiv.app; sourceTree = BUILT_PRODUCTS_DIR; };
B050E11F215169230090CB79 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
......@@ -243,6 +289,35 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
92F912B22171FBAA00B883BA /* RSBarcodes */ = {
isa = PBXGroup;
children = (
92F912E42172015D00B883BA /* ContextMaker.h */,
92F912EC2172015E00B883BA /* ContextMaker.m */,
92F912ED2172015E00B883BA /* RSBarcodes-Bridging-Header.h */,
92F912E82172015D00B883BA /* RSCode39Generator.swift */,
92F912E62172015D00B883BA /* RSCode39Mod43Generator.swift */,
92F912E72172015D00B883BA /* RSCode93Generator.swift */,
92F912E22172015D00B883BA /* RSCode128Generator.swift */,
92F912EF2172015E00B883BA /* RSCodeDataMatrixGenerator.swift */,
92F912F02172015E00B883BA /* RSCodeGenerator.swift */,
92F912E12172015D00B883BA /* RSCodeLayer.swift */,
92F912F12172015E00B883BA /* RSCodeReaderViewController.swift */,
92F912E32172015D00B883BA /* RSCornersLayer.swift */,
92F912F22172015F00B883BA /* RSEANGenerator.swift */,
92F912EA2172015E00B883BA /* RSExtendedCode39Generator.swift */,
92F912EB2172015E00B883BA /* RSFocusMarkLayer.swift */,
92F912F32172015F00B883BA /* RSITF14Generator.swift */,
92F912F42172015F00B883BA /* RSITFGenerator.swift */,
92F912F52172015F00B883BA /* RSUnifiedCodeGenerator.swift */,
92F912EE2172015E00B883BA /* RSUnifiedCodeValidator.swift */,
92F912F62172015F00B883BA /* RSUPCEGenerator.swift */,
92F912E02172015D00B883BA /* StringExtension.swift */,
92F912E52172015D00B883BA /* UIColorExtension.swift */,
);
path = RSBarcodes;
sourceTree = "<group>";
};
B048377A21582C4500AFA689 /* Events */ = {
isa = PBXGroup;
children = (
......@@ -572,7 +647,10 @@
B0845922215B78AB00479D27 /* Barcode */ = {
isa = PBXGroup;
children = (
92F912B22171FBAA00B883BA /* RSBarcodes */,
B0845927215B7AF200479D27 /* AmivMicroAppBarcode.swift */,
92232A5E217144E3000780A2 /* BarcodeViewController.swift */,
92232A6421716D99000780A2 /* BarcodeViewControllerDelegate.swift */,
);
path = Barcode;
sourceTree = "<group>";
......@@ -812,6 +890,7 @@
TargetAttributes = {
B050E11B215169230090CB79 = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1000;
SystemCapabilities = {
com.apple.SafariKeychain = {
enabled = 1;
......@@ -869,11 +948,15 @@
files = (
B0FE2F1421550C4400F3D073 /* EventsViewControllerDelegate.swift in Sources */,
B0AF91422157D192008F3B80 /* KeychainKey.swift in Sources */,
92F9130A2172015F00B883BA /* RSUnifiedCodeGenerator.swift in Sources */,
B0FE2F16215514E600F3D073 /* QuickLookDataSource.swift in Sources */,
B050E17821517EF50090CB79 /* AmivMicroAppModel.swift in Sources */,
B0AF91452157D34E008F3B80 /* JobOffersResponse.swift in Sources */,
B050E16E215178BA0090CB79 /* AmivMicroAppsNavigator.swift in Sources */,
92F913022172015F00B883BA /* ContextMaker.m in Sources */,
92F913002172015F00B883BA /* RSExtendedCode39Generator.swift in Sources */,
B050E18C2151A54D0090CB79 /* SettingsCellModel.swift in Sources */,
92F913092172015F00B883BA /* RSITFGenerator.swift in Sources */,
B0E22FDF216DD754002317D6 /* AMIVApiStudyDocuments.swift in Sources */,
B07A8A0921524384003CC2D8 /* OnboardingNavigatorDelegate.swift in Sources */,
B05EC252216BFCDC00D5AD99 /* AuthenticationResponse.swift in Sources */,
......@@ -887,12 +970,14 @@
B0FE2F0221541A6300F3D073 /* EventsViewController.swift in Sources */,
B050E17D2151910F0090CB79 /* LoginViewController.swift in Sources */,
B050E171215179A30090CB79 /* AmivMicroAppsViewController.swift in Sources */,
92F912FB2172015F00B883BA /* UIColorExtension.swift in Sources */,
B050E18A2151A4A80090CB79 /* SettingsAction.swift in Sources */,
B0E22FE3216E9448002317D6 /* StudyDocument.swift in Sources */,
B0F5B955217142E3005E4591 /* AMIVMediaType.swift in Sources */,
B07A8A0421523AB8003CC2D8 /* InfoViewControllerModel.swift in Sources */,
B0AF913A2157BF11008F3B80 /* NetworkRouter.swift in Sources */,
B0AF913E2157CE2D008F3B80 /* NetworkManager.swift in Sources */,
92F9130B2172015F00B883BA /* RSUPCEGenerator.swift in Sources */,
B050E146215169D00090CB79 /* RootNavigator.swift in Sources */,
B0F5B95A2171624D005E4591 /* GenericInfoViewControllerAction.swift in Sources */,
B0AF91342157B430008F3B80 /* NetworkError.swift in Sources */,
......@@ -900,10 +985,14 @@
B0F5B9582171480B005E4591 /* JobsViewModel.swift in Sources */,
B07A8A0621523B96003CC2D8 /* InfoViewControllerDelegate.swift in Sources */,
B0E22FDC216DD41D002317D6 /* JobOffer.swift in Sources */,
92F913072172015F00B883BA /* RSEANGenerator.swift in Sources */,
B050E1872151A3C40090CB79 /* SettingsViewControllerDelegate.swift in Sources */,
B050E15021516BA60090CB79 /* OnboardingNavigator.swift in Sources */,
92F913012172015F00B883BA /* RSFocusMarkLayer.swift in Sources */,
B050E16B215177820090CB79 /* JobsNavigator.swift in Sources */,
B050E14C21516A590090CB79 /* AmivRootNavigator.swift in Sources */,
92F912F92172015F00B883BA /* RSCode128Generator.swift in Sources */,
92F912FD2172015F00B883BA /* RSCode93Generator.swift in Sources */,
B0AF913C2157C025008F3B80 /* Router.swift in Sources */,
B0E22FE1216E93EF002317D6 /* StudyDocumentResponse.swift in Sources */,
B050E15C215171F70090CB79 /* HomeNavigator.swift in Sources */,
......@@ -915,12 +1004,16 @@
B050E14E21516AFE0090CB79 /* AppNavigator.swift in Sources */,
B0F5B9512171408E005E4591 /* AMIVMedia.swift in Sources */,
B0FE2F0A2154237C00F3D073 /* GenericInfoViewControllerModel.swift in Sources */,
92F912F82172015F00B883BA /* RSCodeLayer.swift in Sources */,
B050E18121519B390090CB79 /* LoginViewControllerDelegate.swift in Sources */,
B0845924215B78C700479D27 /* AmivMicroAppCheckin.swift in Sources */,
B0F5B96F21722731005E4591 /* ETHDepartment.swift in Sources */,
B0FE2F0D21543E6600F3D073 /* ImageViewerViewController.swift in Sources */,
B050E18E2151A5660090CB79 /* SettingsCellType.swift in Sources */,
B0AF91362157B4C7008F3B80 /* URLParameterEncoder.swift in Sources */,
92F913052172015F00B883BA /* RSCodeGenerator.swift in Sources */,
92232A6521716D99000780A2 /* BarcodeViewControllerDelegate.swift in Sources */,
92F913062172015F00B883BA /* RSCodeReaderViewController.swift in Sources */,
B0FE2F0621541C5C00F3D073 /* GenericInfoViewController.swift in Sources */,
B0F5B967217217F3005E4591 /* EventsSignupResponse.swift in Sources */,
B0AF91472157D36E008F3B80 /* EventsResponse.swift in Sources */,
......@@ -934,6 +1027,7 @@
B050E1852151A3700090CB79 /* SettingsViewController.swift in Sources */,
B0FE2F102154495100F3D073 /* BlurButton.swift in Sources */,
B0FE2F1D21552AC800F3D073 /* KeychainSwiftAccessOptions.swift in Sources */,
92F912FE2172015F00B883BA /* RSCode39Generator.swift in Sources */,
B050E1902151A6000090CB79 /* SettingsModel.swift in Sources */,
B050E15621516D4D0090CB79 /* HomeViewController.swift in Sources */,
B05EC254216BFE6600D5AD99 /* AMIVApiSession.swift in Sources */,
......@@ -950,6 +1044,7 @@
B07A8A0B21524474003CC2D8 /* LoginModel.swift in Sources */,
B048377E21582D4E00AFA689 /* String+Extension.swift in Sources */,
B0AF91382157B632008F3B80 /* JSONParameterEncoder.swift in Sources */,
92232A5F217144E3000780A2 /* BarcodeViewController.swift in Sources */,
B0FE2F1F21552AF700F3D073 /* KeychainSwiftConstants.swift in Sources */,
B050E15F2151735A0090CB79 /* UIColor+Extension.swift in Sources */,
B0845928215B7AF200479D27 /* AmivMicroAppBarcode.swift in Sources */,
......@@ -958,10 +1053,12 @@
B0AF912E2157B19A008F3B80 /* HTTPMethod.swift in Sources */,
B0AF91302157B26C008F3B80 /* HTTPTask.swift in Sources */,
B07A8A022152384F003CC2D8 /* InfoItemModel.swift in Sources */,
92F912F72172015F00B883BA /* StringExtension.swift in Sources */,
B0FE2EFC2154179600F3D073 /* JobsViewController.swift in Sources */,
B050E17321517A050090CB79 /* AmivMicroAppType.swift in Sources */,
B0F5B9692172181C005E4591 /* EventSignup.swift in Sources */,
B0AF91402157CF50008F3B80 /* AMIVApiEvents.swift in Sources */,
92F913032172015F00B883BA /* RSUnifiedCodeValidator.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1115,6 +1212,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Amiv/Amiv.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 28J3L9UEGT;
......@@ -1126,6 +1224,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = ch.ethz.amiv.Amiv;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Amiv/Amiv Micro Apps/Apps/Barcode/RSBarcodes/RSBarcodes-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
......@@ -1135,6 +1235,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Amiv/Amiv.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 28J3L9UEGT;
......@@ -1146,6 +1247,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = ch.ethz.amiv.Amiv;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Amiv/Amiv Micro Apps/Apps/Barcode/RSBarcodes/RSBarcodes-Bridging-Header.h";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
......
......@@ -2,7 +2,7 @@
// AmivMicroAppBarcode.swift
// Amiv
//
// Created by Domenic Wüthrich on 26.09.18.
// Created by Denis Zuppiger on 12.10.18.
// Copyright © 2018 Amiv an der ETH. All rights reserved.
//
......@@ -16,15 +16,24 @@ public class AmivMicroAppBarcode: AmivMicroApp {
public var delegate: AmivMicroAppDelegate
public var rootViewController: UIViewController {
return barcodeController
return navigationController
}
private var barcodeController: UIViewController = UIViewController()
public var navigationController: UINavigationController = {
let nav = UINavigationController()
return nav
}()
private var barcodeController: UIViewController = {
let con = BarcodeViewController(model: AmivMicroAppModel.createBarcodeModel())
return con
}()
// MARK: - Initializers
public init(delegate: AmivMicroAppDelegate) {
self.delegate = delegate
navigationController.pushViewController(barcodeController, animated: false)
}
// MARK: - App lifetime
......
//
// BarcodeViewController.swift
// Amiv
//
// Created by Denis Zuppiger on 12.10.18.
// Copyright © 2018 Amiv an der ETH. All rights reserved.
//
import Foundation
import UIKit
import AVFoundation
public class BarcodeViewController: UIViewController {
public var delegate: BarcodeViewControllerDelegate?
public private(set) var titleLabel: UILabel!
public private(set) var barcodeLabel: UIImage!
public private(set) var barcodeLabelView: UIImageView!
public private(set) var button: UIButton!
public private(set) var textView: UITextView!
public init(model: AmivMicroAppModel){
super.init(nibName: nil, bundle: nil)
self.title = model.title
// UI
self.titleLabel = self.createTitleLabel()
self.view.addSubview(self.titleLabel)
let leftBarButton = UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.plain, target: self, action: #selector(goBack))
self.navigationItem.leftBarButtonItem = leftBarButton
self.barcodeLabel = UIImage(cgImage: self.createBarcodeLabel().cgImage! ,scale: 0.1 ,orientation: UIImage.Orientation.right)
self.barcodeLabel = RSAbstractCodeGenerator.resizeImage(self.barcodeLabel, targetSize: self.barcodeLabel.size, contentMode: .scaleToFill)
self.barcodeLabelView = UIImageView()
self.barcodeLabelView.image = self.barcodeLabel
self.barcodeLabelView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(self.barcodeLabelView)
// Layout
self.setLabelLayout()
self.setBarcodeLabelLayout()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func createTitleLabel() -> UILabel {
let label = UILabel()
label.text = "LEGI-BARCODE:"
label.textColor = .amivRed
label.numberOfLines = 2
label.textAlignment = .center
label.font = UIFont.preferredFont(forTextStyle: .largeTitle).bold()
label.translatesAutoresizingMaskIntoConstraints = false
return label
}
private func setLabelLayout(){
NSLayoutConstraint(item: self.titleLabel, attribute: .top, relatedBy: .equal, toItem: self.view, attribute: .topMargin, multiplier: 1, constant: 10).isActive = true
NSLayoutConstraint(item: self.titleLabel, attribute: .leading, relatedBy: .equal, toItem: self.view, attribute: .leadingMargin, multiplier: 1, constant: 10).isActive = true
NSLayoutConstraint(item: self.titleLabel, attribute: .trailing, relatedBy: .equal, toItem: self.view, attribute: .trailingMargin, multiplier: 1, constant: -10).isActive = true
}
private func createBarcodeLabel() -> UIImage {
let codeInput = "PLACEHOLDER"
let errorImage = UIImage(named: "xcode_error_icon")
// Code 39 Generator Library RSBarcodes
guard let barcode = RSUnifiedCodeGenerator.shared.generateCode(codeInput, machineReadableCodeObjectType: AVMetadataObject.ObjectType.code39.rawValue) else {
return errorImage!
}
return barcode
}
private func setBarcodeLabelLayout(){
NSLayoutConstraint(item: self.barcodeLabelView, attribute: .top, relatedBy: .equal, toItem: self.titleLabel, attribute: .bottom, multiplier: 1, constant: 10).isActive = true
NSLayoutConstraint(item: self.barcodeLabelView, attribute: .leading, relatedBy: .equal, toItem: self.view, attribute: .leadingMargin, multiplier: 1, constant: 10).isActive = true
NSLayoutConstraint(item: self.barcodeLabelView, attribute: .trailing, relatedBy: .equal, toItem: self.view, attribute: .trailingMargin, multiplier: 1, constant: -10).isActive = true
NSLayoutConstraint(item: self.barcodeLabelView, attribute: .bottom, relatedBy: .lessThanOrEqual, toItem: self.view, attribute: .bottomMargin, multiplier: 1, constant: -10).isActive = true
}
@objc private func goBack() {
dismiss(animated: true, completion: nil)
}
override public func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = .white
}
}
//
// BarcodeViewControllerDelegate.swift
// Amiv
//
// Created by Denis Zuppiger on 13.10.18.
// Copyright © 2018 Amiv an der ETH. All rights reserved.
//
import Foundation
public protocol BarcodeViewControllerDelegate {
func buttonTapped(_ viewController: BarcodeViewController)
}
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "ContextMaker.h"
//
// ContextMaker.h
// RSBarcodes
//
// Created by R0CKSTAR on 11/22/16.
// Copyright (c) 2016 P.D.Q. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreImage/CoreImage.h>
// http://stackoverflow.com/questions/39939415/cicontext-initwithoptions-unrecognized-selector-sent-to-instance
@interface ContextMaker : NSObject
+ (CIContext *)make;
@end
//
// ContextMaker.m
// RSBarcodes
//
// Created by R0CKSTAR on 11/22/16.
// Copyright (c) 2016 P.D.Q. All rights reserved.
//
#import "ContextMaker.h"
@implementation ContextMaker
+ (CIContext*) make
{
return [CIContext contextWithOptions:nil];
}
@end
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
//
// RSBarcodes-Bridging-Header.h
// RSBarcodes
//
// Created by Xiaodong Ye on 11/22/16.
// Copyright © 2016 P.D.Q. All rights reserved.
//
#ifndef RSBarcodes_Bridging_Header_h
#define RSBarcodes_Bridging_Header_h
#import "ContextMaker.h"
#endif /* RSBarcodes_Bridging_Header_h */
//
// RSCode128Generator.swift
// RSBarcodesSample
//
// Created by R0CKSTAR on 6/11/14.
// Copyright (c) 2014 P.D.Q. All rights reserved.
//
import UIKit
public enum RSCode128GeneratorCodeTable: Int {
case auto = 0
case a, b, c
}
// http://www.barcodeisland.com/code128.phtml
// http://courses.cs.washington.edu/courses/cse370/01au/minirproject/BarcodeBattlers/barcodes.html
open class RSCode128Generator: RSAbstractCodeGenerator, RSCheckDigitGenerator {
class RSCode128GeneratorAutoCodeTable {
var startCodeTable = RSCode128GeneratorCodeTable.auto
var sequence:Array<Int> = []
}
var codeTable: RSCode128GeneratorCodeTable
var codeTableSize: Int
var autoCodeTable: RSCode128GeneratorAutoCodeTable
public init(codeTable:RSCode128GeneratorCodeTable) {
self.codeTable = codeTable
self.codeTableSize = CODE128_CHARACTER_ENCODINGS.count
self.autoCodeTable = RSCode128GeneratorAutoCodeTable()
}
public convenience override init() {
self.init(codeTable: .auto)
}
func startCodeTableValue(_ startCodeTable: RSCode128GeneratorCodeTable) -> Int {
switch self.autoCodeTable.startCodeTable {
case .a:
return self.codeTableSize - 4
case .b:
return self.codeTableSize - 3
case .c:
return self.codeTableSize - 2
default:
switch startCodeTable {
case .a:
return self.codeTableSize - 4
case .b:
return self.codeTableSize - 3
case .c:
return self.codeTableSize - 2
default:
return 0
}
}
}
func middleCodeTableValue(_ codeTable:RSCode128GeneratorCodeTable) -> Int {
switch codeTable {
case .a:
return self.codeTableSize - 6
case .b:
return self.codeTableSize - 7
case .c:
return self.codeTableSize - 8
default:
return 0
}
}
func calculateContinousDigits(_ contents:String, defaultCodeTable:RSCode128GeneratorCodeTable, range:Range<Int>) {
var isFinished = false
if range.upperBound == contents.length() {
isFinished = true
}
let length = range.upperBound - range.lowerBound
if (range.lowerBound == 0 && length >= 4)
|| (range.lowerBound > 0 && length >= 6) {
var isOrphanDigitUsed = false
// Use START C when continous digits are found from range.location == 0
if range.lowerBound == 0 {
self.autoCodeTable.startCodeTable = .c
} else {
if length % 2 == 1 {
let digitValue = CODE128_ALPHABET_STRING.location(contents[range.lowerBound])
self.autoCodeTable.sequence.append(digitValue)
isOrphanDigitUsed = true
}
self.autoCodeTable.sequence.append(self.middleCodeTableValue(.