From 3d584f7b23fc807117bf3020ba1b594147bbdfad Mon Sep 17 00:00:00 2001 From: Haik Aslanyan Date: Thu, 30 Apr 2020 21:50:34 +0400 Subject: [PATCH] updated example project --- Example/Example/Base.lproj/Main.storyboard | 17 +++++++++---- Example/Example/Info.plist | 6 +++-- Example/Example/ViewController.swift | 28 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard index bbbc792..0b80a7b 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Example/Base.lproj/Main.storyboard @@ -84,11 +84,18 @@ - - - - - + + + + + + + + + + + + diff --git a/Example/Example/Info.plist b/Example/Example/Info.plist index d638a2e..9ac034c 100644 --- a/Example/Example/Info.plist +++ b/Example/Example/Info.plist @@ -22,8 +22,8 @@ NSAppleMusicUsageDescription To scan roundcodes - NSPhotoLibraryAddUsageDescription - To save RoundCode images + NSPhotoLibraryAddUsageDescription + To save RoundCode images NSCameraUsageDescription To scan roundcodes UIApplicationSceneManifest @@ -64,5 +64,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIUserInterfaceStyle + Light diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 61d7aa3..e30b150 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -36,6 +36,33 @@ class ViewController: UIViewController { extension ViewController { + @IBAction func changeConfig(_ sender: Any) { + textField.text = "" + image.message = "" + imageView.image = try? coder.encode(image) + let vc = UIAlertController(title: "Select Configuration", message: nil, preferredStyle: .actionSheet) + let uuidAction = UIAlertAction(title: "UUID", style: .default) { _ in + self.coder = RCCoder(configuration: .uuidConfiguration) + } + let numericAction = UIAlertAction(title: "Numeric", style: .default) { _ in + self.coder = RCCoder(configuration: .numericConfiguration) + } + let shortAction = UIAlertAction(title: "Short", style: .default) { _ in + self.coder = RCCoder(configuration: .shortConfiguration) + } + let defaultAction = UIAlertAction(title: "Default", style: .default) { _ in + self.coder = RCCoder(configuration: .defaultConfiguration) + } + let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) + vc.addAction(uuidAction) + vc.addAction(numericAction) + vc.addAction(shortAction) + vc.addAction(defaultAction) + vc.addAction(cancelAction) + present(vc, animated: true) + } + + @IBAction func scanImage(_ sender: Any) { isScanningFromLibrary = true let vc = UIImagePickerController() @@ -48,6 +75,7 @@ extension ViewController { @IBAction func scan(_ sender: Any) { let vc = RCCameraViewController() + vc.coder = coder vc.delegate = self present(vc, animated: true) }