├── .gitignore ├── .swift-version ├── FGVideoEditor.podspec ├── FGVideoEditor.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── xgf.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── xgf.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── FGVideoEditor.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── xgf.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── FGVideoEditor ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FGVideoEditor │ ├── FGVideoCropOverlay.swift │ ├── FGVideoEditSliderView.swift │ ├── FGVideoEditTool.swift │ ├── FGVideoEditor.swift │ ├── FGVideoEditorConst.swift │ ├── FGVideoInfo.swift │ ├── FGVideoPreViewController.swift │ └── recources │ │ ├── img_play@2x.png │ │ ├── img_play@3x.png │ │ └── whiteback@2x.png ├── Info.plist └── ViewController.swift ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── FGHUD │ ├── FGHUD │ │ ├── FGHUD.swift │ │ └── FGHUDConst.swift │ ├── LICENSE │ └── README.md ├── FGToolKit │ ├── LICENSE │ ├── README.md │ └── lib │ │ ├── Date+Format.swift │ │ ├── FGWebImage.swift │ │ ├── ImageCropView.swift │ │ ├── Maker.swift │ │ ├── String+Chinese.swift │ │ ├── Timer+Block.swift │ │ ├── UIColor+Hex.swift │ │ ├── UIControl+Action.swift │ │ ├── UIImage+Arrow.swift │ │ ├── UIImage+Circle.swift │ │ ├── UITextFiled+ToolBar.swift │ │ └── UIView+Action.swift ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── xgf.xcuserdatad │ │ └── xcschemes │ │ ├── FGHUD.xcscheme │ │ ├── FGToolKit.xcscheme │ │ ├── Pods-FGVideoEditor.xcscheme │ │ ├── SnapKit.xcscheme │ │ └── xcschememanagement.plist ├── SnapKit │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── Constraint.swift │ │ ├── ConstraintAttributes.swift │ │ ├── ConstraintConfig.swift │ │ ├── ConstraintConstantTarget.swift │ │ ├── ConstraintDSL.swift │ │ ├── ConstraintDescription.swift │ │ ├── ConstraintInsetTarget.swift │ │ ├── ConstraintInsets.swift │ │ ├── ConstraintItem.swift │ │ ├── ConstraintLayoutGuide+Extensions.swift │ │ ├── ConstraintLayoutGuide.swift │ │ ├── ConstraintLayoutGuideDSL.swift │ │ ├── ConstraintLayoutSupport.swift │ │ ├── ConstraintLayoutSupportDSL.swift │ │ ├── ConstraintMaker.swift │ │ ├── ConstraintMakerEditable.swift │ │ ├── ConstraintMakerExtendable.swift │ │ ├── ConstraintMakerFinalizable.swift │ │ ├── ConstraintMakerPriortizable.swift │ │ ├── ConstraintMakerRelatable.swift │ │ ├── ConstraintMultiplierTarget.swift │ │ ├── ConstraintOffsetTarget.swift │ │ ├── ConstraintPriority.swift │ │ ├── ConstraintPriorityTarget.swift │ │ ├── ConstraintRelatableTarget.swift │ │ ├── ConstraintRelation.swift │ │ ├── ConstraintView+Extensions.swift │ │ ├── ConstraintView.swift │ │ ├── ConstraintViewDSL.swift │ │ ├── Debugging.swift │ │ ├── LayoutConstraint.swift │ │ ├── LayoutConstraintItem.swift │ │ ├── Typealiases.swift │ │ └── UILayoutSupport+Extensions.swift └── Target Support Files │ ├── FGHUD │ ├── FGHUD-dummy.m │ ├── FGHUD-prefix.pch │ ├── FGHUD-umbrella.h │ ├── FGHUD.modulemap │ ├── FGHUD.xcconfig │ └── Info.plist │ ├── FGToolKit │ ├── FGToolKit-dummy.m │ ├── FGToolKit-prefix.pch │ ├── FGToolKit-umbrella.h │ ├── FGToolKit.modulemap │ ├── FGToolKit.xcconfig │ └── Info.plist │ ├── Pods-FGVideoEditor │ ├── Info.plist │ ├── Pods-FGVideoEditor-acknowledgements.markdown │ ├── Pods-FGVideoEditor-acknowledgements.plist │ ├── Pods-FGVideoEditor-dummy.m │ ├── Pods-FGVideoEditor-frameworks.sh │ ├── Pods-FGVideoEditor-resources.sh │ ├── Pods-FGVideoEditor-umbrella.h │ ├── Pods-FGVideoEditor.debug.xcconfig │ ├── Pods-FGVideoEditor.modulemap │ └── Pods-FGVideoEditor.release.xcconfig │ └── SnapKit │ ├── Info.plist │ ├── SnapKit-dummy.m │ ├── SnapKit-prefix.pch │ ├── SnapKit-umbrella.h │ ├── SnapKit.modulemap │ └── SnapKit.xcconfig ├── README.md └── screenshoot ├── 1.PNG ├── 2.PNG ├── 3.PNG ├── 4.PNG ├── 5.PNG ├── 6.PNG ├── 7.PNG ├── 8.PNG ├── demo.gif └── title.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | *.mode1v3 6 | *.mode2v3 7 | *.perspectivev3 8 | xcuserdata 9 | *.xccheckout 10 | *.moved-aside 11 | DerivedData 12 | *.hmap 13 | *.ipa 14 | *.xcuserstate 15 | *.DS_Store 16 | # CocoaPods 17 | # 18 | # We recommend against adding the Pods directory to your .gitignore. However 19 | # you should judge for yourself, the pros and cons are mentioned at: 20 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 21 | # 22 | # Pods/ 23 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /FGVideoEditor.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "FGVideoEditor" 3 | s.version = "1.2.1" 4 | s.summary = "FGVideoEditor convience video edit toolkit" 5 | s.homepage = "https://github.com/Insfgg99x/FGVideoEditor" 6 | s.license = "MIT" 7 | s.authors = { "CGPointZero" => "newbox0512@yahoo.com" } 8 | s.source = { :git => "https://github.com/Insfgg99x/FGVideoEditor.git", :tag => "1.2.1"} 9 | s.frameworks = 'Foundation','UIKit','AVFoundation','CoreMedia','Photos' 10 | s.ios.deployment_target = '8.0' 11 | s.source_files = 'FGVideoEditor/FGVideoEditor/*.swift' 12 | s.requires_arc = true 13 | s.dependency 'SnapKit' 14 | s.dependency 'FGHUD', '2.4' 15 | s.dependency 'FGToolKit', '2.1.1' 16 | end 17 | 18 | -------------------------------------------------------------------------------- /FGVideoEditor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FGVideoEditor.xcodeproj/project.xcworkspace/xcuserdata/xgf.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/FGVideoEditor.xcodeproj/project.xcworkspace/xcuserdata/xgf.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FGVideoEditor.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FGVideoEditor.xcscheme 8 | 9 | orderHint 10 | 4 11 | 12 | FGVideoEditor.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 4 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /FGVideoEditor.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FGVideoEditor.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FGVideoEditor.xcworkspace/xcuserdata/xgf.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/FGVideoEditor.xcworkspace/xcuserdata/xgf.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FGVideoEditor.xcworkspace/xcuserdata/xgf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 18 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /FGVideoEditor/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FGVideoEditor 4 | // 5 | // Created by xgf on 2018/3/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | window?.rootViewController = UINavigationController.init(rootViewController: ViewController()) 19 | return true 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /FGVideoEditor/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /FGVideoEditor/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /FGVideoEditor/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/FGVideoEditTool.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGVideoEditTool.swift 3 | // FGVideoEditor 4 | // 5 | // Created by xgf on 2018/3/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AVFoundation 11 | import CoreMedia 12 | 13 | class FGVideoEditTool: NSObject { 14 | //MARK - get veido pixel image 15 | public class func videoInfo(_ with:URL, at:TimeInterval) -> FGVideoInfo { 16 | let info = FGVideoInfo.init() 17 | info.url = with 18 | let asset = AVAsset.init(url: with) 19 | let duration = CGFloat(CMTimeGetSeconds(asset.duration)) 20 | info.duration = duration 21 | let generator = AVAssetImageGenerator.init(asset: asset) 22 | generator.appliesPreferredTrackTransform = true 23 | generator.apertureMode = .encodedPixels 24 | var image:UIImage? = nil 25 | do { 26 | let ref = try generator.copyCGImage(at: .init(value: .init(at), timescale: 60), actualTime: nil) 27 | image = UIImage.init(cgImage: ref) 28 | info.width = image!.size.width 29 | info.height = image!.size.height 30 | } catch let e { 31 | print(e.localizedDescription) 32 | info.width = 200 33 | info.height = 100 34 | } 35 | info.image = image 36 | return info 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/FGVideoEditor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGVideoEditor.swift 3 | // SkateMoments 4 | // 5 | // Created by xia on 2018/3/26. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AVFoundation 11 | import Photos 12 | import FGHUD 13 | import CoreMedia 14 | 15 | public class FGVideoEditor: NSObject { 16 | open static let shared = FGVideoEditor.init() 17 | private var videoFolder = "" 18 | override init() { 19 | super.init() 20 | setup() 21 | } 22 | private func setup() { 23 | let docPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] 24 | videoFolder = docPath + "/FGVideo" 25 | let exist = FileManager.default.fileExists(atPath: videoFolder) 26 | if !exist { 27 | do { 28 | try FileManager.default.createDirectory(atPath: videoFolder, withIntermediateDirectories: true, attributes: nil) 29 | } catch { 30 | videoFolder = docPath 31 | } 32 | } 33 | } 34 | } 35 | //MARK: - Crop 36 | public extension FGVideoEditor { 37 | public func cropVideo(url: URL, cropRange:CMTimeRange, completion:((_ newUrl: URL, _ newDuration:CGFloat,_ result:Bool) -> ())?) { 38 | let asset = AVURLAsset.init(url: url, options: nil) 39 | let duration = CGFloat(CMTimeGetSeconds(asset.duration)) 40 | let newPath = videoFolder + "/FGVideo" + UUID.init().uuidString + ".mov" 41 | let outputUrl = URL.init(fileURLWithPath: newPath) 42 | //let presets = AVAssetExportSession.exportPresets(compatibleWith: asset) 43 | guard let exportSession = AVAssetExportSession.init(asset: asset, presetName: AVAssetExportPresetPassthrough) else { 44 | if completion != nil { 45 | completion?(outputUrl,duration,false) 46 | } 47 | return 48 | } 49 | exportSession.outputURL = outputUrl 50 | exportSession.outputFileType = .mov 51 | exportSession.shouldOptimizeForNetworkUse = true 52 | exportSession.timeRange = cropRange 53 | exportSession.exportAsynchronously { 54 | let status = exportSession.status 55 | switch status { 56 | case .failed: 57 | if completion != nil { 58 | completion?(outputUrl,duration,false) 59 | } 60 | break 61 | case .cancelled: 62 | if completion != nil { 63 | completion?(outputUrl,duration,false) 64 | } 65 | break 66 | case .completed: 67 | if completion != nil { 68 | completion?(outputUrl,duration,true) 69 | } 70 | break 71 | default: 72 | break 73 | } 74 | } 75 | } 76 | } 77 | //MARK: - Save 78 | public extension FGVideoEditor { 79 | public func save(vedio fileUrl:URL, hud:Bool) { 80 | PHPhotoLibrary.shared().performChanges({ 81 | PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: fileUrl) 82 | }, completionHandler: { (result, error) in 83 | if !hud { 84 | return 85 | } 86 | if result { 87 | UIApplication.shared.keyWindow?.showHUD(.success("保存成功")) 88 | } else { 89 | UIApplication.shared.keyWindow?.showHUD(.error("保存失败")) 90 | } 91 | }) 92 | } 93 | } 94 | //MARK: - Remove 95 | public extension FGVideoEditor { 96 | public func removeVideo(at path:String) throws { 97 | guard path.contains("FGVideo") else { 98 | return 99 | } 100 | do { 101 | try FileManager.default.removeItem(atPath: path) 102 | } catch let e{ 103 | throw e 104 | } 105 | } 106 | public func removeAll(completion:(() -> ())?) { 107 | DispatchQueue.global().async { 108 | guard let paths = FileManager.default.subpaths(atPath: self.videoFolder) else { 109 | return 110 | } 111 | for p in paths { 112 | guard p.contains("FGVideo") else { 113 | continue 114 | } 115 | let fullPath = self.videoFolder + "/" + p 116 | do { 117 | try FileManager.default.removeItem(atPath: fullPath) 118 | } catch { 119 | 120 | } 121 | } 122 | let docPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] 123 | guard let array = FileManager.default.subpaths(atPath: docPath) else { 124 | return 125 | } 126 | for p in array { 127 | guard p.contains("FGVideo") else { 128 | continue 129 | } 130 | let fullPath = docPath + "/" + p 131 | guard p.contains("FGVideo") else { 132 | continue 133 | } 134 | do { 135 | try FileManager.default.removeItem(atPath: fullPath) 136 | } catch { 137 | 138 | } 139 | } 140 | } 141 | if completion != nil { 142 | completion?() 143 | } 144 | } 145 | public func removeAll() { 146 | removeAll(completion: nil) 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/FGVideoEditorConst.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGVideoEditorConst.swift 3 | // FGVideoEditor 4 | // 5 | // Created by xgf on 2018/3/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public let minvideoduration:CGFloat = 2.0 13 | public let screenwidth = (UIScreen.main.bounds.size.width) 14 | public let screenheight = (UIScreen.main.bounds.size.height) 15 | -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/FGVideoInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGVideoInfo.swift 3 | // FGVideoEditor 4 | // 5 | // Created by xgf on 2018/3/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class FGVideoInfo: NSObject { 12 | /**第一帧的图片*/ 13 | open var image:UIImage? 14 | /**资源路径*/ 15 | open var url:URL = URL.init(fileURLWithPath: "file:///") 16 | /**视频宽度*/ 17 | open var width:CGFloat = 200 18 | /**视频高度*/ 19 | open var height:CGFloat = 100 20 | /**视频的时长*/ 21 | open var duration:CGFloat = 0.0 22 | } 23 | -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/recources/img_play@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/FGVideoEditor/FGVideoEditor/recources/img_play@2x.png -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/recources/img_play@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/FGVideoEditor/FGVideoEditor/recources/img_play@3x.png -------------------------------------------------------------------------------- /FGVideoEditor/FGVideoEditor/recources/whiteback@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/FGVideoEditor/FGVideoEditor/recources/whiteback@2x.png -------------------------------------------------------------------------------- /FGVideoEditor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | 允许使用相机? 25 | NSPhotoLibraryAddUsageDescription 26 | 允许访问相册? 27 | NSPhotoLibraryUsageDescription 28 | 允许访问相册? 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /FGVideoEditor/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // FGVideoEditor 4 | // 5 | // Created by xgf on 2018/3/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import FGToolKit 11 | import AVFoundation 12 | import SnapKit 13 | import MobileCoreServices 14 | 15 | class ViewController: UIViewController { 16 | private var pickBtn = UIButton.init() 17 | private var player :AVPlayer? 18 | private var previewLayer :AVPlayerLayer? 19 | private var cropedUrl:URL? 20 | 21 | override func viewWillAppear(_ animated: Bool) { 22 | super.viewWillAppear(true) 23 | navigationController?.isNavigationBarHidden = true 24 | } 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | setup() 28 | createUI() 29 | } 30 | deinit { 31 | NotificationCenter.default.removeObserver(self) 32 | } 33 | } 34 | extension ViewController { 35 | private func setup() { 36 | view.backgroundColor = .white 37 | title = "FGVideoEditor Demo" 38 | NotificationCenter.default.addObserver(self, selector: #selector(didPlayToEnd), name: .AVPlayerItemDidPlayToEndTime, object: nil) 39 | NotificationCenter.default.addObserver(self, selector: #selector(pause), name: .UIApplicationWillResignActive, object: nil) 40 | NotificationCenter.default.addObserver(self, selector: #selector(resume), name: .UIApplicationDidBecomeActive, object: nil) 41 | } 42 | private func createUI() { 43 | weak var wkself = self 44 | pickBtn = Maker.makeBtn(title: "选取视频", 45 | textColor: .white, 46 | font: UIFont.systemFont(ofSize: 16), 47 | bgcolor: .darkGray, 48 | handler: { (sender) in 49 | guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else { 50 | return 51 | } 52 | let picker = UIImagePickerController.init() 53 | picker.sourceType = .photoLibrary 54 | picker.mediaTypes = [kUTTypeMovie as String] 55 | picker.delegate = wkself 56 | picker.allowsEditing = false 57 | wkself?.present(picker, animated: true, completion: nil) 58 | }) 59 | pickBtn.layer.cornerRadius = 2 60 | view.addSubview(pickBtn) 61 | pickBtn.snp.makeConstraints { (make) in 62 | make.center.equalToSuperview() 63 | make.size.equalTo(CGSize.init(width: 80, height: 40)) 64 | } 65 | } 66 | } 67 | extension ViewController :UIImagePickerControllerDelegate, UINavigationControllerDelegate { 68 | func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { 69 | picker.dismiss(animated: true, completion: nil) 70 | } 71 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 72 | guard let url = info[UIImagePickerControllerMediaURL] as? URL else { 73 | picker.dismiss(animated: true, completion: nil) 74 | return 75 | } 76 | crop(video: url) 77 | picker.dismiss(animated: true, completion: nil) 78 | } 79 | } 80 | //MARK: - 裁剪视频 81 | extension ViewController { 82 | private func crop(video url:URL) { 83 | weak var wkself = self 84 | let preview = FGVideoPreViewController.init(maxDuration: 10, vedio: url) { (edit, info, result) in 85 | wkself?.navigationController?.popViewController(animated: true) 86 | guard result, let cropedInfo = info else { 87 | wkself?.showHUD(.error("裁剪失败")) 88 | return 89 | } 90 | wkself?.cropedUrl = cropedInfo.url 91 | wkself?.playCropedVideo() 92 | } 93 | navigationController?.pushViewController(preview, animated: true) 94 | } 95 | } 96 | //MARK: - 播放裁剪后的视频 97 | extension ViewController { 98 | private func playCropedVideo() { 99 | guard let url = cropedUrl else { 100 | return 101 | } 102 | pickBtn.isHidden = true 103 | 104 | player = AVPlayer.init(url: url) 105 | previewLayer = AVPlayerLayer.init(player: player) 106 | previewLayer?.backgroundColor = UIColor.clear.cgColor 107 | previewLayer?.videoGravity = .resizeAspect 108 | previewLayer?.frame = view.bounds 109 | 110 | view.layer.insertSublayer(previewLayer!, at: 0) 111 | player?.play() 112 | } 113 | } 114 | extension ViewController { 115 | @objc private func didPlayToEnd() { 116 | player?.seek(to: kCMTimeZero) 117 | player?.play() 118 | } 119 | @objc private func pause() { 120 | player?.pause() 121 | } 122 | @objc private func resume() { 123 | player?.play() 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CGPointZero 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | 2 | # platform :ios, '8.0' 3 | 4 | target 'FGVideoEditor' do 5 | use_frameworks! 6 | 7 | # Pods for FGVideoEditor 8 | pod "SnapKit", "~> 4.0.0" 9 | pod "FGHUD" , "~>2.4" 10 | pod "FGToolKit" , "~>2.1.1" 11 | end 12 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FGHUD (2.4): 3 | - SnapKit 4 | - FGToolKit (2.1.1): 5 | - SnapKit 6 | - SnapKit (4.0.0) 7 | 8 | DEPENDENCIES: 9 | - FGHUD (~> 2.4) 10 | - FGToolKit (~> 2.1.1) 11 | - SnapKit 12 | 13 | SPEC CHECKSUMS: 14 | FGHUD: 91228c40edb2d42e7e54b527922280f2c3bab647 15 | FGToolKit: 6c691a32feeeec636668f328cc7b7b0ebf407216 16 | SnapKit: a42d492c16e80209130a3379f73596c3454b7694 17 | 18 | PODFILE CHECKSUM: ee6cac69e62cb2e8b27881d3bef1b66c3528c58f 19 | 20 | COCOAPODS: 1.4.0 21 | -------------------------------------------------------------------------------- /Pods/FGHUD/FGHUD/FGHUDConst.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGHUDConst.swift 3 | // FGHUD 4 | // 5 | // Created by xgf on 2018/3/15. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | let FGHUDTintColor = UIColor.init(white: 0.2, alpha: 0.9) 13 | let FGHUDMaxWidth:CGFloat = 160 14 | let FGHUDMaxHeight:CGFloat = 100 15 | let FGHUDMinWidth:CGFloat = 80 16 | let FGHUDMinHeight:CGFloat = 50 17 | let FGHUDAutoDismisDuration = 1.0 18 | let FGHUDFontSize:CGFloat = 15 19 | var FGHUDKey = "FGHUDKey" 20 | -------------------------------------------------------------------------------- /Pods/FGHUD/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CGPointZero 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/FGHUD/README.md: -------------------------------------------------------------------------------- 1 | ![](/img/title.png) 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/FGHUD.svg?style=flat)](http://cocoadocs.org/docsets/FGHUD) 4 | [![License](https://img.shields.io/cocoapods/l/FGHUD.svg?style=flat)](http://cocoadocs.org/docsets/FGHUD) 5 | [![Platform](https://img.shields.io/cocoapods/p/FGHUD.svg?style=flat)](http://cocoadocs.org/docsets/FGHUD) 6 | ![Language](https://img.shields.io/badge/Language-%20Swift%204.0%20-blue.svg) 7 | 8 | ---------------------------------------- 9 | ### FGHUD 10 | 11 | - [x] HUD 12 | - [x] Toast 13 | - [x] Rotation support 14 | 15 | ### Feathures 16 | 17 | ![](/img/1.png) 18 | ![](/img/2.png) 19 | ![](/img/3.png) 20 | ![](/img/4.png) 21 | ![](/img/5.png) 22 | ![](/img/6.png) 23 | ![](/img/7.png) 24 | 25 | ![](/img/demo.gif) 26 | 27 | ****See Vedio Here**** 28 | [Vedio](https://pan.baidu.com/s/1mb7OGRJsU0nDDhGTanW9cg) 29 | 30 | ### Usage 31 | 32 | #### In UIViewController or subclass, UIView or subclass, you can use: 33 | 34 | ```swift 35 | showHUD() 36 | showHUD(.loading("Loading...")) 37 | showHUD(.success("Success")) 38 | showHUD(.error("Operation Error")) 39 | showHUD(.warning("watch Out!")) 40 | showHUD(.content("Hi, FGHUD")) 41 | showHUD(.toast("Hi, FGHUD")) 42 | ``` 43 | 44 | ### Hide a HUD 45 | 46 | ```swift 47 | hideHUD() 48 | ``` 49 | ****HUD with type success,error,warning,toast will auto dismiss itself**** 50 | 51 | ### Install 52 | ``` 53 | pod 'FGHUD', '~> 2.4' 54 | ``` 55 | and import 56 | ```swift 57 | import FGHUD 58 | ``` 59 | 60 | ### Style 61 | 62 | ```swift 63 | public enum HUDType { 64 | //show a hud with template 65 | case loading(String?) 66 | //show success 67 | case success(String?) 68 | //show error 69 | case error(String?) 70 | //show warn 71 | case warning(String?) 72 | //show given content 73 | case content(String?) 74 | //auto dismiss after given time(FGHUDToastDuration) 75 | case toast(String?) 76 | } 77 | ``` 78 | 79 | ### Required 80 | 81 | - [x] Xocde 9 82 | - [x] Swift 4.x 83 | -------------------------------------------------------------------------------- /Pods/FGToolKit/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CGPointZero 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/FGToolKit/README.md: -------------------------------------------------------------------------------- 1 | # FGToolKit 2 | 3 | Swift便利工具集 4 | 5 | ## Contents 6 | 7 | - [x] Timer + Block(iOS 10以下也可以直接将timer的事件回调到代码块里) 8 | - [x] UIControl + Action(按钮事件直接回调到代码块里) 9 | - [x] UIImage + Arrow(带箭头的图片有左边和右边) 10 | - [x] Date + Format(格式化的时间字符串) 11 | - [x] UIColor + Hex(16进制颜色、16进制字符串颜色) 12 | - [x] UIImage + Circle(高性能圆形图片) 13 | - [x] UIView + Action(像用UIButton一样去用UIView、UILabel等,直接将点击事件回调到代码块里) 14 | - [x] String + Chinese(汉字转拼音、判断是否有汉字、汉字的首个大写字母) 15 | - [x] FGWebImage Swift版轻量级的图片加载工具,功能类似SDWebImage,只有100多行代码 16 | - [x] ImageCropView 可以设置任意比例裁剪图片 17 | - [x] Maker 快速创建UI控件,快速生成属性字符串等,节约开发时间 18 | 19 | 后续会持续更新... 20 | 21 | 22 | ## Feture 23 | 24 | - Timer + Block 25 | ``` 26 | timer = Timer.fg_scheduledTimer(interval: 1, repeats: true, block: { (sender) in 27 | 28 | }) 29 | ``` 30 | - UIControl + Action 31 | ``` 32 | btn.handleClick(events: .touchUpInside, click: { (sender) in 33 | 34 | }) 35 | ``` 36 | - UIImage + Arrow 带尖角的图片,效果如下: 37 | 38 | ![](/imgs/arrow.png) 39 | ``` 40 | imageView1.image = image?.arrowed(.left, resizeTo: .init(width: 200, height: 100)) 41 | view.addSubview(imageView1) 42 | ``` 43 | - Date + Format 44 | ``` 45 | lb.text = Date.init(timeIntervalSinceNow: -48 * 3600).formatedTime//星期三18:14 46 | ``` 47 | - UIColor + Hex 48 | ``` 49 | lb.textColor = hexcolor(0xa115c6) 50 | lb.hex = 0xf4f4f4//设置16进制背景颜色的简写 51 | lb.textColor = UIColor.init(hex: 0x333333) 52 | ``` 53 | - UIImage + Circle 高性能圆形图片 54 | ``` 55 | imageView.image = image?.cirled() 56 | ``` 57 | - UIView + Action 像用UIButton一样去用UIView、UILabel等,直接将点击事件回调到代码块里 58 | ``` 59 | lb.addTap(handler: { (sender) in 60 | 61 | }) 62 | ``` 63 | - String + Chinese 中文转拼音 64 | ``` 65 | "你好".pinyin//nihao 66 | "你好".firstLetter//H 67 | "abc哈1x".hasChinese//true 68 | ``` 69 | - 示例(10-20个汉字的正则) 70 | ``` 71 | let reg = "[\\u4e00-\\u9fa5]{10,20}" 72 | let predicate = NSPredicate.init(format: "SELF MATCHES %@", reg) 73 | let result = predicate.evaluate(with: text) 74 | ``` 75 | 76 | - FGWebImage 77 | ```swift 78 | imageView.fg_setImageWithUrl(url, placeHolderImage) 79 | ``` 80 | 81 | - ImageCropView 82 | 83 | ```swift 84 | let cropView = ImageCropView.init(frame: UIScreen.main.bounds, image: image, mode: 3.0/1.0, hanlder: { (cropedImage) in 85 | imageView.image = cropedImage 86 | }) 87 | UIApplication.shared.keyWindow?.addSubview(cropView) 88 | ``` 89 | 90 | - Maker 91 | 92 | attribute text 93 | ```swift 94 | let op1 = [NSAttributedStringKey.font: font14, NSAttributedStringKey.foregroundColor: hexcolor(0x444444)] 95 | let op2 = [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 18), NSAttributedStringKey.foregroundColor: hexcolor(0x1db593)] 96 | let attributeText = Maker.makeAttributeText(prefix: (" 你的密码是: ", op1), mid: ("123456", op2), suffix: (" 请牢记!", op1)) 97 | ``` 98 | 99 | UI 100 | ```swift 101 | let loginBtn = Maker.makeBtn(title: "登录账号", 102 | textColor: hexcolor(0x666666), 103 | font: font14, 104 | bgcolor: nil, 105 | target: self, 106 | action: #selector(jumpLogin(_:))) 107 | view.addSubview(loginBtn) 108 | ``` 109 | 110 | ## Required 111 | 112 | - [x] Xcode 9.x 113 | - [x] Swift 4.x 114 | 115 | ## 安装 116 | - Swift Version < 4.2 117 | 118 | ``` 119 | pod repo update 120 | pod "FGToolKit", "~>2.1" 121 | ``` 122 | 123 | - Swift Version >= 4.2 124 | 125 | ``` 126 | pod repo update 127 | pod "FGToolKit", "~>2.1.1" 128 | ``` 129 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/Date+Format.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+Format.swift 3 | // Fate 4 | // 5 | // Created by xgf on 2017/11/9. 6 | // Copyright © 2017年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private let hour_seconds:TimeInterval = 3600 12 | private let year_hours:Int = 8760 13 | private let week_hours:Int = 168 14 | private let day_hours:Int = 24 15 | 16 | private var DateFormatedTimeKey = "DateFormatedTimeKey" 17 | 18 | public extension Date { 19 | var formatedTime:String? { 20 | get { 21 | var time=objc_getAssociatedObject(self, &DateFormatedTimeKey) as? String 22 | if time == nil { 23 | time=getTime() 24 | objc_setAssociatedObject(self, &DateFormatedTimeKey, time, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC) 25 | } 26 | return time 27 | } 28 | } 29 | private func getTime() -> String? { 30 | let fmt=DateFormatter.init() 31 | fmt.dateFormat="YYYY-MM-dd" 32 | let now=fmt.string(from: Date()) 33 | var components=DateComponents.init() 34 | let array=now.components(separatedBy: "-") 35 | let day = Int(array.last!) 36 | let month=Int(array[1]) 37 | let year=Int(array.first!) 38 | components.day=day 39 | components.year=year 40 | components.month=month 41 | let calendar=NSCalendar.init(calendarIdentifier: .gregorian) 42 | let today=calendar?.date(from: components)//今天 0点时间 43 | let hour = Int(self.timeIntervalSince(today!)/hour_seconds) 44 | 45 | let newFormat=DateFormatter.init() 46 | let flag=DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: Locale.current) 47 | //hasAMPM==TURE为12小时制,否则为24小时制 48 | let range:NSRange=(flag! as NSString).range(of: "a") 49 | var hasAM=false 50 | if range.location != NSNotFound { 51 | hasAM=true 52 | } 53 | if hour>year_hours || hour < -year_hours{//消息时间大于1年 54 | newFormat.dateFormat="YYYY-MM-dd HH:mm" 55 | }else if hour>week_hours || hour < -week_hours {//消息大于1周 56 | newFormat.dateFormat="MM-dd HH:mm" 57 | }else if hour>day_hours || (hour < -day_hours && hour > -week_hours) {//消息超过1天、小于1周 58 | let weekComponents=calendar?.components([.weekday], from: self) 59 | let weekRawvalue=weekComponents?.weekday 60 | let week=weekWithValue(weekRawvalue) 61 | newFormat.dateFormat=String.init(format: "%@ HH:mm", week!) 62 | }else if hour<0 && hour>day_hours {//昨天 63 | newFormat.dateFormat = "昨天HH:mm" 64 | }else{//今天 65 | if !hasAM {//24小时制 66 | newFormat.dateFormat="HH:mm" 67 | }else{//12小时制 68 | if hour > 0 && hour < 6 { 69 | newFormat.dateFormat = "凌晨hh:mm" 70 | }else if hour > 6 && hour < 12{ 71 | newFormat.dateFormat = "上午hh:mm" 72 | }else if hour > 12 && hour < 18 { 73 | newFormat.dateFormat = "下午hh:mm" 74 | }else{ 75 | newFormat.dateFormat = "晚上hh:mm" 76 | } 77 | } 78 | } 79 | let time=newFormat.string(from: self) 80 | return time 81 | } 82 | private func weekWithValue(_ weekValue:Int?) -> String! { 83 | if weekValue == nil { 84 | return "" 85 | } 86 | var week = "" 87 | switch weekValue! { 88 | case 1: 89 | week = "星期日" 90 | break 91 | case 2: 92 | week = "星期一" 93 | break 94 | case 3: 95 | week = "星期二" 96 | break 97 | case 4: 98 | week = "星期三" 99 | break 100 | case 5: 101 | week = "星期四" 102 | break 103 | case 6: 104 | week = "星期五" 105 | break 106 | case 7: 107 | week = "星期六" 108 | break 109 | default: 110 | break 111 | } 112 | return week 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/FGWebImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FGWebImage.swift 3 | // FGWebImage Demo 4 | // 5 | // Created by 风过的夏 on 16/9/12. 6 | // Copyright © 2016年 风过的夏. All rights reserved. 7 | // 8 | /* 9 | ##async image loading like `SDWebImage` with cache in memery an disk 10 | ``` 11 | fg_setImageWithUrl(url,placeHolder) 12 | ``` 13 | */ 14 | import Foundation 15 | import UIKit 16 | 17 | // 7 days max allowed in disk cache 18 | private let fg_maxCacheCycle:TimeInterval = 7*24*3600 19 | private var fg_imagUrlStringKey="fg_imagUrlStringKey" 20 | private var fg_diskCatahPathNameKey = "fg_diskCatahPathNameKey" 21 | private let fg_imageCache=NSCache() 22 | private let fg_diskCachePath=NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).last!+"/FGGAutomaticScrollViewCache" 23 | 24 | public extension UIImageView { 25 | public func clearMermeryCache() { 26 | fg_imageCache.removeAllObjects() 27 | } 28 | public func clearDiskCache() { 29 | guard let files=FileManager.default.subpaths(atPath: fg_diskCachePath) else { 30 | return 31 | } 32 | guard files.count > 0 else { 33 | return 34 | } 35 | for file in files { 36 | do { 37 | try FileManager.default.removeItem(atPath: file) 38 | } catch { 39 | 40 | } 41 | } 42 | } 43 | public func fg_setImageWithUrl(_ urlString:String?,_ placeHolder:UIImage?) { 44 | self.image = placeHolder 45 | guard let link = urlString else { 46 | return 47 | } 48 | objc_setAssociatedObject(self, &fg_imagUrlStringKey, link,.OBJC_ASSOCIATION_RETAIN_NONATOMIC) 49 | self.createLoacalCacheFolder(path: fg_diskCachePath) 50 | var cachePath=fg_diskCachePath + "/\(link.hash)" 51 | objc_setAssociatedObject(self, &fg_diskCatahPathNameKey, cachePath, .OBJC_ASSOCIATION_COPY_NONATOMIC) 52 | if link.hasPrefix("file://") {//local path 53 | cachePath = link 54 | } 55 | //check the memery chache exist or not(both local and web images) 56 | var data = fg_imageCache.object(forKey: cachePath as AnyObject) as? Data 57 | if data != nil { 58 | DispatchQueue.main.async { 59 | self.image = UIImage(data: data!) 60 | } 61 | } else {//not in memery cache,check if exist in disk or not 62 | //local images 63 | if (link.hasPrefix("file://")) { 64 | if let url = URL.init(string: link) { 65 | do{ 66 | data = try Data.init(contentsOf: url) 67 | } catch { 68 | 69 | } 70 | } 71 | //if local image exist 72 | if data != nil { 73 | fg_imageCache.setObject(data! as AnyObject, forKey: cachePath as AnyObject) 74 | DispatchQueue.main.async { 75 | self.image = UIImage(data: data!) 76 | } 77 | } 78 | else{//local image is not exist,just ingnore 79 | //ingnore 80 | } 81 | } else {//web images 82 | //check if exist in disk 83 | let exist=FileManager.default.fileExists(atPath: cachePath) 84 | if exist {//exist in disk 85 | //check if expired 86 | var attributes:Dictionary? 87 | do { 88 | try attributes=FileManager.default.attributesOfItem(atPath: cachePath) 89 | } catch { 90 | 91 | } 92 | let createDate = attributes?[FileAttributeKey.creationDate] as! Date 93 | let interval = Date.init().timeIntervalSince(createDate) 94 | let expired=(interval > fg_maxCacheCycle) 95 | if expired {//expired 96 | //download image 97 | self.donwloadDataAndRefreshImageView() 98 | } else {//not expired 99 | //load from disk 100 | if let url = URL.init(string: link) { 101 | do { 102 | data = try Data.init(contentsOf: url) 103 | } catch { 104 | 105 | } 106 | } 107 | if data != nil {//if has data 108 | //cached in memery 109 | fg_imageCache.setObject(data! as AnyObject, forKey: cachePath as AnyObject) 110 | DispatchQueue.main.async { 111 | self.image=UIImage(data: data!) 112 | } 113 | } else{//has not data 114 | //donwload 115 | self.donwloadDataAndRefreshImageView() 116 | } 117 | } 118 | } else {//not exist in disk 119 | //download image 120 | self.donwloadDataAndRefreshImageView() 121 | } 122 | } 123 | } 124 | } 125 | } 126 | private extension UIImageView { 127 | //MARK:create a cache area to cache web images 128 | private func createLoacalCacheFolder(path:String) { 129 | if !FileManager.default.fileExists(atPath: path) { 130 | do { 131 | try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) 132 | 133 | } catch { 134 | 135 | } 136 | } 137 | } 138 | } 139 | private extension UIImageView { 140 | //async download image 141 | private func donwloadDataAndRefreshImageView() { 142 | guard let link = objc_getAssociatedObject(self, &fg_imagUrlStringKey) as? String else { 143 | return 144 | } 145 | let cachePath = objc_getAssociatedObject(self, &fg_diskCatahPathNameKey) as? String 146 | if cachePath != nil { 147 | do { 148 | try FileManager.default.removeItem(atPath: cachePath!) 149 | } catch { 150 | 151 | } 152 | } 153 | //download data 154 | guard let url=URL.init(string: link) else { 155 | return 156 | } 157 | URLSession.shared.dataTask(with: url, completionHandler: { (resultData, _, _) in 158 | guard let data = resultData else { 159 | return 160 | } 161 | let fileUrl=URL.init(fileURLWithPath: cachePath!) 162 | do { 163 | try data.write(to: fileUrl, options:.atomic) 164 | } catch { 165 | 166 | } 167 | fg_imageCache.setObject(data as AnyObject, forKey: cachePath as AnyObject) 168 | DispatchQueue.main.async{ 169 | self.image=UIImage(data: data) 170 | } 171 | }).resume() 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/String+Chinese.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+Chinese.swift 3 | // FGToolKit 4 | // 5 | // Created by xgf on 2018/1/26. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public extension String { 12 | var pinyin:String? { 13 | get { 14 | let tmp = NSMutableString.init(string: self) as CFMutableString 15 | CFStringTransform(tmp, nil, kCFStringTransformMandarinLatin, false) 16 | CFStringTransform(tmp, nil, kCFStringTransformStripDiacritics, false) 17 | let ret = (tmp as String).lowercased() 18 | return ret 19 | } 20 | } 21 | var hasChinese:Bool { 22 | get { 23 | for ch in unicodeScalars { 24 | if (0x4e00 < ch.value && ch.value < 0x9fff) { 25 | return true 26 | } 27 | } 28 | return false 29 | } 30 | } 31 | var firstLetter:String? { 32 | get { 33 | guard let py = pinyin else { 34 | return nil 35 | } 36 | let index = py.index(py.startIndex, offsetBy: 1) 37 | return String(py[.. Bool { 41 | let reg = "[\\u4e00-\\u9fa5]{\(min),\(max)}" 42 | let predicate = NSPredicate.init(format: "SELF MATCHES %@", reg) 43 | let result = predicate.evaluate(with: self) 44 | return result 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/Timer+Block.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Timer+Block.swift 3 | // Fate 4 | // 5 | // Created by xgf on 2017/11/2. 6 | // Copyright © 2017年 sencent. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | private var TimerBlockActionKey = "TimerBlockActionKey" 12 | 13 | public extension Timer { 14 | //iOS 10以下的也可以用block的timer了 15 | class func fg_scheduledTimer(interval:TimeInterval,repeats:Bool, block: ((Timer) -> ())?) -> Timer { 16 | let timer=Timer.scheduledTimer(timeInterval: interval, target: self, selector: #selector(fg_timerAction(_:)), userInfo: nil, repeats: repeats) 17 | objc_setAssociatedObject(self, &TimerBlockActionKey, block, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC) 18 | return timer 19 | } 20 | @objc private class func fg_timerAction(_ sender:Timer){ 21 | let block:((_ t:Timer)->Void)?=objc_getAssociatedObject(self, &TimerBlockActionKey) as? ((Timer) -> ()) 22 | guard block != nil else { 23 | return 24 | } 25 | block!(sender) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UIColor+Hex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Hex.swift 3 | // FGToolKit 4 | // 5 | // Created by xgf on 2018/1/26. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public func hexcolor(_ hex:UInt) -> UIColor { 13 | return UIColor.init(hex: hex) 14 | } 15 | 16 | //hex value color 17 | public extension UIColor { 18 | convenience init(hex:UInt) { 19 | let b = CGFloat(hex & 0xff) / CGFloat(255.0) 20 | let g = CGFloat((hex >> 8) & 0xff) / (255.0) 21 | let r = CGFloat((hex >> 16) & 0xff) / CGFloat(255.0) 22 | let a = hex > 0xffffff ? CGFloat((hex >> 24) & 0xff) / CGFloat(255.0) : 1.0 23 | self.init(red: r, green: g, blue: b, alpha: a) 24 | } 25 | //hex string value color 26 | convenience init(hex:String) { 27 | var value = String.init(stringLiteral: hex) 28 | if hex.lowercased().hasPrefix("0x") { 29 | value = String(hex[hex.index(hex.startIndex, offsetBy: 2)...]) 30 | } 31 | var tmp:UInt32 = 0 32 | let ret = Scanner.init(string: value).scanHexInt32(&tmp) 33 | guard ret else { 34 | self.init() 35 | return 36 | } 37 | self.init(hex: UInt(tmp)) 38 | } 39 | class func hex(_ value:UInt) -> UIColor { 40 | return UIColor.init(hex: value) 41 | } 42 | class func hex(_ value:String) -> UIColor { 43 | return UIColor.init(hex: value) 44 | } 45 | } 46 | private var UIViewHexBackgroundColorKey = "UIViewHexBackgroundColorKey" 47 | public extension UIView { 48 | var hex:UInt? { 49 | get{ 50 | return objc_getAssociatedObject(self, &UIViewHexBackgroundColorKey) as? UInt 51 | }set(new){ 52 | objc_setAssociatedObject(self, &UIViewHexBackgroundColorKey, new, .OBJC_ASSOCIATION_ASSIGN) 53 | if new != nil { 54 | backgroundColor = UIColor.init(hex: new!) 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UIControl+Action.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+Action.swift 3 | // Fate 4 | // 5 | // Created by xgf on 2017/11/2. 6 | // Copyright © 2017年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | private var UIControlActionHandlerKey = "UIControlActionHandlerKey" 12 | 13 | public extension UIControl { 14 | @objc func handleClick(events:UIControl.Event,click: ((UIControl)->())?){ 15 | objc_setAssociatedObject(self, &UIControlActionHandlerKey, click, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC) 16 | self.addTarget(self, action: #selector(sc_handleClick(_:)), for: events) 17 | } 18 | @objc private func sc_handleClick(_ sender:UIControl){ 19 | let handler:((UIControl)->Void)?=objc_getAssociatedObject(self, &UIControlActionHandlerKey) as? ((UIControl)->Void) 20 | guard handler != nil else { 21 | return 22 | } 23 | handler!(sender) 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UIImage+Arrow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Arrow.swift 3 | // Fate 4 | // 5 | // Created by xgf on 2017/11/1. 6 | // Copyright © 2017年 sencent. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public enum UIImageArrowDirection { 13 | case left 14 | case right 15 | } 16 | 17 | private let arrowWidth:CGFloat=6; 18 | private let arrowHeight:CGFloat=10; 19 | private let arrowTopMargin:CGFloat=13;//距离顶部距离 20 | 21 | public extension UIImage{ 22 | func arrowed(_ direction:UIImageArrowDirection, resizeTo:CGSize) -> UIImage? { 23 | UIGraphicsBeginImageContextWithOptions(resizeTo, false, 0.0) 24 | if direction == .left { 25 | let path=UIBezierPath.init(roundedRect: CGRect(x: arrowWidth, y: 0, width: resizeTo.width-arrowWidth, height: resizeTo.height), cornerRadius: 6) 26 | path.move(to: CGPoint.init(x: arrowWidth, y: 0)) 27 | path.addLine(to: CGPoint.init(x: arrowWidth, y: arrowTopMargin)) 28 | path.addLine(to: CGPoint.init(x: 0, y: arrowTopMargin+arrowHeight*0.5)) 29 | path.addLine(to: CGPoint.init(x: arrowWidth, y: arrowTopMargin+arrowHeight)) 30 | path.addClip() 31 | path.close() 32 | let context=UIGraphicsGetCurrentContext() 33 | context?.addPath(path.cgPath) 34 | }else{ 35 | let path=UIBezierPath.init(roundedRect: CGRect(x: 0, y: 0, width: resizeTo.width-arrowWidth, height: resizeTo.height), cornerRadius: 6) 36 | path.move(to: CGPoint.init(x: resizeTo.width-arrowWidth, y: 0)) 37 | path.addLine(to: CGPoint.init(x: resizeTo.width-arrowWidth, y: arrowTopMargin)) 38 | path.addLine(to: CGPoint.init(x: resizeTo.width, y: arrowTopMargin+arrowHeight*0.5)) 39 | path.addLine(to: CGPoint.init(x: resizeTo.width-arrowWidth, y: arrowTopMargin+arrowHeight)) 40 | path.addClip() 41 | path.close() 42 | let context=UIGraphicsGetCurrentContext() 43 | context?.addPath(path.cgPath) 44 | } 45 | //CGContext.clip(context) 46 | self.draw(in: CGRect.init(x: 0, y: 0, width: resizeTo.width, height: resizeTo.height)) 47 | let image=UIGraphicsGetImageFromCurrentImageContext() 48 | UIGraphicsEndImageContext() 49 | 50 | return image 51 | } 52 | class func arrow(image:UIImage, direction:UIImageArrowDirection, resizeTo:CGSize) -> UIImage? { 53 | return image.arrowed(direction, resizeTo: resizeTo) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UIImage+Circle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Circle.swift 3 | // FGToolKit 4 | // 5 | // Created by xgf on 2018/1/26. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public extension UIImage { 13 | //MARK: - 14 | //MARK: 高性能圆形图片 15 | func cirled() -> UIImage? { 16 | UIGraphicsBeginImageContextWithOptions(self.size, false, 0) 17 | let path = UIBezierPath.init(ovalIn: .init(x: 0, y: 0, width: self.size.width, height: self.size.height)) 18 | path.addClip() 19 | self.draw(at: .zero) 20 | let image = UIGraphicsGetImageFromCurrentImageContext() 21 | UIGraphicsEndImageContext() 22 | return image 23 | } 24 | class func cirle(image named:String) -> UIImage? { 25 | return self.init(named:named)?.cirled() 26 | } 27 | class func circle(image file:String) -> UIImage? { 28 | return UIImage.init(contentsOfFile: file)?.cirled() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UITextFiled+ToolBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITextFiled+ToolBar.swift 3 | // FGToolKit 4 | // 5 | // Created by xgf on 2018/8/27. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | private func createToolBar(_ target : Any?, action : Selector) -> UIToolbar { 13 | let bar = UIToolbar.init(frame: .init(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: 40)) 14 | let space = UIBarButtonItem.init(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) 15 | let btn = UIButton.init(frame: .init(x: 0, y: 0, width: 50, height: 40)) 16 | btn.setTitle("完成", for: .normal) 17 | btn.titleLabel?.font = UIFont.systemFont(ofSize: 14) 18 | btn.setTitleColor(.black, for: .normal) 19 | btn.addTarget(target, action: action, for: .touchUpInside) 20 | let done = UIBarButtonItem.init(customView: btn) 21 | bar.items = [space, done] 22 | return bar 23 | } 24 | 25 | extension UITextField { 26 | public func enableToolBar() { 27 | let bar = createToolBar(self, action: #selector(resignKeyboardAction)) 28 | inputAccessoryView = bar 29 | } 30 | @objc private func resignKeyboardAction() { 31 | resignFirstResponder() 32 | } 33 | } 34 | 35 | extension UITextView { 36 | public func enableToolBar() { 37 | let bar = createToolBar(self, action: #selector(resignKeyboardAction)) 38 | inputAccessoryView = bar 39 | } 40 | @objc private func resignKeyboardAction() { 41 | resignFirstResponder() 42 | } 43 | } 44 | 45 | extension UISearchBar { 46 | public func enableToolBar() { 47 | let bar = createToolBar(self, action: #selector(resignKeyboardAction)) 48 | inputAccessoryView = bar 49 | } 50 | @objc private func resignKeyboardAction() { 51 | resignFirstResponder() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pods/FGToolKit/lib/UIView+Action.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Action.swift 3 | // FGToolKit 4 | // 5 | // Created by xgf on 2018/1/26. 6 | // Copyright © 2018年 xgf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | private var UIViewTapActionHandlerKey = "UIViewTapActionHandlerKey" 11 | private var UIViewLongPressActionHandlerKey = "UIViewLongPressActionHandlerKey" 12 | 13 | public extension UIView { 14 | func addTap(handler: ((UITapGestureRecognizer) -> ())?) { 15 | isUserInteractionEnabled = true 16 | objc_setAssociatedObject(self, &UIViewTapActionHandlerKey, handler, .OBJC_ASSOCIATION_COPY) 17 | let tap = UITapGestureRecognizer.init(target: self, action: #selector(fg_tapAction(_:))) 18 | addGestureRecognizer(tap) 19 | } 20 | @objc private func fg_tapAction(_ sender:UITapGestureRecognizer) { 21 | guard let handler = objc_getAssociatedObject(self, &UIViewTapActionHandlerKey) as? ((UITapGestureRecognizer) -> ()) else { 22 | return 23 | } 24 | handler(sender) 25 | } 26 | func addLongPress(handler: @escaping ((UILongPressGestureRecognizer) -> ())) { 27 | isUserInteractionEnabled = true 28 | objc_setAssociatedObject(self, &UIViewLongPressActionHandlerKey, handler, .OBJC_ASSOCIATION_COPY) 29 | let longPress = UILongPressGestureRecognizer.init(target: self, action: #selector(fg_longPressAction(_:))) 30 | addGestureRecognizer(longPress) 31 | } 32 | @objc private func fg_longPressAction(_ sender:UITapGestureRecognizer) { 33 | guard let handler = objc_getAssociatedObject(self, &UIViewLongPressActionHandlerKey) as? ((UITapGestureRecognizer) -> ()) else { 34 | return 35 | } 36 | handler(sender) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FGHUD (2.4): 3 | - SnapKit 4 | - FGToolKit (2.1.1): 5 | - SnapKit 6 | - SnapKit (4.0.0) 7 | 8 | DEPENDENCIES: 9 | - FGHUD (~> 2.4) 10 | - FGToolKit (~> 2.1.1) 11 | - SnapKit 12 | 13 | SPEC CHECKSUMS: 14 | FGHUD: 91228c40edb2d42e7e54b527922280f2c3bab647 15 | FGToolKit: 6c691a32feeeec636668f328cc7b7b0ebf407216 16 | SnapKit: a42d492c16e80209130a3379f73596c3454b7694 17 | 18 | PODFILE CHECKSUM: ee6cac69e62cb2e8b27881d3bef1b66c3528c58f 19 | 20 | COCOAPODS: 1.4.0 21 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/FGHUD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/FGToolKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/Pods-FGVideoEditor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/SnapKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/xgf.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FGHUD.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | FGToolKit.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | Pods-FGVideoEditor.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | SnapKit.xcscheme 29 | 30 | isShown 31 | 32 | orderHint 33 | 3 34 | 35 | 36 | SuppressBuildableAutocreation 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Pods/SnapKit/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/SnapKit/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. 4 | 5 | [![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit) 6 | [![Platform](https://img.shields.io/cocoapods/p/SnapKit.svg?style=flat)](https://github.com/SnapKit/SnapKit) 7 | [![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit) 8 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 9 | 10 | #### ⚠️ **To use with Swift 3.x please ensure you are using >= 3.0.0** ⚠️ 11 | #### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️ 12 | 13 | ## Contents 14 | 15 | - [Requirements](#requirements) 16 | - [Migration Guides](#migration-guides) 17 | - [Communication](#communication) 18 | - [Installation](#installation) 19 | - [Usage](#usage) 20 | - [Credits](#credits) 21 | - [License](#license) 22 | 23 | ## Requirements 24 | 25 | - iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+ 26 | - Xcode 9.0+ 27 | - Swift 3.0+ 28 | 29 | ## Communication 30 | 31 | - If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit') 32 | - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). 33 | - If you **found a bug**, open an issue. 34 | - If you **have a feature request**, open an issue. 35 | - If you **want to contribute**, submit a pull request. 36 | 37 | 38 | ## Installation 39 | 40 | ### CocoaPods 41 | 42 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: 43 | 44 | ```bash 45 | $ gem install cocoapods 46 | ``` 47 | 48 | > CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+. 49 | 50 | To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`: 51 | 52 | ```ruby 53 | source 'https://github.com/CocoaPods/Specs.git' 54 | platform :ios, '10.0' 55 | use_frameworks! 56 | 57 | target '' do 58 | pod 'SnapKit', '~> 4.0.0' 59 | end 60 | ``` 61 | 62 | Then, run the following command: 63 | 64 | ```bash 65 | $ pod install 66 | ``` 67 | 68 | ### Carthage 69 | 70 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. 71 | 72 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command: 73 | 74 | ```bash 75 | $ brew update 76 | $ brew install carthage 77 | ``` 78 | 79 | To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`: 80 | 81 | ```ogdl 82 | github "SnapKit/SnapKit" ~> 4.0.0 83 | ``` 84 | 85 | Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project. 86 | 87 | ### Manually 88 | 89 | If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually. 90 | 91 | --- 92 | 93 | ## Usage 94 | 95 | ### Quick Start 96 | 97 | ```swift 98 | import SnapKit 99 | 100 | class MyViewController: UIViewController { 101 | 102 | lazy var box = UIView() 103 | 104 | override func viewDidLoad() { 105 | super.viewDidLoad() 106 | 107 | self.view.addSubview(box) 108 | box.snp.makeConstraints { (make) -> Void in 109 | make.width.height.equalTo(50) 110 | make.center.equalTo(self.view) 111 | } 112 | } 113 | 114 | } 115 | ``` 116 | 117 | ### Resources 118 | 119 | - [Documentation](http://snapkit.io/docs/) 120 | - [F.A.Q.](http://snapkit.io/faq/) 121 | 122 | ## Credits 123 | 124 | - Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne)) 125 | - Many other contributors 126 | 127 | ## License 128 | 129 | SnapKit is released under the MIT license. See LICENSE for details. 130 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection 27 | #else 28 | import AppKit 29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection 30 | #endif 31 | 32 | 33 | public struct ConstraintConfig { 34 | 35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintConstantTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintConstantTarget { 32 | } 33 | 34 | extension CGPoint: ConstraintConstantTarget { 35 | } 36 | 37 | extension CGSize: ConstraintConstantTarget { 38 | } 39 | 40 | extension ConstraintInsets: ConstraintConstantTarget { 41 | } 42 | 43 | extension ConstraintConstantTarget { 44 | 45 | internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat { 46 | if let value = self as? CGFloat { 47 | return value 48 | } 49 | 50 | if let value = self as? Float { 51 | return CGFloat(value) 52 | } 53 | 54 | if let value = self as? Double { 55 | return CGFloat(value) 56 | } 57 | 58 | if let value = self as? Int { 59 | return CGFloat(value) 60 | } 61 | 62 | if let value = self as? UInt { 63 | return CGFloat(value) 64 | } 65 | 66 | if let value = self as? CGSize { 67 | if layoutAttribute == .width { 68 | return value.width 69 | } else if layoutAttribute == .height { 70 | return value.height 71 | } else { 72 | return 0.0 73 | } 74 | } 75 | 76 | if let value = self as? CGPoint { 77 | #if os(iOS) || os(tvOS) 78 | switch layoutAttribute { 79 | case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins: 80 | return value.x 81 | case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline: 82 | return value.y 83 | case .width, .height, .notAnAttribute: 84 | return 0.0 85 | } 86 | #else 87 | switch layoutAttribute { 88 | case .left, .right, .leading, .trailing, .centerX: 89 | return value.x 90 | case .top, .bottom, .centerY, .lastBaseline, .firstBaseline: 91 | return value.y 92 | case .width, .height, .notAnAttribute: 93 | return 0.0 94 | } 95 | #endif 96 | } 97 | 98 | if let value = self as? ConstraintInsets { 99 | #if os(iOS) || os(tvOS) 100 | switch layoutAttribute { 101 | case .left, .leftMargin, .centerX, .centerXWithinMargins: 102 | return value.left 103 | case .top, .topMargin, .centerY, .centerYWithinMargins, .lastBaseline, .firstBaseline: 104 | return value.top 105 | case .right, .rightMargin: 106 | return -value.right 107 | case .bottom, .bottomMargin: 108 | return -value.bottom 109 | case .leading, .leadingMargin: 110 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right 111 | case .trailing, .trailingMargin: 112 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left 113 | case .width: 114 | return -(value.left + value.right) 115 | case .height: 116 | return -(value.top + value.bottom) 117 | case .notAnAttribute: 118 | return 0.0 119 | } 120 | #else 121 | switch layoutAttribute { 122 | case .left, .centerX: 123 | return value.left 124 | case .top, .centerY, .lastBaseline, .firstBaseline: 125 | return value.top 126 | case .right: 127 | return -value.right 128 | case .bottom: 129 | return -value.bottom 130 | case .leading: 131 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right 132 | case .trailing: 133 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left 134 | case .width: 135 | return -(value.left + value.right) 136 | case .height: 137 | return -(value.top + value.bottom) 138 | case .notAnAttribute: 139 | return 0.0 140 | } 141 | #endif 142 | } 143 | 144 | return 0.0 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintDSL { 32 | 33 | var target: AnyObject? { get } 34 | 35 | func setLabel(_ value: String?) 36 | func label() -> String? 37 | 38 | } 39 | extension ConstraintDSL { 40 | 41 | public func setLabel(_ value: String?) { 42 | objc_setAssociatedObject(self.target as Any, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC) 43 | } 44 | public func label() -> String? { 45 | return objc_getAssociatedObject(self.target as Any, &labelKey) as? String 46 | } 47 | 48 | } 49 | private var labelKey: UInt8 = 0 50 | 51 | 52 | public protocol ConstraintBasicAttributesDSL : ConstraintDSL { 53 | } 54 | extension ConstraintBasicAttributesDSL { 55 | 56 | // MARK: Basics 57 | 58 | public var left: ConstraintItem { 59 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.left) 60 | } 61 | 62 | public var top: ConstraintItem { 63 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top) 64 | } 65 | 66 | public var right: ConstraintItem { 67 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.right) 68 | } 69 | 70 | public var bottom: ConstraintItem { 71 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom) 72 | } 73 | 74 | public var leading: ConstraintItem { 75 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leading) 76 | } 77 | 78 | public var trailing: ConstraintItem { 79 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailing) 80 | } 81 | 82 | public var width: ConstraintItem { 83 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.width) 84 | } 85 | 86 | public var height: ConstraintItem { 87 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height) 88 | } 89 | 90 | public var centerX: ConstraintItem { 91 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerX) 92 | } 93 | 94 | public var centerY: ConstraintItem { 95 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerY) 96 | } 97 | 98 | public var edges: ConstraintItem { 99 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges) 100 | } 101 | 102 | public var size: ConstraintItem { 103 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size) 104 | } 105 | 106 | public var center: ConstraintItem { 107 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center) 108 | } 109 | 110 | } 111 | 112 | public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL { 113 | } 114 | extension ConstraintAttributesDSL { 115 | 116 | // MARK: Baselines 117 | 118 | @available(*, deprecated:3.0, message:"Use .lastBaseline instead") 119 | public var baseline: ConstraintItem { 120 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline) 121 | } 122 | 123 | @available(iOS 8.0, OSX 10.11, *) 124 | public var lastBaseline: ConstraintItem { 125 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline) 126 | } 127 | 128 | @available(iOS 8.0, OSX 10.11, *) 129 | public var firstBaseline: ConstraintItem { 130 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline) 131 | } 132 | 133 | // MARK: Margins 134 | 135 | @available(iOS 8.0, *) 136 | public var leftMargin: ConstraintItem { 137 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin) 138 | } 139 | 140 | @available(iOS 8.0, *) 141 | public var topMargin: ConstraintItem { 142 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin) 143 | } 144 | 145 | @available(iOS 8.0, *) 146 | public var rightMargin: ConstraintItem { 147 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin) 148 | } 149 | 150 | @available(iOS 8.0, *) 151 | public var bottomMargin: ConstraintItem { 152 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin) 153 | } 154 | 155 | @available(iOS 8.0, *) 156 | public var leadingMargin: ConstraintItem { 157 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin) 158 | } 159 | 160 | @available(iOS 8.0, *) 161 | public var trailingMargin: ConstraintItem { 162 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin) 163 | } 164 | 165 | @available(iOS 8.0, *) 166 | public var centerXWithinMargins: ConstraintItem { 167 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins) 168 | } 169 | 170 | @available(iOS 8.0, *) 171 | public var centerYWithinMargins: ConstraintItem { 172 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins) 173 | } 174 | 175 | @available(iOS 8.0, *) 176 | public var margins: ConstraintItem { 177 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins) 178 | } 179 | 180 | @available(iOS 8.0, *) 181 | public var centerWithinMargins: ConstraintItem { 182 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins) 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintDescription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintDescription { 32 | 33 | internal let item: LayoutConstraintItem 34 | internal var attributes: ConstraintAttributes 35 | internal var relation: ConstraintRelation? = nil 36 | internal var sourceLocation: (String, UInt)? = nil 37 | internal var label: String? = nil 38 | internal var related: ConstraintItem? = nil 39 | internal var multiplier: ConstraintMultiplierTarget = 1.0 40 | internal var constant: ConstraintConstantTarget = 0.0 41 | internal var priority: ConstraintPriorityTarget = 1000.0 42 | internal lazy var constraint: Constraint? = { 43 | guard let relation = self.relation, 44 | let related = self.related, 45 | let sourceLocation = self.sourceLocation else { 46 | return nil 47 | } 48 | let from = ConstraintItem(target: self.item, attributes: self.attributes) 49 | 50 | return Constraint( 51 | from: from, 52 | to: related, 53 | relation: relation, 54 | sourceLocation: sourceLocation, 55 | label: self.label, 56 | multiplier: self.multiplier, 57 | constant: self.constant, 58 | priority: self.priority 59 | ) 60 | }() 61 | 62 | // MARK: Initialization 63 | 64 | internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) { 65 | self.item = item 66 | self.attributes = attributes 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintInsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintInsetTarget { 38 | } 39 | 40 | extension Float: ConstraintInsetTarget { 41 | } 42 | 43 | extension Double: ConstraintInsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintInsetTarget { 47 | } 48 | 49 | extension ConstraintInsets: ConstraintInsetTarget { 50 | } 51 | 52 | extension ConstraintInsetTarget { 53 | 54 | internal var constraintInsetTargetValue: ConstraintInsets { 55 | if let amount = self as? ConstraintInsets { 56 | return amount 57 | } else if let amount = self as? Float { 58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 59 | } else if let amount = self as? Double { 60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 61 | } else if let amount = self as? CGFloat { 62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount) 63 | } else if let amount = self as? Int { 64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 65 | } else if let amount = self as? UInt { 66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 67 | } else { 68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0) 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintInsets.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintInsets = UIEdgeInsets 33 | #else 34 | public typealias ConstraintInsets = NSEdgeInsets 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public final class ConstraintItem { 32 | 33 | internal weak var target: AnyObject? 34 | internal let attributes: ConstraintAttributes 35 | 36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) { 37 | self.target = target 38 | self.attributes = attributes 39 | } 40 | 41 | internal var layoutConstraintItem: LayoutConstraintItem? { 42 | return self.target as? LayoutConstraintItem 43 | } 44 | 45 | } 46 | 47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool { 48 | // pointer equality 49 | guard lhs !== rhs else { 50 | return true 51 | } 52 | 53 | // must both have valid targets and identical attributes 54 | guard let target1 = lhs.target, 55 | let target2 = rhs.target, 56 | target1 === target2 && lhs.attributes == rhs.attributes else { 57 | return false 58 | } 59 | 60 | return true 61 | } 62 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 9.0, OSX 10.11, *) 30 | public extension ConstraintLayoutGuide { 31 | 32 | public var snp: ConstraintLayoutGuideDSL { 33 | return ConstraintLayoutGuideDSL(guide: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuide.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 9.0, *) 33 | public typealias ConstraintLayoutGuide = UILayoutGuide 34 | #else 35 | @available(OSX 10.11, *) 36 | public typealias ConstraintLayoutGuide = NSLayoutGuide 37 | #endif 38 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutGuideDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 9.0, OSX 10.11, *) 32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL { 33 | 34 | @discardableResult 35 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 36 | return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure) 37 | } 38 | 39 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 40 | ConstraintMaker.makeConstraints(item: self.guide, closure: closure) 41 | } 42 | 43 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 44 | ConstraintMaker.remakeConstraints(item: self.guide, closure: closure) 45 | } 46 | 47 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 48 | ConstraintMaker.updateConstraints(item: self.guide, closure: closure) 49 | } 50 | 51 | public func removeConstraints() { 52 | ConstraintMaker.removeConstraints(item: self.guide) 53 | } 54 | 55 | public var target: AnyObject? { 56 | return self.guide 57 | } 58 | 59 | internal let guide: ConstraintLayoutGuide 60 | 61 | internal init(guide: ConstraintLayoutGuide) { 62 | self.guide = guide 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 8.0, *) 33 | public typealias ConstraintLayoutSupport = UILayoutSupport 34 | #else 35 | public class ConstraintLayoutSupport {} 36 | #endif 37 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintLayoutSupportDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 8.0, *) 32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL { 33 | 34 | public var target: AnyObject? { 35 | return self.support 36 | } 37 | 38 | internal let support: ConstraintLayoutSupport 39 | 40 | internal init(support: ConstraintLayoutSupport) { 41 | self.support = support 42 | 43 | } 44 | 45 | public var top: ConstraintItem { 46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top) 47 | } 48 | 49 | public var bottom: ConstraintItem { 50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom) 51 | } 52 | 53 | public var height: ConstraintItem { 54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerEditable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable { 32 | 33 | @discardableResult 34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 35 | self.description.multiplier = amount 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue) 42 | } 43 | 44 | @discardableResult 45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable { 46 | self.description.constant = amount.constraintOffsetTargetValue 47 | return self 48 | } 49 | 50 | @discardableResult 51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable { 52 | self.description.constant = amount.constraintInsetTargetValue 53 | return self 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerExtendable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerExtendable: ConstraintMakerRelatable { 32 | 33 | public var left: ConstraintMakerExtendable { 34 | self.description.attributes += .left 35 | return self 36 | } 37 | 38 | public var top: ConstraintMakerExtendable { 39 | self.description.attributes += .top 40 | return self 41 | } 42 | 43 | public var bottom: ConstraintMakerExtendable { 44 | self.description.attributes += .bottom 45 | return self 46 | } 47 | 48 | public var right: ConstraintMakerExtendable { 49 | self.description.attributes += .right 50 | return self 51 | } 52 | 53 | public var leading: ConstraintMakerExtendable { 54 | self.description.attributes += .leading 55 | return self 56 | } 57 | 58 | public var trailing: ConstraintMakerExtendable { 59 | self.description.attributes += .trailing 60 | return self 61 | } 62 | 63 | public var width: ConstraintMakerExtendable { 64 | self.description.attributes += .width 65 | return self 66 | } 67 | 68 | public var height: ConstraintMakerExtendable { 69 | self.description.attributes += .height 70 | return self 71 | } 72 | 73 | public var centerX: ConstraintMakerExtendable { 74 | self.description.attributes += .centerX 75 | return self 76 | } 77 | 78 | public var centerY: ConstraintMakerExtendable { 79 | self.description.attributes += .centerY 80 | return self 81 | } 82 | 83 | @available(*, deprecated:3.0, message:"Use lastBaseline instead") 84 | public var baseline: ConstraintMakerExtendable { 85 | self.description.attributes += .lastBaseline 86 | return self 87 | } 88 | 89 | public var lastBaseline: ConstraintMakerExtendable { 90 | self.description.attributes += .lastBaseline 91 | return self 92 | } 93 | 94 | @available(iOS 8.0, OSX 10.11, *) 95 | public var firstBaseline: ConstraintMakerExtendable { 96 | self.description.attributes += .firstBaseline 97 | return self 98 | } 99 | 100 | @available(iOS 8.0, *) 101 | public var leftMargin: ConstraintMakerExtendable { 102 | self.description.attributes += .leftMargin 103 | return self 104 | } 105 | 106 | @available(iOS 8.0, *) 107 | public var rightMargin: ConstraintMakerExtendable { 108 | self.description.attributes += .rightMargin 109 | return self 110 | } 111 | 112 | @available(iOS 8.0, *) 113 | public var topMargin: ConstraintMakerExtendable { 114 | self.description.attributes += .topMargin 115 | return self 116 | } 117 | 118 | @available(iOS 8.0, *) 119 | public var bottomMargin: ConstraintMakerExtendable { 120 | self.description.attributes += .bottomMargin 121 | return self 122 | } 123 | 124 | @available(iOS 8.0, *) 125 | public var leadingMargin: ConstraintMakerExtendable { 126 | self.description.attributes += .leadingMargin 127 | return self 128 | } 129 | 130 | @available(iOS 8.0, *) 131 | public var trailingMargin: ConstraintMakerExtendable { 132 | self.description.attributes += .trailingMargin 133 | return self 134 | } 135 | 136 | @available(iOS 8.0, *) 137 | public var centerXWithinMargins: ConstraintMakerExtendable { 138 | self.description.attributes += .centerXWithinMargins 139 | return self 140 | } 141 | 142 | @available(iOS 8.0, *) 143 | public var centerYWithinMargins: ConstraintMakerExtendable { 144 | self.description.attributes += .centerYWithinMargins 145 | return self 146 | } 147 | 148 | public var edges: ConstraintMakerExtendable { 149 | self.description.attributes += .edges 150 | return self 151 | } 152 | public var size: ConstraintMakerExtendable { 153 | self.description.attributes += .size 154 | return self 155 | } 156 | 157 | @available(iOS 8.0, *) 158 | public var margins: ConstraintMakerExtendable { 159 | self.description.attributes += .margins 160 | return self 161 | } 162 | 163 | @available(iOS 8.0, *) 164 | public var centerWithinMargins: ConstraintMakerExtendable { 165 | self.description.attributes += .centerWithinMargins 166 | return self 167 | } 168 | 169 | } 170 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerFinalizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerFinalizable { 32 | 33 | internal let description: ConstraintDescription 34 | 35 | internal init(_ description: ConstraintDescription) { 36 | self.description = description 37 | } 38 | 39 | @discardableResult 40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable { 41 | self.description.label = label 42 | return self 43 | } 44 | 45 | public var constraint: Constraint { 46 | return self.description.constraint! 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerPriortizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { 32 | 33 | @discardableResult 34 | public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable { 35 | self.description.priority = amount.value 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable { 41 | self.description.priority = amount 42 | return self 43 | } 44 | 45 | @available(*, deprecated:3.0, message:"Use priority(.required) instead.") 46 | @discardableResult 47 | public func priorityRequired() -> ConstraintMakerFinalizable { 48 | return self.priority(.required) 49 | } 50 | 51 | @available(*, deprecated:3.0, message:"Use priority(.high) instead.") 52 | @discardableResult 53 | public func priorityHigh() -> ConstraintMakerFinalizable { 54 | return self.priority(.high) 55 | } 56 | 57 | @available(*, deprecated:3.0, message:"Use priority(.medium) instead.") 58 | @discardableResult 59 | public func priorityMedium() -> ConstraintMakerFinalizable { 60 | return self.priority(.medium) 61 | } 62 | 63 | @available(*, deprecated:3.0, message:"Use priority(.low) instead.") 64 | @discardableResult 65 | public func priorityLow() -> ConstraintMakerFinalizable { 66 | return self.priority(.low) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMakerRelatable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerRelatable { 32 | 33 | internal let description: ConstraintDescription 34 | 35 | internal init(_ description: ConstraintDescription) { 36 | self.description = description 37 | } 38 | 39 | internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable { 40 | let related: ConstraintItem 41 | let constant: ConstraintConstantTarget 42 | 43 | if let other = other as? ConstraintItem { 44 | guard other.attributes == ConstraintAttributes.none || 45 | other.attributes.layoutAttributes.count <= 1 || 46 | other.attributes.layoutAttributes == self.description.attributes.layoutAttributes || 47 | other.attributes == .edges && self.description.attributes == .margins || 48 | other.attributes == .margins && self.description.attributes == .edges else { 49 | fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))"); 50 | } 51 | 52 | related = other 53 | constant = 0.0 54 | } else if let other = other as? ConstraintView { 55 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none) 56 | constant = 0.0 57 | } else if let other = other as? ConstraintConstantTarget { 58 | related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none) 59 | constant = other 60 | } else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide { 61 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none) 62 | constant = 0.0 63 | } else { 64 | fatalError("Invalid constraint. (\(file), \(line))") 65 | } 66 | 67 | let editable = ConstraintMakerEditable(self.description) 68 | editable.description.sourceLocation = (file, line) 69 | editable.description.relation = relation 70 | editable.description.related = related 71 | editable.description.constant = constant 72 | return editable 73 | } 74 | 75 | @discardableResult 76 | public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { 77 | return self.relatedTo(other, relation: .equal, file: file, line: line) 78 | } 79 | 80 | @discardableResult 81 | public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { 82 | guard let other = self.description.item.superview else { 83 | fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.") 84 | } 85 | return self.relatedTo(other, relation: .equal, file: file, line: line) 86 | } 87 | 88 | @discardableResult 89 | public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { 90 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line) 91 | } 92 | 93 | @discardableResult 94 | public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { 95 | guard let other = self.description.item.superview else { 96 | fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.") 97 | } 98 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line) 99 | } 100 | 101 | @discardableResult 102 | public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { 103 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line) 104 | } 105 | 106 | @discardableResult 107 | public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { 108 | guard let other = self.description.item.superview else { 109 | fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.") 110 | } 111 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line) 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintMultiplierTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintMultiplierTarget { 32 | 33 | var constraintMultiplierTargetValue: CGFloat { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintMultiplierTarget { 38 | 39 | public var constraintMultiplierTargetValue: CGFloat { 40 | return CGFloat(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintMultiplierTarget { 46 | 47 | public var constraintMultiplierTargetValue: CGFloat { 48 | return CGFloat(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintMultiplierTarget { 54 | 55 | public var constraintMultiplierTargetValue: CGFloat { 56 | return CGFloat(self) 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintMultiplierTarget { 62 | 63 | public var constraintMultiplierTargetValue: CGFloat { 64 | return CGFloat(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintMultiplierTarget { 70 | 71 | public var constraintMultiplierTargetValue: CGFloat { 72 | return self 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintOffsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintOffsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintOffsetTarget { 38 | } 39 | 40 | extension Float: ConstraintOffsetTarget { 41 | } 42 | 43 | extension Double: ConstraintOffsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintOffsetTarget { 47 | } 48 | 49 | extension ConstraintOffsetTarget { 50 | 51 | internal var constraintOffsetTargetValue: CGFloat { 52 | let offset: CGFloat 53 | if let amount = self as? Float { 54 | offset = CGFloat(amount) 55 | } else if let amount = self as? Double { 56 | offset = CGFloat(amount) 57 | } else if let amount = self as? CGFloat { 58 | offset = CGFloat(amount) 59 | } else if let amount = self as? Int { 60 | offset = CGFloat(amount) 61 | } else if let amount = self as? UInt { 62 | offset = CGFloat(amount) 63 | } else { 64 | offset = 0.0 65 | } 66 | return offset 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriority.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable { 31 | public typealias FloatLiteralType = Float 32 | 33 | public let value: Float 34 | 35 | public init(floatLiteral value: Float) { 36 | self.value = value 37 | } 38 | 39 | public init(_ value: Float) { 40 | self.value = value 41 | } 42 | 43 | public static var required: ConstraintPriority { 44 | return 1000.0 45 | } 46 | 47 | public static var high: ConstraintPriority { 48 | return 750.0 49 | } 50 | 51 | public static var medium: ConstraintPriority { 52 | #if os(OSX) 53 | return 501.0 54 | #else 55 | return 500.0 56 | #endif 57 | 58 | } 59 | 60 | public static var low: ConstraintPriority { 61 | return 250.0 62 | } 63 | 64 | public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool { 65 | return lhs.value == rhs.value 66 | } 67 | 68 | // MARK: Strideable 69 | 70 | public func advanced(by n: FloatLiteralType) -> ConstraintPriority { 71 | return ConstraintPriority(floatLiteral: value + n) 72 | } 73 | 74 | public func distance(to other: ConstraintPriority) -> FloatLiteralType { 75 | return other.value - value 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintPriorityTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintPriorityTarget { 32 | 33 | var constraintPriorityTargetValue: Float { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintPriorityTarget { 38 | 39 | public var constraintPriorityTargetValue: Float { 40 | return Float(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintPriorityTarget { 46 | 47 | public var constraintPriorityTargetValue: Float { 48 | return Float(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintPriorityTarget { 54 | 55 | public var constraintPriorityTargetValue: Float { 56 | return self 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintPriorityTarget { 62 | 63 | public var constraintPriorityTargetValue: Float { 64 | return Float(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintPriorityTarget { 70 | 71 | public var constraintPriorityTargetValue: Float { 72 | return Float(self) 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelatableTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintRelatableTarget { 32 | } 33 | 34 | extension Int: ConstraintRelatableTarget { 35 | } 36 | 37 | extension UInt: ConstraintRelatableTarget { 38 | } 39 | 40 | extension Float: ConstraintRelatableTarget { 41 | } 42 | 43 | extension Double: ConstraintRelatableTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintRelatableTarget { 47 | } 48 | 49 | extension CGSize: ConstraintRelatableTarget { 50 | } 51 | 52 | extension CGPoint: ConstraintRelatableTarget { 53 | } 54 | 55 | extension ConstraintInsets: ConstraintRelatableTarget { 56 | } 57 | 58 | extension ConstraintItem: ConstraintRelatableTarget { 59 | } 60 | 61 | extension ConstraintView: ConstraintRelatableTarget { 62 | } 63 | 64 | @available(iOS 9.0, OSX 10.11, *) 65 | extension ConstraintLayoutGuide: ConstraintRelatableTarget { 66 | } 67 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintRelation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | internal enum ConstraintRelation : Int { 32 | case equal = 1 33 | case lessThanOrEqual 34 | case greaterThanOrEqual 35 | 36 | internal var layoutRelation: LayoutRelation { 37 | get { 38 | switch(self) { 39 | case .equal: 40 | return .equal 41 | case .lessThanOrEqual: 42 | return .lessThanOrEqual 43 | case .greaterThanOrEqual: 44 | return .greaterThanOrEqual 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintView+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public extension ConstraintView { 32 | 33 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 34 | public var snp_left: ConstraintItem { return self.snp.left } 35 | 36 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 37 | public var snp_top: ConstraintItem { return self.snp.top } 38 | 39 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 40 | public var snp_right: ConstraintItem { return self.snp.right } 41 | 42 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 43 | public var snp_bottom: ConstraintItem { return self.snp.bottom } 44 | 45 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 46 | public var snp_leading: ConstraintItem { return self.snp.leading } 47 | 48 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 49 | public var snp_trailing: ConstraintItem { return self.snp.trailing } 50 | 51 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 52 | public var snp_width: ConstraintItem { return self.snp.width } 53 | 54 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 55 | public var snp_height: ConstraintItem { return self.snp.height } 56 | 57 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 58 | public var snp_centerX: ConstraintItem { return self.snp.centerX } 59 | 60 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 61 | public var snp_centerY: ConstraintItem { return self.snp.centerY } 62 | 63 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 64 | public var snp_baseline: ConstraintItem { return self.snp.baseline } 65 | 66 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 67 | @available(iOS 8.0, OSX 10.11, *) 68 | public var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline } 69 | 70 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 71 | @available(iOS 8.0, OSX 10.11, *) 72 | public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline } 73 | 74 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 75 | @available(iOS 8.0, *) 76 | public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin } 77 | 78 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 79 | @available(iOS 8.0, *) 80 | public var snp_topMargin: ConstraintItem { return self.snp.topMargin } 81 | 82 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 83 | @available(iOS 8.0, *) 84 | public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin } 85 | 86 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 87 | @available(iOS 8.0, *) 88 | public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin } 89 | 90 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 91 | @available(iOS 8.0, *) 92 | public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin } 93 | 94 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 95 | @available(iOS 8.0, *) 96 | public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin } 97 | 98 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 99 | @available(iOS 8.0, *) 100 | public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins } 101 | 102 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 103 | @available(iOS 8.0, *) 104 | public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins } 105 | 106 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 107 | public var snp_edges: ConstraintItem { return self.snp.edges } 108 | 109 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 110 | public var snp_size: ConstraintItem { return self.snp.size } 111 | 112 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 113 | public var snp_center: ConstraintItem { return self.snp.center } 114 | 115 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 116 | @available(iOS 8.0, *) 117 | public var snp_margins: ConstraintItem { return self.snp.margins } 118 | 119 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") 120 | @available(iOS 8.0, *) 121 | public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins } 122 | 123 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 124 | public func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 125 | return self.snp.prepareConstraints(closure) 126 | } 127 | 128 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 129 | public func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 130 | self.snp.makeConstraints(closure) 131 | } 132 | 133 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 134 | public func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 135 | self.snp.remakeConstraints(closure) 136 | } 137 | 138 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 139 | public func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 140 | self.snp.updateConstraints(closure) 141 | } 142 | 143 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") 144 | public func snp_removeConstraints() { 145 | self.snp.removeConstraints() 146 | } 147 | 148 | public var snp: ConstraintViewDSL { 149 | return ConstraintViewDSL(view: self) 150 | } 151 | 152 | } 153 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintView = UIView 33 | #else 34 | public typealias ConstraintView = NSView 35 | #endif 36 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/ConstraintViewDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public struct ConstraintViewDSL: ConstraintAttributesDSL { 32 | 33 | @discardableResult 34 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 35 | return ConstraintMaker.prepareConstraints(item: self.view, closure: closure) 36 | } 37 | 38 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 39 | ConstraintMaker.makeConstraints(item: self.view, closure: closure) 40 | } 41 | 42 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 43 | ConstraintMaker.remakeConstraints(item: self.view, closure: closure) 44 | } 45 | 46 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { 47 | ConstraintMaker.updateConstraints(item: self.view, closure: closure) 48 | } 49 | 50 | public func removeConstraints() { 51 | ConstraintMaker.removeConstraints(item: self.view) 52 | } 53 | 54 | public var contentHuggingHorizontalPriority: Float { 55 | get { 56 | return self.view.contentHuggingPriority(for: .horizontal).rawValue 57 | } 58 | set { 59 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal) 60 | } 61 | } 62 | 63 | public var contentHuggingVerticalPriority: Float { 64 | get { 65 | return self.view.contentHuggingPriority(for: .vertical).rawValue 66 | } 67 | set { 68 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical) 69 | } 70 | } 71 | 72 | public var contentCompressionResistanceHorizontalPriority: Float { 73 | get { 74 | return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue 75 | } 76 | set { 77 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal) 78 | } 79 | } 80 | 81 | public var contentCompressionResistanceVerticalPriority: Float { 82 | get { 83 | return self.view.contentCompressionResistancePriority(for: .vertical).rawValue 84 | } 85 | set { 86 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical) 87 | } 88 | } 89 | 90 | public var target: AnyObject? { 91 | return self.view 92 | } 93 | 94 | internal let view: ConstraintView 95 | 96 | internal init(view: ConstraintView) { 97 | self.view = view 98 | 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/Debugging.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | public extension LayoutConstraint { 31 | 32 | override public var description: String { 33 | var description = "<" 34 | 35 | description += descriptionForObject(self) 36 | 37 | if let firstItem = conditionalOptional(from: self.firstItem) { 38 | description += " \(descriptionForObject(firstItem))" 39 | } 40 | 41 | if self.firstAttribute != .notAnAttribute { 42 | description += ".\(descriptionForAttribute(self.firstAttribute))" 43 | } 44 | 45 | description += " \(descriptionForRelation(self.relation))" 46 | 47 | if let secondItem = self.secondItem { 48 | description += " \(descriptionForObject(secondItem))" 49 | } 50 | 51 | if self.secondAttribute != .notAnAttribute { 52 | description += ".\(descriptionForAttribute(self.secondAttribute))" 53 | } 54 | 55 | if self.multiplier != 1.0 { 56 | description += " * \(self.multiplier)" 57 | } 58 | 59 | if self.secondAttribute == .notAnAttribute { 60 | description += " \(self.constant)" 61 | } else { 62 | if self.constant > 0.0 { 63 | description += " + \(self.constant)" 64 | } else if self.constant < 0.0 { 65 | description += " - \(abs(self.constant))" 66 | } 67 | } 68 | 69 | if self.priority.rawValue != 1000.0 { 70 | description += " ^\(self.priority)" 71 | } 72 | 73 | description += ">" 74 | 75 | return description 76 | } 77 | 78 | } 79 | 80 | private func descriptionForRelation(_ relation: LayoutRelation) -> String { 81 | switch relation { 82 | case .equal: return "==" 83 | case .greaterThanOrEqual: return ">=" 84 | case .lessThanOrEqual: return "<=" 85 | } 86 | } 87 | 88 | private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String { 89 | #if os(iOS) || os(tvOS) 90 | switch attribute { 91 | case .notAnAttribute: return "notAnAttribute" 92 | case .top: return "top" 93 | case .left: return "left" 94 | case .bottom: return "bottom" 95 | case .right: return "right" 96 | case .leading: return "leading" 97 | case .trailing: return "trailing" 98 | case .width: return "width" 99 | case .height: return "height" 100 | case .centerX: return "centerX" 101 | case .centerY: return "centerY" 102 | case .lastBaseline: return "lastBaseline" 103 | case .firstBaseline: return "firstBaseline" 104 | case .topMargin: return "topMargin" 105 | case .leftMargin: return "leftMargin" 106 | case .bottomMargin: return "bottomMargin" 107 | case .rightMargin: return "rightMargin" 108 | case .leadingMargin: return "leadingMargin" 109 | case .trailingMargin: return "trailingMargin" 110 | case .centerXWithinMargins: return "centerXWithinMargins" 111 | case .centerYWithinMargins: return "centerYWithinMargins" 112 | } 113 | #else 114 | switch attribute { 115 | case .notAnAttribute: return "notAnAttribute" 116 | case .top: return "top" 117 | case .left: return "left" 118 | case .bottom: return "bottom" 119 | case .right: return "right" 120 | case .leading: return "leading" 121 | case .trailing: return "trailing" 122 | case .width: return "width" 123 | case .height: return "height" 124 | case .centerX: return "centerX" 125 | case .centerY: return "centerY" 126 | case .lastBaseline: return "lastBaseline" 127 | case .firstBaseline: return "firstBaseline" 128 | } 129 | #endif 130 | } 131 | 132 | private func conditionalOptional(from object: Optional) -> Optional { 133 | return object 134 | } 135 | 136 | private func conditionalOptional(from object: T) -> Optional { 137 | return Optional.some(object) 138 | } 139 | 140 | private func descriptionForObject(_ object: AnyObject) -> String { 141 | let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object))) 142 | var desc = "" 143 | 144 | desc += type(of: object).description() 145 | 146 | if let object = object as? ConstraintView { 147 | desc += ":\(object.snp.label() ?? pointerDescription)" 148 | } else if let object = object as? LayoutConstraint { 149 | desc += ":\(object.label ?? pointerDescription)" 150 | } else { 151 | desc += ":\(pointerDescription)" 152 | } 153 | 154 | if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 { 155 | desc += "@\((file as NSString).lastPathComponent)#\(line)" 156 | } 157 | 158 | desc += "" 159 | return desc 160 | } 161 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/LayoutConstraint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class LayoutConstraint : NSLayoutConstraint { 32 | 33 | public var label: String? { 34 | get { 35 | return self.identifier 36 | } 37 | set { 38 | self.identifier = newValue 39 | } 40 | } 41 | 42 | internal weak var constraint: Constraint? = nil 43 | 44 | } 45 | 46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool { 47 | guard lhs.firstItem === rhs.firstItem && 48 | lhs.secondItem === rhs.secondItem && 49 | lhs.firstAttribute == rhs.firstAttribute && 50 | lhs.secondAttribute == rhs.secondAttribute && 51 | lhs.relation == rhs.relation && 52 | lhs.priority == rhs.priority && 53 | lhs.multiplier == rhs.multiplier else { 54 | return false 55 | } 56 | return true 57 | } 58 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/LayoutConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol LayoutConstraintItem: class { 32 | } 33 | 34 | @available(iOS 9.0, OSX 10.11, *) 35 | extension ConstraintLayoutGuide : LayoutConstraintItem { 36 | } 37 | 38 | extension ConstraintView : LayoutConstraintItem { 39 | } 40 | 41 | 42 | extension LayoutConstraintItem { 43 | 44 | internal func prepare() { 45 | if let view = self as? ConstraintView { 46 | view.translatesAutoresizingMaskIntoConstraints = false 47 | } 48 | } 49 | 50 | internal var superview: ConstraintView? { 51 | if let view = self as? ConstraintView { 52 | return view.superview 53 | } 54 | 55 | if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide { 56 | return guide.owningView 57 | } 58 | 59 | return nil 60 | } 61 | internal var constraints: [Constraint] { 62 | return self.constraintsSet.allObjects as! [Constraint] 63 | } 64 | 65 | internal func add(constraints: [Constraint]) { 66 | let constraintsSet = self.constraintsSet 67 | for constraint in constraints { 68 | constraintsSet.add(constraint) 69 | } 70 | } 71 | 72 | internal func remove(constraints: [Constraint]) { 73 | let constraintsSet = self.constraintsSet 74 | for constraint in constraints { 75 | constraintsSet.remove(constraint) 76 | } 77 | } 78 | 79 | private var constraintsSet: NSMutableSet { 80 | let constraintsSet: NSMutableSet 81 | 82 | if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet { 83 | constraintsSet = existing 84 | } else { 85 | constraintsSet = NSMutableSet() 86 | objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) 87 | } 88 | return constraintsSet 89 | 90 | } 91 | 92 | } 93 | private var constraintsKey: UInt8 = 0 94 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/Typealiases.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | import Foundation 25 | 26 | #if os(iOS) || os(tvOS) 27 | import UIKit 28 | typealias LayoutRelation = NSLayoutRelation 29 | typealias LayoutAttribute = NSLayoutAttribute 30 | typealias LayoutPriority = UILayoutPriority 31 | #else 32 | import AppKit 33 | typealias LayoutRelation = NSLayoutConstraint.Relation 34 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 35 | typealias LayoutPriority = NSLayoutConstraint.Priority 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /Pods/SnapKit/Source/UILayoutSupport+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 8.0, *) 30 | public extension ConstraintLayoutSupport { 31 | 32 | public var snp: ConstraintLayoutSupportDSL { 33 | return ConstraintLayoutSupportDSL(support: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/FGHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FGHUD : NSObject 3 | @end 4 | @implementation PodsDummy_FGHUD 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/FGHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/FGHUD-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double FGHUDVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char FGHUDVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/FGHUD.modulemap: -------------------------------------------------------------------------------- 1 | framework module FGHUD { 2 | umbrella header "FGHUD-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/FGHUD.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FGHUD 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FGHUD 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGHUD/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.4.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/FGToolKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_FGToolKit : NSObject 3 | @end 4 | @implementation PodsDummy_FGToolKit 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/FGToolKit-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/FGToolKit-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double FGToolKitVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char FGToolKitVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/FGToolKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module FGToolKit { 2 | umbrella header "FGToolKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/FGToolKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FGToolKit 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/FGToolKit 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/FGToolKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## FGHUD 5 | 6 | MIT License 7 | 8 | Copyright (c) 2018 CGPointZero 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## FGToolKit 30 | 31 | MIT License 32 | 33 | Copyright (c) 2018 CGPointZero 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | 53 | 54 | ## SnapKit 55 | 56 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 57 | 58 | Permission is hereby granted, free of charge, to any person obtaining a copy 59 | of this software and associated documentation files (the "Software"), to deal 60 | in the Software without restriction, including without limitation the rights 61 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 62 | copies of the Software, and to permit persons to whom the Software is 63 | furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in 66 | all copies or substantial portions of the Software. 67 | 68 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 69 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 70 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 71 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 72 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 73 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 74 | THE SOFTWARE. 75 | 76 | Generated by CocoaPods - https://cocoapods.org 77 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2018 CGPointZero 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | FGHUD 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | MIT License 49 | 50 | Copyright (c) 2018 CGPointZero 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining a copy 53 | of this software and associated documentation files (the "Software"), to deal 54 | in the Software without restriction, including without limitation the rights 55 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 56 | copies of the Software, and to permit persons to whom the Software is 57 | furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all 60 | copies or substantial portions of the Software. 61 | 62 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 65 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 66 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 68 | SOFTWARE. 69 | 70 | License 71 | MIT 72 | Title 73 | FGToolKit 74 | Type 75 | PSGroupSpecifier 76 | 77 | 78 | FooterText 79 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 80 | 81 | Permission is hereby granted, free of charge, to any person obtaining a copy 82 | of this software and associated documentation files (the "Software"), to deal 83 | in the Software without restriction, including without limitation the rights 84 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 85 | copies of the Software, and to permit persons to whom the Software is 86 | furnished to do so, subject to the following conditions: 87 | 88 | The above copyright notice and this permission notice shall be included in 89 | all copies or substantial portions of the Software. 90 | 91 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 92 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 93 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 94 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 95 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 96 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 97 | THE SOFTWARE. 98 | 99 | License 100 | MIT 101 | Title 102 | SnapKit 103 | Type 104 | PSGroupSpecifier 105 | 106 | 107 | FooterText 108 | Generated by CocoaPods - https://cocoapods.org 109 | Title 110 | 111 | Type 112 | PSGroupSpecifier 113 | 114 | 115 | StringsTable 116 | Acknowledgements 117 | Title 118 | Acknowledgements 119 | 120 | 121 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_FGVideoEditor : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_FGVideoEditor 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | # Used as a return value for each invocation of `strip_invalid_archs` function. 10 | STRIP_BINARY_RETVAL=0 11 | 12 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 13 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 14 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 15 | 16 | # Copies and strips a vendored framework 17 | install_framework() 18 | { 19 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 20 | local source="${BUILT_PRODUCTS_DIR}/$1" 21 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 22 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 23 | elif [ -r "$1" ]; then 24 | local source="$1" 25 | fi 26 | 27 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 28 | 29 | if [ -L "${source}" ]; then 30 | echo "Symlinked..." 31 | source="$(readlink "${source}")" 32 | fi 33 | 34 | # Use filter instead of exclude so missing patterns don't throw errors. 35 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 36 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 37 | 38 | local basename 39 | basename="$(basename -s .framework "$1")" 40 | binary="${destination}/${basename}.framework/${basename}" 41 | if ! [ -r "$binary" ]; then 42 | binary="${destination}/${basename}" 43 | fi 44 | 45 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 46 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 47 | strip_invalid_archs "$binary" 48 | fi 49 | 50 | # Resign the code if required by the build settings to avoid unstable apps 51 | code_sign_if_enabled "${destination}/$(basename "$1")" 52 | 53 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 54 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 55 | local swift_runtime_libs 56 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 57 | for lib in $swift_runtime_libs; do 58 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 59 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 60 | code_sign_if_enabled "${destination}/${lib}" 61 | done 62 | fi 63 | } 64 | 65 | # Copies and strips a vendored dSYM 66 | install_dsym() { 67 | local source="$1" 68 | if [ -r "$source" ]; then 69 | # Copy the dSYM into a the targets temp dir. 70 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 71 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 72 | 73 | local basename 74 | basename="$(basename -s .framework.dSYM "$source")" 75 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 76 | 77 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 78 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 79 | strip_invalid_archs "$binary" 80 | fi 81 | 82 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 83 | # Move the stripped file into its final destination. 84 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 85 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 86 | else 87 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 88 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 89 | fi 90 | fi 91 | } 92 | 93 | # Signs a framework with the provided identity 94 | code_sign_if_enabled() { 95 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 96 | # Use the current code_sign_identitiy 97 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 98 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 99 | 100 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 101 | code_sign_cmd="$code_sign_cmd &" 102 | fi 103 | echo "$code_sign_cmd" 104 | eval "$code_sign_cmd" 105 | fi 106 | } 107 | 108 | # Strip invalid architectures 109 | strip_invalid_archs() { 110 | binary="$1" 111 | # Get architectures for current target binary 112 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 113 | # Intersect them with the architectures we are building for 114 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 115 | # If there are no archs supported by this binary then warn the user 116 | if [[ -z "$intersected_archs" ]]; then 117 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 118 | STRIP_BINARY_RETVAL=0 119 | return 120 | fi 121 | stripped="" 122 | for arch in $binary_archs; do 123 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 124 | # Strip non-valid architectures in-place 125 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 126 | stripped="$stripped $arch" 127 | fi 128 | done 129 | if [[ "$stripped" ]]; then 130 | echo "Stripped $binary of architectures:$stripped" 131 | fi 132 | STRIP_BINARY_RETVAL=1 133 | } 134 | 135 | 136 | if [[ "$CONFIGURATION" == "Debug" ]]; then 137 | install_framework "${BUILT_PRODUCTS_DIR}/FGHUD/FGHUD.framework" 138 | install_framework "${BUILT_PRODUCTS_DIR}/FGToolKit/FGToolKit.framework" 139 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" 140 | fi 141 | if [[ "$CONFIGURATION" == "Release" ]]; then 142 | install_framework "${BUILT_PRODUCTS_DIR}/FGHUD/FGHUD.framework" 143 | install_framework "${BUILT_PRODUCTS_DIR}/FGToolKit/FGToolKit.framework" 144 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" 145 | fi 146 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 147 | wait 148 | fi 149 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 56 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 106 | fi 107 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_FGVideoEditorVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_FGVideoEditorVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FGHUD" "${PODS_CONFIGURATION_BUILD_DIR}/FGToolKit" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/FGHUD/FGHUD.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/FGToolKit/FGToolKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "FGHUD" -framework "FGToolKit" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_FGVideoEditor { 2 | umbrella header "Pods-FGVideoEditor-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-FGVideoEditor/Pods-FGVideoEditor.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FGHUD" "${PODS_CONFIGURATION_BUILD_DIR}/FGToolKit" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/FGHUD/FGHUD.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/FGToolKit/FGToolKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "FGHUD" -framework "FGToolKit" -framework "SnapKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SnapKit : NSObject 3 | @end 4 | @implementation PodsDummy_SnapKit 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double SnapKitVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module SnapKit { 2 | umbrella header "SnapKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/SnapKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](/screenshoot/title.png) 2 | 3 | 🎉🚀📅🌎👍🎉 4 | 5 | 史上首款跟微信朋友圈视频裁剪相似的视频裁剪开源工具 6 | 7 | [![Version](https://img.shields.io/cocoapods/v/FGVideoEditor.svg?style=flat)](http://cocoadocs.org/docsets/FGVideoEditor) 8 | [![License](https://img.shields.io/cocoapods/l/FGVideoEditor.svg?style=flat)](http://cocoadocs.org/docsets/FGVideoEditor) 9 | [![Platform](https://img.shields.io/cocoapods/p/FGVideoEditor.svg?style=flat)](http://cocoadocs.org/docsets/FGVideoEditor) 10 | ![Language](https://img.shields.io/badge/Language-%20Swift%204.0%20-blue.svg) 11 | 12 | # FGVideoEditor 13 | 14 | - [x] 视频时长裁剪处理 15 | - [x] 视频裁剪UI 16 | - [x] 视频裁剪预览 17 | 18 | ### Feathures 19 | 20 | ![](/screenshoot/1.PNG) 21 | ![](/screenshoot/2.PNG) 22 | ![](/screenshoot/3.PNG) 23 | ![](/screenshoot/4.PNG) 24 | ![](/screenshoot/5.PNG) 25 | ![](/screenshoot/6.PNG) 26 | ![](/screenshoot/7.PNG) 27 | ![](/screenshoot/8.PNG) 28 | 29 | ****GIF演示**** 30 | 31 | ![](/screenshoot/demo.gif) 32 | 33 | ****观看视频演示**** 34 | [Vedio](https://pan.baidu.com/s/1UlDhhAjrWGihpgGy6wPrIA) 35 | 36 | ### 使用 Usage 37 | 38 | 微信样式视频裁剪只需要简单的使用(Simply use follow interface to crop a video in WeChat-style-lkie) 39 | ```siwft 40 | public convenience init(maxDuration:CGFloat, vedio url:URL, finishHandler:((FGVideoPreViewController, FGVideoInfo) -> ())?) 41 | ``` 42 | 或者只裁剪不要UI(or just using crop function) 43 | ```swift 44 | public func cropVideo(url: URL, cropRange:CMTimeRange, completion:((_ newUrl: URL, _ newDuration:CGFloat,_ result:Bool) -> ())?) 45 | ``` 46 | 或者只用微信样式的视频裁剪UI(or just WeChat-style video croping UI) 47 | ```swift 48 | public convenience init(frame: CGRect, url:URL, imgw:CGFloat, maxduration:CGFloat) 49 | var cropStart:CGFloat //获取当前裁剪区域的左边界对应的时间(相对于视频开始播放的位置为0s) 50 | var cropDuration:CGFloat //获取当前裁剪区域对应的时长 51 | var cropRange:CMTimeRange //当前裁剪区域的CMTime范围 52 | var cropWidth:CGFloat //当前裁剪区域的宽度 53 | var slidingBeginHandler:(() -> ())? //开始滑动视频裁剪区域的左/右边界的回调 54 | var slidingHandler:((FGSlideDirection) -> ())? //滑动视频裁剪区域的左/右边界的回调 55 | var slidingEndHandler:(() -> ())? //结束左/右边界的滑动 56 | var contentDidScrollHandler:(() -> ())? //滑动视频帧图片横向列表的回调 57 | var dragWillBeginHandler:(() -> ())? //将要滑动视频帧图片横向列表的回调 58 | var dragDidEndHandler:(() -> ())? //结束滑动视频帧图片横向列表的回调 59 | ``` 60 | 61 | 你可以使用`shouldSaveCropedVideoToPhotoLibrary`来控制裁剪视频后是否自动保存至相册,默认是true (save croped video to photo library. default is true, set false to disable auto save to photo library) 62 | 63 | ## 示例(Example) 64 | 65 | 需要先选取一个视频 66 | 67 | ```swift 68 | let picker = UIImagePickerController.init() 69 | picker.sourceType = .photoLibrary 70 | picker.mediaTypes = [kUTTypeMovie as String] 71 | picker.delegate = wkself 72 | picker.allowsEditing = false 73 | present(picker, animated: true, completion: nil) 74 | 75 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 76 | guard let url = info[UIImagePickerControllerMediaURL] as? URL else { 77 | picker.dismiss(animated: true, completion: nil) 78 | showHUD(.error("获取不到资源")) 79 | return 80 | } 81 | crop(video: url) 82 | picker.dismiss(animated: true, completion: nil) 83 | } 84 | ``` 85 | 86 | ## 利用预览视图裁剪,内置最小最大时长判断(croping and ui) 87 | 88 | ```swift 89 | private func crop(video url:URL) { 90 | weak var wkself = self 91 | let preview = FGVideoPreViewController.init(max: 10, vedio: url) { (edit, info) in 92 | wkself?.cropedUrl = info.url 93 | wkself?.navigationController?.popViewController(animated: true) 94 | wkself?.playCropedVideo() 95 | } 96 | navigationController?.pushViewController(preview, animated: true) 97 | } 98 | 99 | private func playCropedVideo() { 100 | guard let url = cropedUrl else { 101 | return 102 | } 103 | pickBtn.isHidden = true 104 | 105 | player = AVPlayer.init(url: url) 106 | previewLayer = AVPlayerLayer.init(player: player) 107 | previewLayer?.backgroundColor = UIColor.clear.cgColor 108 | previewLayer?.videoGravity = .resizeAspectFill 109 | previewLayer?.frame = view.bounds 110 | view.layer.insertSublayer(previewLayer!, at: 0) 111 | player?.play() 112 | } 113 | ``` 114 | 115 | ## 仅使用视频裁剪能力(croping only) 116 | 117 | ```swift 118 | FGVideoEditor.shared.cropVideo(url: url, cropRange: range, completion: { (newUrl, newDuration, result) in 119 | guard result else { 120 | self.showHUD(.error("剪切失败")) 121 | return 122 | } 123 | print("裁剪成功,裁剪后的路径:\(newUrl),时长:%.1f",newDuration) 124 | }) 125 | ``` 126 | 127 | ## 仅使用视频裁剪UI(ui only) 128 | ```swift 129 | let editFrame = CGRect.init(x: 50, y: screenheight - 100, width: screenwidth - 100, height: 50) 130 | slider = FGVideoEditSliderView.init(frame: editFrame, url: url, imgw: imgw, maxduration: 10) 131 | view.addSubview(slider) 132 | weak var wkself = self 133 | slider.slidingBeginHandler = { 134 | wkself?.player?.pause() 135 | wkself?.playing = false 136 | } 137 | let tolerance = CMTimeMake(1, timesclae) 138 | slider.slidingHandler = { (direction) in 139 | let range = (wkself ?? self).slider.cropRange 140 | wkself?.currentRange = range 141 | if direction == .left { 142 | wkself?.player?.seek(to: range.end) 143 | } else { 144 | wkself?.player?.seek(to: range.start, 145 | toleranceBefore: tolerance, 146 | toleranceAfter: tolerance) 147 | wkself?.player?.seek(to: range.start) 148 | } 149 | } 150 | slider.slidingEndHandler = { 151 | wkself?.player?.seek(to: (wkself ?? self).currentRange.start) 152 | wkself?.player?.play() 153 | wkself?.playing = true 154 | } 155 | slider.contentDidScrollHandler = { 156 | let range = (wkself ?? self).slider.cropRange 157 | wkself?.currentRange = range 158 | wkself?.player?.seek(to: range.start) 159 | } 160 | slider.dragWillBeginHandler = { 161 | wkself?.player?.pause() 162 | wkself?.playing = false 163 | } 164 | slider.dragDidEndHandler = { 165 | wkself?.player?.play() 166 | wkself?.playing = true 167 | } 168 | ``` 169 | 170 | # 安装 Installation 171 | 172 | ```swift 173 | pod repo update 174 | pod "FGVideoEditor", "~>1.2.1" 175 | 176 | import FGVideoEditor 177 | ``` 178 | ****若手动安装,请添加依赖:`"SnapKit"`, `"FGHUD"`, `"pod "FGToolKit" 179 | 180 | # 环境 Required 181 | 182 | - [x] Xocde 9 183 | - [x] Swift 4.x 184 | 185 | --------------------- 186 | ***万水千山总是情,给个star行不行 187 | 欢迎pull request,欢迎isuue!*** 188 | -------------------------------------------------------------------------------- /screenshoot/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/1.PNG -------------------------------------------------------------------------------- /screenshoot/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/2.PNG -------------------------------------------------------------------------------- /screenshoot/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/3.PNG -------------------------------------------------------------------------------- /screenshoot/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/4.PNG -------------------------------------------------------------------------------- /screenshoot/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/5.PNG -------------------------------------------------------------------------------- /screenshoot/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/6.PNG -------------------------------------------------------------------------------- /screenshoot/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/7.PNG -------------------------------------------------------------------------------- /screenshoot/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/8.PNG -------------------------------------------------------------------------------- /screenshoot/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/demo.gif -------------------------------------------------------------------------------- /screenshoot/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Insfgg99x/FGVideoEditor/b86c114ec88a0b9a3b8f9620e8b0a34cb18c276f/screenshoot/title.png --------------------------------------------------------------------------------