diff --git a/Example/.gitignore b/Example/.gitignore index 8f06b22..9b64de8 100644 --- a/Example/.gitignore +++ b/Example/.gitignore @@ -1,3 +1,4 @@ Pods/ IZExample.xcworkspace/ Podfile.lock +Carthage/ diff --git a/Example/IZExample.xcodeproj/project.pbxproj b/Example/IZExample.xcodeproj/project.pbxproj index 9c38837..bd36865 100644 --- a/Example/IZExample.xcodeproj/project.pbxproj +++ b/Example/IZExample.xcodeproj/project.pbxproj @@ -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 */ @@ -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 = ""; }; 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 = ""; }; 349A34AC1BF54EE100725CB2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -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 = ""; }; 349A34C41BF54F6500725CB2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 349C52921D1B7A970015D5CE /* Izeni.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Izeni.framework; path = Carthage/Build/iOS/Izeni.framework; sourceTree = ""; }; 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 = ""; }; 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 = ""; }; @@ -51,6 +51,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 349C52961D1B808B0015D5CE /* Izeni.framework in Frameworks */, B666C1602797144D19F83511 /* Pods_IZExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -68,7 +69,6 @@ 349A349E1BF54EE100725CB2 = { isa = PBXGroup; children = ( - 1AE8C6461C7E26C600B84C0F /* PEPhotoCropEditor.bundle */, 349A34A91BF54EE100725CB2 /* IZExample */, 349A34C11BF54F6500725CB2 /* IZExampleTests */, 349A34A81BF54EE100725CB2 /* Products */, @@ -112,6 +112,7 @@ 976E1252950C3B7AA459A609 /* Frameworks */ = { isa = PBXGroup; children = ( + 349C52921D1B7A970015D5CE /* Izeni.framework */, 72F1C8FD0C49FB7AF5D68540 /* Pods_IZExample.framework */, ); name = Frameworks; @@ -139,6 +140,8 @@ 349A34A51BF54EE100725CB2 /* Resources */, B70F54C8C65D40DCFDFBD853 /* [CP] Embed Pods Frameworks */, ADAC934E572BF3AC727253AE /* [CP] Copy Pods Resources */, + 349C52951D1B7CFE0015D5CE /* ShellScript */, + 349C52941D1B7A9F0015D5CE /* ShellScript */, ); buildRules = ( ); @@ -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; @@ -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; @@ -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"; @@ -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"; diff --git a/Izeni.podspec b/Izeni.podspec index fbcc809..577494b 100644 --- a/Izeni.podspec +++ b/Izeni.podspec @@ -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 diff --git a/PEPhotoCropEditor/PECropRectView.m b/PEPhotoCropEditor/PECropRectView.m index dea2eeb..87fd0ca 100755 --- a/PEPhotoCropEditor/PECropRectView.m +++ b/PEPhotoCropEditor/PECropRectView.m @@ -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]; diff --git a/Pod/Classes/IZImagePicker.swift b/Pod/Classes/IZImagePicker.swift index 6e35e54..7a7bbe5 100644 --- a/Pod/Classes/IZImagePicker.swift +++ b/Pod/Classes/IZImagePicker.swift @@ -9,6 +9,7 @@ import AVFoundation import Photos +import Izeni @objc public protocol IZImagePickerDelegate: class { func imagePicked(image: UIImage) @@ -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() diff --git a/Pod/Classes/Izeni.h b/Pod/Classes/Izeni.h new file mode 100644 index 0000000..e69de29