Skip to content

Commit

Permalink
Improve the project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ymkil committed Jan 17, 2017
1 parent b69dea5 commit 61801f6
Show file tree
Hide file tree
Showing 56 changed files with 1,135 additions and 304 deletions.
20 changes: 11 additions & 9 deletions LKImagePicker.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
Pod::Spec.new do |s|
s.name = "LKImagePicker"
s.version = "0.1.2"
s.summary = "A clone of TZImagePickerController, support picking multiple photos、original photo and video"
s.homepage = "https://github.com/ymkil/LKImagePicker"
s.license = "MIT"
s.author = { "Mkil" => "[email protected]" }
s.name = 'LKImagePicker'
s.version = '1.0.0'
s.summary = 'A clone of TZImagePickerController, support picking multiple photos、original photo and video'
s.homepage = 'https://github.com/ymkil/LKImagePicker'
s.social_media_url = 'www.mkiltech.com'
s.license = 'MIT'
s.author = { 'Mkil' => '[email protected]' }
s.platform = :ios
s.ios.deployment_target = "8.0"
s.source = { :git => "https://github.com/ymkil/LKImagePicker.git", :tag => "0.1.2" }
s.ios.deployment_target = '8.0'
s.source = { :git => 'https://github.com/ymkil/LKImagePicker.git', :tag => '1.0.0' }
s.requires_arc = true
s.source_files = "LKImagePicker/LKImagePicker/*"
s.resources = "LKImagePicker/*.{png,xib,nib,bundle}"
s.source_files = 'LKImagePicker/*.swift'
end
351 changes: 223 additions & 128 deletions LKImagePicker.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E897C51D1E07AFC100F69682"
BuildableName = "LKImagePicker.app"
BlueprintIdentifier = "E82BC0DE1E2E51AC009344AB"
BuildableName = "LKImagePicker.framework"
BlueprintName = "LKImagePicker"
ReferencedContainer = "container:LKImagePicker.xcodeproj">
</BuildableReference>
Expand All @@ -28,12 +28,22 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82BC0E71E2E51AC009344AB"
BuildableName = "Tests.xctest"
BlueprintName = "Tests"
ReferencedContainer = "container:LKImagePicker.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E897C51D1E07AFC100F69682"
BuildableName = "LKImagePicker.app"
BlueprintIdentifier = "E82BC0DE1E2E51AC009344AB"
BuildableName = "LKImagePicker.framework"
BlueprintName = "LKImagePicker"
ReferencedContainer = "container:LKImagePicker.xcodeproj">
</BuildableReference>
Expand All @@ -51,16 +61,15 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E897C51D1E07AFC100F69682"
BuildableName = "LKImagePicker.app"
BlueprintIdentifier = "E82BC0DE1E2E51AC009344AB"
BuildableName = "LKImagePicker.framework"
BlueprintName = "LKImagePicker"
ReferencedContainer = "container:LKImagePicker.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand All @@ -70,16 +79,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E897C51D1E07AFC100F69682"
BuildableName = "LKImagePicker.app"
BlueprintIdentifier = "E82BC0DE1E2E51AC009344AB"
BuildableName = "LKImagePicker.framework"
BlueprintName = "LKImagePicker"
ReferencedContainer = "container:LKImagePicker.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>E897C51D1E07AFC100F69682</key>
<key>E82BC0DE1E2E51AC009344AB</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>E82BC0E71E2E51AC009344AB</key>
<dict>
<key>primary</key>
<true/>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ internal enum LKOscillatoryAnimationType {
}


