Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to swift 4.2 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Camera/PhotoSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UIKit
public protocol PhotoSourceControllerDelegate: class {
/// Sent to the delegate when a photo source was selected
func photoSourceController(_ controller: PhotoSourceController,
didSelectSourceType sourceType: UIImagePickerControllerSourceType)
didSelectSourceType sourceType: UIImagePickerController.SourceType)
}

/// Controller used to present a picker where the user can select a source for a photo
Expand All @@ -23,7 +23,7 @@ public final class PhotoSourceController: UIAlertController {
// MARK: - Actions

private extension PhotoSourceController {
func addAction(forSourceType sourceType: UIImagePickerControllerSourceType, title: String) {
func addAction(forSourceType sourceType: UIImagePickerController.SourceType, title: String) {
let action = UIAlertAction(title: title, style: .default) { [weak self] _ in
guard let `self` = self else {
return
Expand Down
19 changes: 16 additions & 3 deletions Sources/Image/ImageClassificationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ PhotoSourceControllerDelegate, UINavigationControllerDelegate, UIImagePickerCont
// MARK: - PhotoSourceControllerDelegate

public func photoSourceController(_ controller: PhotoSourceController,
didSelectSourceType sourceType: UIImagePickerControllerSourceType) {
didSelectSourceType sourceType: UIImagePickerController.SourceType) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.allowsEditing = true
Expand All @@ -52,8 +52,11 @@ PhotoSourceControllerDelegate, UINavigationControllerDelegate, UIImagePickerCont
// MARK: - UIImagePickerControllerDelegate

public func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : Any]) {
let editedImage = info[UIImagePickerControllerEditedImage] as? UIImage
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
// Local variable inserted by Swift 4.2 migrator.
let info = convertFromUIImagePickerControllerInfoKeyDictionary(info)

let editedImage = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.editedImage)] as? UIImage
guard let image = editedImage, let ciImage = CIImage(image: image) else {
print("Can't analyze selected photo")
return
Expand All @@ -72,3 +75,13 @@ PhotoSourceControllerDelegate, UINavigationControllerDelegate, UIImagePickerCont
}
}
}

// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromUIImagePickerControllerInfoKeyDictionary(_ input: [UIImagePickerController.InfoKey: Any]) -> [String: Any] {
return Dictionary(uniqueKeysWithValues: input.map {key, value in (key.rawValue, value)})
}

// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertFromUIImagePickerControllerInfoKey(_ input: UIImagePickerController.InfoKey) -> String {
return input.rawValue
}
2 changes: 1 addition & 1 deletion VisionLab.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "VisionLab"
s.version = "0.2.0"
s.version = "0.3.0"
s.summary = "Common sources for projects using Vision framework"
s.homepage = "https://github.com/cocoa-ml/VisionLab"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
14 changes: 10 additions & 4 deletions VisionLab.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@
D517501D1EFB3381000D98EB /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Vadym Markov";
TargetAttributes = {
D51750251EFB3381000D98EB = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1010;
};
};
};
Expand Down Expand Up @@ -207,13 +207,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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 @@ -248,6 +250,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -267,13 +270,15 @@
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_DOCUMENTATION_COMMENTS = YES;
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 All @@ -300,6 +305,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -322,7 +328,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -342,7 +348,7 @@
PRODUCT_BUNDLE_IDENTIFIER = codes.cocoaml.VisionLab;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down