Skip to content

Commit

Permalink
Added XCode 12 fixes for unknown returns in switches.
Browse files Browse the repository at this point in the history
  • Loading branch information
xavisavvy committed Sep 28, 2020
1 parent d35ab90 commit 6c09618
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 18 deletions.
26 changes: 15 additions & 11 deletions ImagePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = Inloop;
TargetAttributes = {
420C23FB1F5D82C6008935D4 = {
Expand Down Expand Up @@ -538,6 +538,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -562,13 +563,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -598,6 +599,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -616,11 +618,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -632,12 +634,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = P2PP2EM79F;
INFOPLIST_FILE = ExampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.twof.ExampleApp;
PRODUCT_NAME = "Image Picker";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -648,12 +650,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = P2PP2EM79F;
INFOPLIST_FILE = ExampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.twof.ExampleApp;
PRODUCT_NAME = "Image Picker";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -670,8 +672,9 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImagePicker/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 0.8;
OTHER_SWIFT_FLAGS = "-DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = eu.inloop.ImagePicker;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -697,8 +700,9 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ImagePicker/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 0.8;
PRODUCT_BUNDLE_IDENTIFIER = eu.inloop.ImagePicker;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = 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 = "1020"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -51,8 +49,6 @@
ReferencedContainer = "container:ImagePicker.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
1 change: 1 addition & 0 deletions ImagePicker/ActionCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extension ActionCell {
bottomOffset.constant = 5
leadingOffset.constant = isFirst ? 10 : 5
trailingOffset.constant = isLast ? 10 : 5
@unknown default: break
}

}
Expand Down
2 changes: 2 additions & 0 deletions ImagePicker/CaptureSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ extension UIInterfaceOrientation {
case .portraitUpsideDown: return .portraitUpsideDown
case .landscapeRight: return .landscapeRight
case .landscapeLeft: return .landscapeLeft
@unknown default: return .portrait

}
}

Expand Down
1 change: 1 addition & 0 deletions ImagePicker/ImagePickerAssetModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ final class ImagePickerAssetModel {
guard delta > collectionView.bounds.width / 3 else {
return
}
@unknown default: return
}

// Compute the assets to start caching and to stop caching.
Expand Down
5 changes: 4 additions & 1 deletion ImagePicker/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ open class ImagePickerController : UIViewController {
collectionViewDataSource.assetsModel.fetchResult = assetsFetchResultBlock?()
collectionViewDataSource.layoutModel = LayoutModel(configuration: layoutConfiguration, assets: collectionViewDataSource.assetsModel.fetchResult.count)

case .restricted, .denied:
case .restricted, .denied, .limited:
if let view = overlayView ?? dataSource?.imagePicker(controller: self, viewForAuthorizationStatus: status), view.superview != collectionView {
collectionView.backgroundView = view
overlayView = view
Expand All @@ -288,6 +288,8 @@ open class ImagePickerController : UIViewController {
self.reloadData(basedOnAuthorizationStatus: status)
}
})
@unknown default: break

}
}

Expand Down Expand Up @@ -338,6 +340,7 @@ open class ImagePickerController : UIViewController {
switch layoutConfiguration.scrollDirection {
case .horizontal: collectionView.alwaysBounceHorizontal = true
case .vertical: collectionView.alwaysBounceVertical = true
@unknown default: break
}

if #available(iOS 11.0, *) {
Expand Down
2 changes: 2 additions & 0 deletions ImagePicker/ImagePickerLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ final class ImagePickerLayout {
itemWidth -= (CGFloat(numberOfItemsInRow) - 1) * configuration.interitemSpacing
itemWidth /= CGFloat(numberOfItemsInRow)
return CGSize(width: itemWidth, height: preferredWidthOrHeight ?? itemWidth)
@unknown default: return CGSize(width: collectionView.frame.width, height: collectionView.frame.height)
}
}

Expand Down Expand Up @@ -115,6 +116,7 @@ final class ImagePickerLayout {
switch layout.scrollDirection {
case .horizontal: return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: inset)
case .vertical: return UIEdgeInsets(top: 0, left: 0, bottom: inset, right: 0)
@unknown default: return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}
}

Expand Down
2 changes: 1 addition & 1 deletion ImagePicker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.7</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 2 additions & 0 deletions ImagePicker/Miscellaneous.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extension UIInterfaceOrientation : CustomDebugStringConvertible {
case .portraitUpsideDown: return "portrait upside down"
case .landscapeRight: return "landscape right"
case .landscapeLeft: return "landscape left"
@unknown default: return "unknown"
}
}

Expand All @@ -43,6 +44,7 @@ func differencesBetweenRects(_ old: CGRect, _ new: CGRect, _ scrollDirection: UI
switch scrollDirection {
case .horizontal: return differencesBetweenRectsHorizontal(old, new)
case .vertical: return differencesBetweenRectsVertical(old, new)
@unknown default: return differencesBetweenRects(old, new, scrollDirection)
}
}

Expand Down

0 comments on commit 6c09618

Please sign in to comment.