@objc protocol LKImagePickerControllerDelegate: class {
@objc public protocol LKImagePickerControllerDelegate: class {

@objc optional func imagePickerControllerDidFinish(_ picker:LKImagePickerController, _ photos:[UIImage], _ assets:[Any], _ isSelectOriginalPhoto:Bool)

@objc optional func imagePickerControllerDidCancel(_ picker:LKImagePickerController)
}


internal struct ImagePickerConfig {
public struct ImagePickerConfig {

/// 默认最大可选9张图片
var maxImagesCount = 9 {
public var maxImagesCount = 9 {
didSet {
if maxImagesCount > 1 {
showSelectBtn = true
Expand All @@ -35,17 +35,17 @@ internal struct ImagePickerConfig {
}

/// 最小图片必选张数,默认是0
var minImagesCount = 0
public var minImagesCount = 0

/// 默认按修改时间升序,默认为true,如果设置为false,最新照片会显示在最前面,内部拍照按钮会排在第一个
var sortAscendingByModificationDate = true
public var sortAscendingByModificationDate = true

/// 默认为true,如果设置为false,原图按钮将隐藏
var allowPickingOriginImage = true
public var allowPickingOriginImage = true

// TODO: 暂时不支持播放视频,会尽快完善
/// 默认为true,如果设置为false,将不能选择发送视频
var allowPickingVideo = true {
public var allowPickingVideo = true {
didSet {
if !allowPickingVideo {
allowPickingImage = true
Expand All @@ -54,7 +54,7 @@ internal struct ImagePickerConfig {
}

/// 默认为true,如果设置为false,将不能选择发送图片
var allowPickingImage = true {
public var allowPickingImage = true {
didSet {
if !allowPickingImage {
allowPickingVideo = true
Expand All @@ -63,28 +63,28 @@ internal struct ImagePickerConfig {
}

/// 默认为true,如果设置为false,将不能在选择器中拍照
var allowTakePicture = true
public var allowTakePicture = true

// 默认为true,如果设置为false,预览按钮将隐藏,用户将不能取预览照片
var allowPreview = true
public var allowPreview = true

/// 默认为false,如果设置true,会自动修正图片
var shouldFixOrientation = false
public var shouldFixOrientation = false

/// 默认为true,图片展示列表自动滑动到底部
var shouldScrollToBottom = true
public var shouldScrollToBottom = true

/// 默认为true,如果设置为false,选择器将不会自动dismiss
var autoDismiss = true
public var autoDismiss = true

/// 默认828像素宽
var photoWidth: CGFloat = 828
public var photoWidth: CGFloat = 828

/// 取图片超过15秒还没有成功时,会自动dis missHUD
var timeout:Int = 15
public var timeout:Int = 15

/// collection list 一行显示的个数(2 <= columnNumber <= 6),默认为4
var columnNumber:Int = 4 {
public var columnNumber:Int = 4 {
didSet {
if columnNumber <= 2 {
columnNumber = 2
Expand All @@ -95,7 +95,7 @@ internal struct ImagePickerConfig {
}

/// 在单选模式
var showSelectBtn = true {
public var showSelectBtn = true {
didSet {
// 多选模式下,不允许showSelectBtn为false
if !showSelectBtn && maxImagesCount > 1 {
Expand All @@ -105,7 +105,7 @@ internal struct ImagePickerConfig {
}


var pushPicturePickerVc = true
public var pushPicturePickerVc = true

}

Expand Down Expand Up @@ -297,7 +297,15 @@ internal extension UIView {
internal extension UIImage {

class func imageNamedFromMyBundle(name:String) -> UIImage? {
let image = UIImage(named: "LKImagePicker.bundle/".appending(name))
var image = UIImage(named: "LKImagePicker.bundle/".appending(name))

if image == nil {
image = UIImage(named: "Frameworks/LKImagePicker.framework/LKImagePicker.bundle/".appending(name))
if image == nil {
image = UIImage(named: name)
}
}

return image
}
}
Expand All @@ -309,10 +317,11 @@ internal extension Bundle {

static var lk_imagePickerBundle:Bundle {
if lkBundle == nil {
let path = Bundle.main.path(forResource: "LKImagePicker", ofType: "bundle")
var path = Bundle.main.path(forResource: "LKImagePicker", ofType: "bundle")
if path == nil {
// TODO : 待完善
path = Bundle.main.path(forResource: "LKImagePicker", ofType: "bundle", inDirectory: "Frameworks/LKImagePicker.framework/")
}

lkBundle = Bundle(path: path!)
}
return lkBundle!
Expand Down
37 changes: 5 additions & 32 deletions LKImagePicker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -15,37 +13,12 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
18 changes: 18 additions & 0 deletions LKImagePicker/LKImagePicker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// LKImagePicker.h
// LKImagePicker
//
// Created by Mkil on 17/01/2017.
// Copyright © 2017 Mkil. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for LKImagePicker.
FOUNDATION_EXPORT double LKImagePickerVersionNumber;

//! Project version string for LKImagePicker.
FOUNDATION_EXPORT const unsigned char LKImagePickerVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <LKImagePicker/PublicHeader.h>

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Photos

public class LKImagePickerController: UINavigationController {

var imageConfig = ImagePickerConfig()
public var imageConfig = ImagePickerConfig()
var selectedModels:[LKAssetModel] = []
var didFinishPickingPhotosHandle:(([UIImage], [Any], Bool) -> Void)?
weak var pickerDelegate:LKImagePickerControllerDelegate?
Expand Down Expand Up @@ -69,7 +69,7 @@ public class LKImagePickerController: UINavigationController {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}

init(maxImagesCount: Int = 9, columnNumber: Int = 4, delegate: LKImagePickerControllerDelegate? = nil, _ pushPicturePickerVc: Bool = true, finishPickingPhotosHandle:(([UIImage], [Any], Bool) -> Void)? = nil) {
public init(maxImagesCount: Int = 9, columnNumber: Int = 4, delegate: LKImagePickerControllerDelegate? = nil, _ pushPicturePickerVc: Bool = true, finishPickingPhotosHandle:(([UIImage], [Any], Bool) -> Void)? = nil) {

let rootVC = LKAlbumPickerController()
super.init(rootViewController: rootVC)
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion LKImagePicker/en.lproj/Main.strings

This file was deleted.

Loading

0 comments on commit 61801f6

Please sign in to comment.