Skip to content

Commit

Permalink
fix all kinds of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
roddiebay committed Dec 3, 2018
1 parent 26fc015 commit f9f46c6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ force_try:
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 200

# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
function_body_length:
- 300 # warning
- 400 # error

# or they can set both explicitly
file_length:
warning: 500
warning: 600
error: 1200

# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
Expand Down
6 changes: 5 additions & 1 deletion ImagePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Hyper Interaktiv AS";
TargetAttributes = {
D5DC598A1C201BE1003BD79B = {
Expand Down Expand Up @@ -401,12 +401,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;
Expand Down Expand Up @@ -458,12 +460,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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -70,7 +69,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Source/CameraView/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate, CameraManDelegate

@objc func pinchGestureRecognizerHandler(_ gesture: UIPinchGestureRecognizer) {
switch gesture.state {
case .began:
fallthrough
case .changed:
case .began, .changed:
zoomTo(gesture.scale)
case .ended:
zoomTo(gesture.scale)
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/ConstraintsSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ extension ImagePickerController {
attribute: .top,
multiplier: 1, constant: 0))
}

if #available(iOS 11.0, *) {
let heightPadding = UIApplication.shared.keyWindow!.safeAreaInsets.bottom
view.addConstraint(NSLayoutConstraint(item: bottomContainer, attribute: .height,
Expand Down
10 changes: 7 additions & 3 deletions Source/ImageGallery/ImageGalleryViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ extension ImageGalleryView: UICollectionViewDataSource {
if (indexPath as NSIndexPath).row == 0 && self.shouldTransform {
cell.transform = CGAffineTransform(scaleX: 0, y: 0)

UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: UIView.AnimationOptions(), animations: {
cell.transform = CGAffineTransform.identity
}) { _ in }
UIView.animate(withDuration: 0.5,
delay: 0,
usingSpringWithDamping: 1,
initialSpringVelocity: 1,
options: UIView.AnimationOptions(),
animations: { cell.transform = CGAffineTransform.identity },
completion: nil)

self.shouldTransform = false
}
Expand Down
14 changes: 7 additions & 7 deletions Source/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ open class ImagePickerController: UIViewController {
self.configuration = Configuration()
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}

public required init?(coder aDecoder: NSCoder) {
self.configuration = Configuration()
super.init(coder: aDecoder)
Expand Down Expand Up @@ -162,7 +162,7 @@ open class ImagePickerController: UIViewController {
applyOrientationTransforms()

UIAccessibility.post(notification: UIAccessibility.Notification.screenChanged,
argument: bottomContainer);
argument: bottomContainer)
}

open func resetAssets() {
Expand Down Expand Up @@ -190,7 +190,7 @@ open class ImagePickerController: UIViewController {
let alertController = UIAlertController(title: configuration.requestPermissionTitle, message: configuration.requestPermissionMessage, preferredStyle: .alert)

let alertAction = UIAlertAction(title: configuration.OKButtonTitle, style: .default) { _ in
if let settingsURL = URL(string:UIApplication.openSettingsURLString) {
if let settingsURL = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.openURL(settingsURL)
}
}
Expand Down Expand Up @@ -234,7 +234,7 @@ open class ImagePickerController: UIViewController {
selector: #selector(adjustButtonTitle(_:)),
name: NSNotification.Name(rawValue: ImageStack.Notifications.imageDidDrop),
object: nil)

NotificationCenter.default.addObserver(self,
selector: #selector(dismissIfNeeded),
name: NSNotification.Name(rawValue: ImageStack.Notifications.imageDidDrop),
Expand All @@ -252,7 +252,7 @@ open class ImagePickerController: UIViewController {

NotificationCenter.default.addObserver(self,
selector: #selector(handleRotation(_:)),
name: UIDevice.orientationDidChangeNotification,// NSNotification.NameUIDevice.orientationDidChangeNotificatione,
name: UIDevice.orientationDidChangeNotification, // NSNotification.NameUIDevice.orientationDidChangeNotificatione,
object: nil)
}

Expand All @@ -276,9 +276,9 @@ open class ImagePickerController: UIViewController {
guard let sender = notification.object as? ImageStack else { return }

let title = !sender.assets.isEmpty ? configuration.doneButtonTitle : configuration.cancelButtonTitle
bottomContainer.doneButton.setTitle(title, for:UIControl.State.normal) // Add state.normal,
bottomContainer.doneButton.setTitle(title, for: UIControl.State.normal) // Add state.normal,
}

@objc func dismissIfNeeded() {
// If only one image is requested and a push occures, automatically dismiss the ImagePicker
if imageLimit == 1 {
Expand Down

0 comments on commit f9f46c6

Please sign in to comment.