Skip to content

Commit

Permalink
updated to swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
abdahad1996 committed Aug 15, 2019
1 parent 883e6ce commit fcdf7a7
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 155 deletions.
133 changes: 15 additions & 118 deletions ImagePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
D5D370C31C44FD1600690C0A /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D5D370BD1C44FD1600690C0A /* [email protected] */; };
D5D370C41C44FD1600690C0A /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D5D370BE1C44FD1600690C0A /* [email protected] */; };
D5D370C51C44FD1600690C0A /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D5D370BF1C44FD1600690C0A /* [email protected] */; };
D5DC59961C201BE1003BD79B /* ImagePicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5DC598B1C201BE1003BD79B /* ImagePicker.framework */; };
D5DC59C21C201CC4003BD79B /* BottomContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59AD1C201CC4003BD79B /* BottomContainerView.swift */; };
D5DC59C31C201CC4003BD79B /* ButtonPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59AE1C201CC4003BD79B /* ButtonPicker.swift */; };
D5DC59C41C201CC4003BD79B /* ImageStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59AF1C201CC4003BD79B /* ImageStack.swift */; };
Expand All @@ -31,21 +30,10 @@
D5DC59CB1C201CC4003BD79B /* ImageGalleryViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59B91C201CC4003BD79B /* ImageGalleryViewDataSource.swift */; };
D5DC59CC1C201CC4003BD79B /* ImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59BA1C201CC4003BD79B /* ImagePickerController.swift */; };
D5DC59CE1C201CC4003BD79B /* TopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59BD1C201CC4003BD79B /* TopView.swift */; };
D5DC59CF1C201CCC003BD79B /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DC59A71C201CC4003BD79B /* Tests.swift */; };
DC197E381E945FA500F2A7D1 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = DC197E371E945FA500F2A7D1 /* [email protected] */; };
DC197E3C1E94DA5600F2A7D1 /* VideoInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC197E3B1E94DA5600F2A7D1 /* VideoInfoView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
D5DC59971C201BE1003BD79B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D5DC59821C201BE1003BD79B /* Project object */;
proxyType = 1;
remoteGlobalIDString = D5DC598A1C201BE1003BD79B;
remoteInfo = ImagePicker;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
39D1340F1CAC4B4E00EA2ECE /* AssetManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetManager.swift; sourceTree = "<group>"; };
39E3C3301CAFD79200340DAD /* LocationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationManager.swift; sourceTree = "<group>"; };
Expand All @@ -59,9 +47,6 @@
D5D370BE1C44FD1600690C0A /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D5D370BF1C44FD1600690C0A /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D5DC598B1C201BE1003BD79B /* ImagePicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ImagePicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D5DC59951C201BE1003BD79B /* ImagePicker-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ImagePicker-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
D5DC59A61C201CC4003BD79B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D5DC59A71C201CC4003BD79B /* Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
D5DC59A91C201CC4003BD79B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D5DC59AD1C201CC4003BD79B /* BottomContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomContainerView.swift; sourceTree = "<group>"; };
D5DC59AE1C201CC4003BD79B /* ButtonPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonPicker.swift; sourceTree = "<group>"; };
Expand All @@ -87,14 +72,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
D5DC59921C201BE1003BD79B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D5DC59961C201BE1003BD79B /* ImagePicker.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand All @@ -116,7 +93,6 @@
isa = PBXGroup;
children = (
D5D370B91C44FD1600690C0A /* Images */,
D5DC59A51C201CC4003BD79B /* Tests */,
D5DC59A81C201CC4003BD79B /* SupportFiles */,
D5DC59AA1C201CC4003BD79B /* Source */,
D5DC598C1C201BE1003BD79B /* Products */,
Expand All @@ -129,20 +105,10 @@
isa = PBXGroup;
children = (
D5DC598B1C201BE1003BD79B /* ImagePicker.framework */,
D5DC59951C201BE1003BD79B /* ImagePicker-iOS-Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
D5DC59A51C201CC4003BD79B /* Tests */ = {
isa = PBXGroup;
children = (
D5DC59A61C201CC4003BD79B /* Info.plist */,
D5DC59A71C201CC4003BD79B /* Tests.swift */,
);
path = Tests;
sourceTree = "<group>";
};
D5DC59A81C201CC4003BD79B /* SupportFiles */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -248,58 +214,37 @@
productReference = D5DC598B1C201BE1003BD79B /* ImagePicker.framework */;
productType = "com.apple.product-type.framework";
};
D5DC59941C201BE1003BD79B /* ImagePicker-iOS-Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = D5DC59A21C201BE1003BD79B /* Build configuration list for PBXNativeTarget "ImagePicker-iOS-Tests" */;
buildPhases = (
D5DC59911C201BE1003BD79B /* Sources */,
D5DC59921C201BE1003BD79B /* Frameworks */,
D5DC59931C201BE1003BD79B /* Resources */,
);
buildRules = (
);
dependencies = (
D5DC59981C201BE1003BD79B /* PBXTargetDependency */,
);
name = "ImagePicker-iOS-Tests";
productName = ImagePickerTests;
productReference = D5DC59951C201BE1003BD79B /* ImagePicker-iOS-Tests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
D5DC59821C201BE1003BD79B /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Hyper Interaktiv AS";
TargetAttributes = {
D5DC598A1C201BE1003BD79B = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 9J5NKKT78R;
LastSwiftMigration = 0800;
};
D5DC59941C201BE1003BD79B = {
DevelopmentTeam = QQJ8AA32HJ;
DevelopmentTeam = ADTR2923N7;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = D5DC59851C201BE1003BD79B /* Build configuration list for PBXProject "ImagePicker" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D5DC59811C201BE1003BD79B;
productRefGroup = D5DC598C1C201BE1003BD79B /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D5DC598A1C201BE1003BD79B /* ImagePicker-iOS */,
D5DC59941C201BE1003BD79B /* ImagePicker-iOS-Tests */,
);
};
/* End PBXProject section */
Expand All @@ -319,13 +264,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
D5DC59931C201BE1003BD79B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -370,29 +308,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
D5DC59911C201BE1003BD79B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D5DC59CF1C201CCC003BD79B /* Tests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
D5DC59981C201BE1003BD79B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D5DC598A1C201BE1003BD79B /* ImagePicker-iOS */;
targetProxy = D5DC59971C201BE1003BD79B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
D5DC599D1C201BE1003BD79B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -401,12 +324,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 @@ -450,6 +375,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -458,12 +384,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 @@ -502,7 +430,7 @@
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 9J5NKKT78R;
DEVELOPMENT_TEAM = ADTR2923N7;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -513,6 +441,7 @@
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePicker;
PRODUCT_NAME = ImagePicker;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -521,7 +450,7 @@
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 9J5NKKT78R;
DEVELOPMENT_TEAM = ADTR2923N7;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -532,30 +461,7 @@
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePicker;
PRODUCT_NAME = ImagePicker;
SKIP_INSTALL = YES;
};
name = Release;
};
D5DC59A31C201BE1003BD79B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = QQJ8AA32HJ;
INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePickerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
D5DC59A41C201BE1003BD79B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = QQJ8AA32HJ;
INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = no.hyper.ImagePickerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -580,15 +486,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D5DC59A21C201BE1003BD79B /* Build configuration list for PBXNativeTarget "ImagePicker-iOS-Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D5DC59A31C201BE1003BD79B /* Debug */,
D5DC59A41C201BE1003BD79B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D5DC59821C201BE1003BD79B /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
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 = "1020"
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
8 changes: 4 additions & 4 deletions Source/AssetManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Photos

