updated example project
This commit is contained in:
1 parent
e2a305dcf3
commit
3d584f7b23
3 files changed
+44
-7
No files matched your search
@@ -84,11 +84,18 @@
|
||||
<viewLayoutGuide key="safeArea" id="aXm-cj-1eD"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="XgG-ZM-i9d">
|
||||
<barButtonItem key="leftBarButtonItem" title="Share" id="so2-d3-VCF">
|
||||
<connections>
|
||||
<action selector="share:" destination="0zP-ee-W0J" id="uNU-bV-PaS"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<leftBarButtonItems>
|
||||
<barButtonItem title="Share" id="so2-d3-VCF">
|
||||
<connections>
|
||||
<action selector="share:" destination="0zP-ee-W0J" id="uNU-bV-PaS"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem title="Config" id="33c-Ng-bhx">
|
||||
<connections>
|
||||
<action selector="changeConfig:" destination="0zP-ee-W0J" id="izA-qU-8it"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</leftBarButtonItems>
|
||||
<rightBarButtonItems>
|
||||
<barButtonItem title="Camera" id="Ckh-RB-Kad">
|
||||
<connections>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<true/>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
<string>To scan roundcodes</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>To save RoundCode images</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>To save RoundCode images</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>To scan roundcodes</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
@@ -64,5 +64,7 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIUserInterfaceStyle</key>
|
||||
<string>Light</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user