Skip to content

Commit

Permalink
Monkey-patched PEPhotoCropEditor to work with both Carthage and
Browse files Browse the repository at this point in the history
Cocoapods.
  • Loading branch information
bhendersonizeni committed Jun 23, 2016
1 parent f887dd4 commit a57b292
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
1 change: 1 addition & 0 deletions Example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Pods/
IZExample.xcworkspace/
Podfile.lock
Carthage/
45 changes: 41 additions & 4 deletions Example/IZExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
1AE8C6471C7E26C600B84C0F /* PEPhotoCropEditor.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1AE8C6461C7E26C600B84C0F /* PEPhotoCropEditor.bundle */; };
349A34AB1BF54EE100725CB2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349A34AA1BF54EE100725CB2 /* AppDelegate.swift */; };
349A34AD1BF54EE100725CB2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349A34AC1BF54EE100725CB2 /* ViewController.swift */; };
349A34B01BF54EE100725CB2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 349A34AE1BF54EE100725CB2 /* Main.storyboard */; };
349A34B21BF54EE100725CB2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 349A34B11BF54EE100725CB2 /* Assets.xcassets */; };
349A34B51BF54EE100725CB2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 349A34B31BF54EE100725CB2 /* LaunchScreen.storyboard */; };
349A34C31BF54F6500725CB2 /* IZExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349A34C21BF54F6500725CB2 /* IZExampleTests.swift */; };
349C52961D1B808B0015D5CE /* Izeni.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 349C52921D1B7A970015D5CE /* Izeni.framework */; };
B666C1602797144D19F83511 /* Pods_IZExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72F1C8FD0C49FB7AF5D68540 /* Pods_IZExample.framework */; };
F3B9BFFE1CA2F8AB00114961 /* IZImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3B9BFFD1CA2F8AB00114961 /* IZImagePicker.swift */; };
/* End PBXBuildFile section */
Expand All @@ -29,7 +29,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1AE8C6461C7E26C600B84C0F /* PEPhotoCropEditor.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = PEPhotoCropEditor.bundle; path = Pods/PEPhotoCropEditor/Resources/PEPhotoCropEditor.bundle; sourceTree = "<group>"; };
349A34A71BF54EE100725CB2 /* IZExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IZExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
349A34AA1BF54EE100725CB2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
349A34AC1BF54EE100725CB2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand All @@ -40,6 +39,7 @@
349A34C01BF54F6500725CB2 /* IZExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IZExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
349A34C21BF54F6500725CB2 /* IZExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IZExampleTests.swift; sourceTree = "<group>"; };
349A34C41BF54F6500725CB2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
349C52921D1B7A970015D5CE /* Izeni.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Izeni.framework; path = Carthage/Build/iOS/Izeni.framework; sourceTree = "<group>"; };
4EFE6D07E3D322D00602C5D7 /* Pods-IZExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IZExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IZExample/Pods-IZExample.debug.xcconfig"; sourceTree = "<group>"; };
72F1C8FD0C49FB7AF5D68540 /* Pods_IZExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_IZExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D3245F8FCAE1E7255101A41A /* Pods-IZExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IZExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-IZExample/Pods-IZExample.release.xcconfig"; sourceTree = "<group>"; };
Expand All @@ -51,6 +51,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
349C52961D1B808B0015D5CE /* Izeni.framework in Frameworks */,
B666C1602797144D19F83511 /* Pods_IZExample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -68,7 +69,6 @@
349A349E1BF54EE100725CB2 = {
isa = PBXGroup;
children = (
1AE8C6461C7E26C600B84C0F /* PEPhotoCropEditor.bundle */,
349A34A91BF54EE100725CB2 /* IZExample */,
349A34C11BF54F6500725CB2 /* IZExampleTests */,
349A34A81BF54EE100725CB2 /* Products */,
Expand Down Expand Up @@ -112,6 +112,7 @@
976E1252950C3B7AA459A609 /* Frameworks */ = {
isa = PBXGroup;
children = (
349C52921D1B7A970015D5CE /* Izeni.framework */,
72F1C8FD0C49FB7AF5D68540 /* Pods_IZExample.framework */,
);
name = Frameworks;
Expand Down Expand Up @@ -139,6 +140,8 @@
349A34A51BF54EE100725CB2 /* Resources */,
B70F54C8C65D40DCFDFBD853 /* [CP] Embed Pods Frameworks */,
ADAC934E572BF3AC727253AE /* [CP] Copy Pods Resources */,
349C52951D1B7CFE0015D5CE /* ShellScript */,
349C52941D1B7A9F0015D5CE /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -213,7 +216,6 @@
files = (
349A34B51BF54EE100725CB2 /* LaunchScreen.storyboard in Resources */,
349A34B21BF54EE100725CB2 /* Assets.xcassets in Resources */,
1AE8C6471C7E26C600B84C0F /* PEPhotoCropEditor.bundle in Resources */,
349A34B01BF54EE100725CB2 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -228,6 +230,33 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
349C52941D1B7A9F0015D5CE /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/Carthage/Build/iOS/Izeni.framework",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/usr/local/bin/carthage copy-frameworks";
};
349C52951D1B7CFE0015D5CE /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#/usr/local/bin/carthage build --platform \"$PLATFORM_NAME\" --project-directory \"$SRCROOT\"";
};
ADAC934E572BF3AC727253AE /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -414,6 +443,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = IZExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -430,6 +463,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = IZExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
6 changes: 3 additions & 3 deletions Izeni.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Pod::Spec.new do |s|
s.platform = :ios, '8.0'
s.requires_arc = true