open class AssetManager {

open static func getImage(_ name: String) -> UIImage {
public static func getImage(_ name: String) -> UIImage {
let traitCollection = UITraitCollection(displayScale: 3)
var bundle = Bundle(for: AssetManager.self)

Expand All @@ -15,7 +15,7 @@ open class AssetManager {
return UIImage(named: name, in: bundle, compatibleWith: traitCollection) ?? UIImage()
}

open static func fetch(withConfiguration configuration: Configuration, _ completion: @escaping (_ assets: [PHAsset]) -> Void) {
public static func fetch(withConfiguration configuration: Configuration, _ completion: @escaping (_ assets: [PHAsset]) -> Void) {
guard PHPhotoLibrary.authorizationStatus() == .authorized else { return }

DispatchQueue.global(qos: .background).async {
Expand All @@ -36,7 +36,7 @@ open class AssetManager {
}
}

open static func resolveAsset(_ asset: PHAsset, size: CGSize = CGSize(width: 720, height: 1280), shouldPreferLowRes: Bool = false, completion: @escaping (_ image: UIImage?) -> Void) {
public static func resolveAsset(_ asset: PHAsset, size: CGSize = CGSize(width: 720, height: 1280), shouldPreferLowRes: Bool = false, completion: @escaping (_ image: UIImage?) -> Void) {
let imageManager = PHImageManager.default()
let requestOptions = PHImageRequestOptions()
requestOptions.deliveryMode = shouldPreferLowRes ? .fastFormat : .highQualityFormat
Expand All @@ -51,7 +51,7 @@ open class AssetManager {
}
}

open static func resolveAssets(_ assets: [PHAsset], size: CGSize = CGSize(width: 720, height: 1280)) -> [UIImage] {
public static func resolveAssets(_ assets: [PHAsset], size: CGSize = CGSize(width: 720, height: 1280)) -> [UIImage] {
let imageManager = PHImageManager.default()
let requestOptions = PHImageRequestOptions()
requestOptions.isSynchronous = true
Expand Down
4 changes: 2 additions & 2 deletions Source/BottomView/BottomContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ open class BottomContainerView: UIView {

lazy var pickerButton: ButtonPicker = { [unowned self] in
let pickerButton = ButtonPicker(configuration: self.configuration)
pickerButton.setTitleColor(UIColor.white, for: UIControlState())
pickerButton.setTitleColor(UIColor.white, for: UIControl.State())
pickerButton.delegate = self
pickerButton.numberLabel.isHidden = !self.configuration.showsImageCountLabel

Expand All @@ -37,7 +37,7 @@ open class BottomContainerView: UIView {

open lazy var doneButton: UIButton = { [unowned self] in
let button = UIButton()
button.setTitle(self.configuration.cancelButtonTitle, for: UIControlState())
button.setTitle(self.configuration.cancelButtonTitle, for: UIControl.State())
button.titleLabel?.font = self.configuration.doneButton
button.addTarget(self, action: #selector(doneButtonDidPress(_:)), for: .touchUpInside)

Expand Down
Loading

0 comments on commit fcdf7a7

Please sign in to comment.