Allowing the choice of the preferredStatusBarStyle #136
This commit is contained in:
parent
8c86a50599
commit
07208eb71c
|
@ -305,12 +305,12 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = "Yannick Loriot";
|
||||
TargetAttributes = {
|
||||
CE412E8819D9A1E4000F294E = {
|
||||
CreatedOnToolsVersion = 6.0.1;
|
||||
DevelopmentTeam = M8F9QH57A6;
|
||||
DevelopmentTeam = 5SJ773RP6R;
|
||||
LastSwiftMigration = 0900;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
|
@ -475,12 +475,14 @@
|
|||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
@ -528,12 +530,14 @@
|
|||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
@ -567,7 +571,7 @@
|
|||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = M8F9QH57A6;
|
||||
DEVELOPMENT_TEAM = 5SJ773RP6R;
|
||||
INFOPLIST_FILE = QRCodeReader.swift/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader;
|
||||
|
@ -582,7 +586,7 @@
|
|||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = M8F9QH57A6;
|
||||
DEVELOPMENT_TEAM = 5SJ773RP6R;
|
||||
INFOPLIST_FILE = QRCodeReader.swift/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.workandplay.qrcodereader;
|
||||
|
|
|
@ -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>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -26,7 +26,6 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
|
@ -37,7 +36,6 @@
|
|||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
|
|
@ -47,6 +47,6 @@
|
|||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -36,8 +36,9 @@ class ViewController: UIViewController, QRCodeReaderViewControllerDelegate {
|
|||
lazy var reader: QRCodeReader = QRCodeReader()
|
||||
lazy var readerVC: QRCodeReaderViewController = {
|
||||
let builder = QRCodeReaderViewControllerBuilder {
|
||||
$0.reader = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back)
|
||||
$0.showTorchButton = true
|
||||
$0.reader = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back)
|
||||
$0.showTorchButton = true
|
||||
$0.preferredStatusBarStyle = .lightContent
|
||||
|
||||
$0.reader.stopScanningWhenCodeIsFound = false
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
let showSwitchCameraButton: Bool
|
||||
let showTorchButton: Bool
|
||||
let showOverlayView: Bool
|
||||
let customPreferredStatusBarStyle: UIStatusBarStyle?
|
||||
|
||||
// MARK: - Managing the Callback Responders
|
||||
|
||||
|
@ -61,13 +62,14 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
- parameter builder: A QRCodeViewController builder object.
|
||||
*/
|
||||
required public init(builder: QRCodeReaderViewControllerBuilder) {
|
||||
readerView = builder.readerView
|
||||
startScanningAtLoad = builder.startScanningAtLoad
|
||||
codeReader = builder.reader
|
||||
showCancelButton = builder.showCancelButton
|
||||
showSwitchCameraButton = builder.showSwitchCameraButton
|
||||
showTorchButton = builder.showTorchButton
|
||||
showOverlayView = builder.showOverlayView
|
||||
readerView = builder.readerView
|
||||
startScanningAtLoad = builder.startScanningAtLoad
|
||||
codeReader = builder.reader
|
||||
showCancelButton = builder.showCancelButton
|
||||
showSwitchCameraButton = builder.showSwitchCameraButton
|
||||
showTorchButton = builder.showTorchButton
|
||||
showOverlayView = builder.showOverlayView
|
||||
customPreferredStatusBarStyle = builder.preferredStatusBarStyle
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
|
@ -95,13 +97,14 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
codeReader = QRCodeReader()
|
||||
readerView = QRCodeReaderContainer(displayable: QRCodeReaderView())
|
||||
startScanningAtLoad = false
|
||||
showCancelButton = false
|
||||
showTorchButton = false
|
||||
showSwitchCameraButton = false
|
||||
showOverlayView = false
|
||||
codeReader = QRCodeReader()
|
||||
readerView = QRCodeReaderContainer(displayable: QRCodeReaderView())
|
||||
startScanningAtLoad = false
|
||||
showCancelButton = false
|
||||
showTorchButton = false
|
||||
showSwitchCameraButton = false
|
||||
showOverlayView = false
|
||||
customPreferredStatusBarStyle = nil
|
||||
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
@ -130,6 +133,10 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
codeReader.previewLayer.frame = view.bounds
|
||||
}
|
||||
|
||||
public override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return customPreferredStatusBarStyle ?? super.preferredStatusBarStyle
|
||||
}
|
||||
|
||||
// MARK: - Initializing the AV Components
|
||||
|
||||
private func setupUIComponentsWithCancelButtonTitle(_ cancelButtonTitle: String) {
|
||||
|
@ -156,7 +163,8 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
|
||||
if #available(iOS 11.0, *) {
|
||||
view.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: readerView.view.bottomAnchor).isActive = true
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
NSLayoutConstraint(item: readerView.view, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0).isActive = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
/**
|
||||
The QRCodeViewControllerBuilder aims to create a simple configuration object for
|
||||
|
@ -84,6 +85,11 @@ public final class QRCodeReaderViewControllerBuilder {
|
|||
*/
|
||||
public var handleOrientationChange = true
|
||||
|
||||
/**
|
||||
A UIStatusBarStyle key indicating your preferred status bar style for the view controller.
|
||||
Nil by default. It means it'll use the current context status bar style.
|
||||
*/
|
||||
public var preferredStatusBarStyle: UIStatusBarStyle? = nil
|
||||
|
||||
// MARK: - Initializing a Flap View
|
||||
|
||||
|
|
Loading…
Reference in New Issue