s.source_files = 'Pod/Classes/**/*'
s.source_files = ['Pod/Classes/**/*', 'PEPhotoCropEditor/*.{h,m}']
s.resource_bundles = {
'Izeni' => ['Pod/Assets/*.png', 'PEPhotoCropEditor/PEPhotoCropEditor.bundle*']
'Izeni' => ['Pod/Assets/*.png'],
'PEPhotoCropEditor' => ['PEPhotoCropEditor/PEPhotoCropEditor.bundle/**/*']
}

s.frameworks = 'UIKit', 'MapKit'
s.dependency 'PEPhotoCropEditor'
end
7 changes: 6 additions & 1 deletion PEPhotoCropEditor/PECropRectView.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ - (id)initWithFrame:(CGRect)frame

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectInset(self.bounds, -2.0f, -2.0f)];
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
imageView.image = [[UIImage imageNamed:@"PEPhotoCropEditor.bundle/PEPhotoCropEditorBorder"] resizableImageWithCapInsets:UIEdgeInsetsMake(23.0f, 23.0f, 23.0f, 23.0f)];
NSBundle *mainBundle = [NSBundle mainBundle];
NSBundle *classBundle = [NSBundle bundleForClass:[self class]];
NSString *imagePath = [[classBundle bundlePath] stringByReplacingOccurrencesOfString:[mainBundle bundlePath] withString:@""];
imagePath = [imagePath stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@""]; // Remove slash
imagePath = [imagePath stringByAppendingPathComponent:@"PEPhotoCropEditor.bundle/PEPhotoCropEditorBorder"];
imageView.image = [[UIImage imageNamed:imagePath] resizableImageWithCapInsets:UIEdgeInsetsMake(23.0f, 23.0f, 23.0f, 23.0f)];
[self addSubview:imageView];

self.topLeftCornerView = [[PEResizeControl alloc] init];
Expand Down
3 changes: 1 addition & 2 deletions Pod/Classes/IZImagePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import AVFoundation
import Photos
import Izeni

@objc public protocol IZImagePickerDelegate: class {
func imagePicked(image: UIImage)
Expand Down Expand Up @@ -52,8 +53,6 @@ public class IZImagePicker: NSObject, UIImagePickerControllerDelegate, PECropVie

// MARK: - User Allowed Functions
public func pickImage(delegate delegate: IZImagePickerDelegate, vc: UIViewController) {
assert(NSBundle.allFrameworks().map { $0.bundleURL.lastPathComponent! }.contains("PEPhotoCropEditor.framework"), "Your project does not contain the PEPhotoCropEditor bundle. Try creating a reference to it in your main project. You can do this by adding the PEPhotoCropEditor.bundle to your main project and uncheck the \"copy\" box.")

self.delegate = delegate
self.parentVC = vc
showPickerSourceAlert()
Expand Down
Empty file added Pod/Classes/Izeni.h
Empty file.

0 comments on commit a57b292

Please sign in to comment.