├── HSPlayerFullScreenDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── HSPlayerFullScreenDemo.xcworkspace └── contents.xcworkspacedata ├── HSPlayerFullScreenDemo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── Player │ ├── HSPlayerControlView.swift │ ├── HSPlayerSceneController.swift │ ├── HSPlayerSceneWindow.swift │ └── movie.jpg ├── UIScreen+Extension.swift ├── UIViewController+Transition.swift ├── ViewController.swift ├── ViewController原生旋转 │ ├── HSNativeRotationViewController.swift │ └── HSPlayerView1.swift ├── 播放器VIew旋转 │ ├── HSPlayerRotationViewController.swift │ └── HSPlayerView2.swift ├── 播放器View旋转+添加播放器横屏Window │ ├── HSPlayerRotationViewWithLandscapeController.swift │ └── HSPlayerView4.swift └── 播放器View旋转+添加播放器竖屏Window │ ├── HSPlayerRotationViewWithWindowController.swift │ └── HSPlayerView3.swift ├── Podfile ├── Podfile.lock ├── Pods ├── Manifest.lock ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── hejianyuan.xcuserdatad │ │ └── xcschemes │ │ ├── Pods-HSPlayerFullScreenDemo.xcscheme │ │ └── SnapKit.xcscheme ├── 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 │ ├── Pods-HSPlayerFullScreenDemo │ ├── Pods-HSPlayerFullScreenDemo-Info.plist │ ├── Pods-HSPlayerFullScreenDemo-acknowledgements.markdown │ ├── Pods-HSPlayerFullScreenDemo-acknowledgements.plist │ ├── Pods-HSPlayerFullScreenDemo-dummy.m │ ├── Pods-HSPlayerFullScreenDemo-frameworks-Debug-input-files.xcfilelist │ ├── Pods-HSPlayerFullScreenDemo-frameworks-Debug-output-files.xcfilelist │ ├── Pods-HSPlayerFullScreenDemo-frameworks-Release-input-files.xcfilelist │ ├── Pods-HSPlayerFullScreenDemo-frameworks-Release-output-files.xcfilelist │ ├── Pods-HSPlayerFullScreenDemo-frameworks.sh │ ├── Pods-HSPlayerFullScreenDemo-umbrella.h │ ├── Pods-HSPlayerFullScreenDemo.debug.xcconfig │ ├── Pods-HSPlayerFullScreenDemo.modulemap │ └── Pods-HSPlayerFullScreenDemo.release.xcconfig │ └── SnapKit │ ├── SnapKit-Info.plist │ ├── SnapKit-dummy.m │ ├── SnapKit-prefix.pch │ ├── SnapKit-umbrella.h │ ├── SnapKit.debug.xcconfig │ ├── SnapKit.modulemap │ └── SnapKit.release.xcconfig └── README.md /HSPlayerFullScreenDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | var window: UIWindow? 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | let rootController = ViewController.init() 16 | window = UIWindow.init(frame: UIScreen.main.bounds) 17 | window?.rootViewController = UINavigationController.init(rootViewController: rootController) 18 | window?.makeKeyAndVisible() 19 | 20 | return true 21 | } 22 | 23 | 24 | func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { 25 | return UIInterfaceOrientationMask.allButUpsideDown 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UIUserInterfaceStyle 38 | Light 39 | 40 | 41 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/Player/HSPlayerControlView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerControlView.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | typealias VoidFunc = ()->Void 13 | 14 | class HSPlayerControlView: UIView { 15 | override init(frame: CGRect) { 16 | super.init(frame: frame) 17 | self.setupUI() 18 | } 19 | 20 | required init(coder: NSCoder) { 21 | super.init(coder: coder)! 22 | self.setupUI() 23 | } 24 | 25 | func setupUI(){ 26 | self.backgroundColor = UIColor.clear 27 | 28 | let backButton = UIButton.init(type: UIButton.ButtonType.custom) 29 | backButton.backgroundColor = UIColor.red 30 | backButton.setTitle("返回", for: UIControl.State.normal) 31 | backButton.titleLabel?.textColor = UIColor.white 32 | backButton.addTarget(self, action: #selector(backButtonAction), for: UIControl.Event.touchUpInside) 33 | self.addSubview(backButton) 34 | backButton.snp.makeConstraints { (make) in 35 | make.left.top.equalToSuperview().offset(20) 36 | make.size.equalTo(CGSize(width: 80, height: 40)) 37 | } 38 | 39 | let fullScreenButton = UIButton.init(type: UIButton.ButtonType.custom) 40 | fullScreenButton.backgroundColor = UIColor.red 41 | fullScreenButton.setTitle("全屏", for: UIControl.State.normal) 42 | fullScreenButton.titleLabel?.textColor = UIColor.white 43 | fullScreenButton.addTarget(self, action: #selector(fullScreenButtonAction), for: UIControl.Event.touchUpInside) 44 | self.addSubview(fullScreenButton) 45 | 46 | fullScreenButton.snp.makeConstraints { (make) in 47 | make.right.bottom.equalToSuperview().offset(-20) 48 | make.size.equalTo(CGSize(width: 80, height: 40)) 49 | } 50 | } 51 | 52 | var playerControlBackAction:VoidFunc? 53 | var playerControlFullScreenAction:VoidFunc? 54 | 55 | 56 | @objc func backButtonAction(){ 57 | if self.playerControlBackAction != nil { 58 | playerControlBackAction?() 59 | } 60 | } 61 | 62 | @objc func fullScreenButtonAction(){ 63 | if self.playerControlFullScreenAction != nil { 64 | playerControlFullScreenAction?() 65 | } 66 | } 67 | 68 | override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { 69 | var next = true 70 | for view in self.subviews { 71 | if view is UIControl { 72 | if view.frame.contains(point) { 73 | next = false 74 | break 75 | } 76 | } 77 | } 78 | return !next 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/Player/HSPlayerSceneController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerSceneController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/8. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerSceneController: UIViewController { 12 | 13 | var interfaceOrientationMask:UIInterfaceOrientationMask? = nil 14 | var shouldNotAutorotate:Bool = false 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | } 20 | 21 | override var shouldAutorotate:Bool{ 22 | return !self.shouldNotAutorotate 23 | } 24 | 25 | override var supportedInterfaceOrientations:UIInterfaceOrientationMask{ 26 | if self.interfaceOrientationMask != nil { 27 | return self.interfaceOrientationMask! 28 | } 29 | return .landscape 30 | } 31 | 32 | var _statusBarHiden:Bool = false 33 | 34 | override var prefersStatusBarHidden: Bool{ 35 | return self._statusBarHiden 36 | } 37 | 38 | var statusBarHiden:Bool{ 39 | get{ 40 | return _statusBarHiden 41 | } 42 | 43 | set{ 44 | _statusBarHiden = newValue 45 | self.setNeedsStatusBarAppearanceUpdate() 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/Player/HSPlayerSceneWindow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerSceneWindow.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerSceneWindow: UIWindow { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/Player/movie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FantasySwords/HSPlayerFullScreenDemo/00393ad321da78b8508f10fb34c287cd5bcfa6b2/HSPlayerFullScreenDemo/Player/movie.jpg -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/UIScreen+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIScreen+Extension.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIScreen{ 12 | public class func screenWidth()->CGFloat{ 13 | return UIScreen.main.bounds.width 14 | } 15 | 16 | public class func screenHeight()->CGFloat{ 17 | return UIScreen.main.bounds.height 18 | } 19 | } 20 | 21 | extension UIDevice{ 22 | public class func isIPhoneX()->Bool{ 23 | if #available(iOS 11.0, *) { 24 | let window = UIApplication.shared.delegate?.window 25 | let safeInset = window??.safeAreaInsets.bottom; 26 | if safeInset! > CGFloat(0) { 27 | return true 28 | } 29 | return false 30 | } else { 31 | return false 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/UIViewController+Transition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Transition.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/8. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITabBarController{ 12 | open override var shouldAutorotate: Bool{ 13 | let selected = self.selectedViewController; 14 | if selected?.isKind(of: UITabBarController.classForCoder()) ?? false{ 15 | let nav = selected as! UINavigationController 16 | return nav.topViewController!.shouldAutorotate 17 | }else{ 18 | return selected!.shouldAutorotate 19 | } 20 | } 21 | 22 | open override var supportedInterfaceOrientations: UIInterfaceOrientationMask{ 23 | let selected = self.selectedViewController; 24 | if selected?.isKind(of: UITabBarController.classForCoder()) ?? false{ 25 | let nav = selected as! UINavigationController 26 | return nav.topViewController!.supportedInterfaceOrientations 27 | }else{ 28 | return selected!.supportedInterfaceOrientations 29 | } 30 | } 31 | 32 | open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{ 33 | let selected = self.selectedViewController; 34 | if selected?.isKind(of: UITabBarController.classForCoder()) ?? false{ 35 | let nav = selected as! UINavigationController 36 | return nav.topViewController!.preferredInterfaceOrientationForPresentation 37 | }else{ 38 | return selected!.preferredInterfaceOrientationForPresentation 39 | } 40 | } 41 | } 42 | 43 | extension UINavigationController{ 44 | open override var shouldAutorotate: Bool{ 45 | return self.topViewController!.shouldAutorotate 46 | } 47 | 48 | open override var supportedInterfaceOrientations: UIInterfaceOrientationMask{ 49 | return self.topViewController!.supportedInterfaceOrientations 50 | } 51 | 52 | open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{ 53 | return self.topViewController!.preferredInterfaceOrientationForPresentation 54 | } 55 | 56 | open override var childForStatusBarStyle: UIViewController?{ 57 | return self.topViewController 58 | } 59 | 60 | open override var childForStatusBarHidden: UIViewController?{ 61 | return self.topViewController 62 | } 63 | 64 | open override var childForHomeIndicatorAutoHidden: UIViewController?{ 65 | return self.topViewController 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { 12 | var tableView: UITableView { 13 | let tableView = UITableView(frame: view.bounds, style: UITableView.Style.plain) 14 | tableView.delegate = self 15 | tableView.dataSource = self 16 | return tableView 17 | } 18 | 19 | var dataArray: NSArray = ["ViewController原生旋转", 20 | "播放器View旋转", 21 | "播放器View旋转+添加播放器竖屏Window", 22 | "添加播放器横屏Window"] 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | setupUI() 27 | } 28 | 29 | func setupUI() { 30 | /// 背景色 31 | view.backgroundColor = UIColor.white 32 | 33 | /// 导航栏 34 | navigationItem.title = "播放器全屏" 35 | 36 | /// subView 37 | view.addSubview(tableView) 38 | tableView.reloadData() 39 | } 40 | 41 | // UITableViewDelegate & UITableViewDataSource 42 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 43 | return dataArray.count 44 | } 45 | 46 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 47 | var cell = tableView.dequeueReusableCell(withIdentifier: "cell") 48 | if cell == nil { 49 | cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: "cell") 50 | cell?.textLabel?.textColor = UIColor.black 51 | cell?.selectionStyle = UITableViewCell.SelectionStyle.none 52 | cell?.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator 53 | } 54 | 55 | cell?.textLabel?.text = dataArray[indexPath.row] as? String 56 | 57 | return cell! 58 | } 59 | 60 | func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { 61 | return 44.0 62 | } 63 | 64 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 65 | switch indexPath.row { 66 | case 0: 67 | let viewController = HSNativeRotationViewController() 68 | navigationController?.pushViewController(viewController, animated: true) 69 | case 1: 70 | let viewController = HSPlayerRotationViewController() 71 | navigationController?.pushViewController(viewController, animated: true) 72 | case 2: 73 | let viewController = HSPlayerRotationViewWithWindowController() 74 | navigationController?.pushViewController(viewController, animated: true) 75 | case 3: 76 | let viewController = HSPlayerRotationViewWithLandscapeController() 77 | navigationController?.pushViewController(viewController, animated: true) 78 | default: 79 | print("") 80 | } 81 | } 82 | 83 | override var shouldAutorotate: Bool { 84 | return false 85 | } 86 | 87 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 88 | return .portrait 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/ViewController原生旋转/HSNativeRotationViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSNativeRotationViewController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSNativeRotationViewController: UIViewController { 12 | init() { 13 | super.init(nibName: nil, bundle: nil) 14 | } 15 | 16 | required init?(coder: NSCoder) { 17 | super.init(coder: coder) 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setupUI() 23 | } 24 | 25 | override func viewWillAppear(_ animated: Bool) { 26 | super.viewWillAppear(animated) 27 | navigationController?.setNavigationBarHidden(true, animated: animated) 28 | } 29 | 30 | override func viewDidAppear(_ animated: Bool) { 31 | super.viewDidAppear(animated) 32 | } 33 | 34 | override func viewWillDisappear(_ animated: Bool) { 35 | super.viewWillDisappear(animated) 36 | navigationController?.setNavigationBarHidden(false, animated: animated) 37 | } 38 | 39 | override func viewDidDisappear(_ animated: Bool) { 40 | super.viewDidDisappear(animated) 41 | } 42 | 43 | var playerView: HSPlayerView1? 44 | 45 | var playerContainerView: UIView = UIView() 46 | 47 | func setupUI() { 48 | view.backgroundColor = UIColor.white 49 | view.addSubview(playerContainerView) 50 | playerContainerView.snp.makeConstraints { make in 51 | make.top.equalToSuperview().offset(UIDevice.isIPhoneX() ? 44 : 20) 52 | make.left.equalToSuperview() 53 | make.size.equalTo(CGSize(width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0)) 54 | } 55 | 56 | playerView = HSPlayerView1(playerContainerView: playerContainerView) 57 | playerView?.frame = CGRect(x: 0, y: 0, width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0) 58 | 59 | playerView?.playerBackAction = { () -> Void in 60 | let orientation = UIDevice.current.orientation 61 | if orientation.isLandscape { 62 | UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation") 63 | self.setNeedsStatusBarAppearanceUpdate() 64 | UIViewController.attemptRotationToDeviceOrientation() 65 | } else { 66 | self.navigationController?.popViewController(animated: true) 67 | } 68 | } 69 | 70 | playerView?.playerFullScreenAction = { () -> Void in 71 | let orientation = UIDevice.current.orientation 72 | if orientation.isLandscape { 73 | UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation") 74 | } else { 75 | let orientationRawValue = UIInterfaceOrientation.landscapeRight.rawValue 76 | UIDevice.current.setValue(orientationRawValue, forKey: "orientation") 77 | } 78 | 79 | self.setNeedsStatusBarAppearanceUpdate() 80 | UIViewController.attemptRotationToDeviceOrientation() 81 | } 82 | } 83 | 84 | override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { 85 | let orientation = UIDevice.current.orientation 86 | let maxValue = max(UIScreen.screenHeight(), UIScreen.screenWidth()) 87 | let minValue = min(UIScreen.screenHeight(), UIScreen.screenWidth()) 88 | let width = orientation.isLandscape ?maxValue :minValue 89 | 90 | UIView.animate(withDuration: coordinator.transitionDuration, animations: { 91 | self.playerContainerView.snp.remakeConstraints { make in 92 | make.top.equalToSuperview().offset(orientation.isLandscape ? 0 : (UIDevice.isIPhoneX() ? 44 : 20)) 93 | make.left.equalToSuperview() 94 | make.size.equalTo(CGSize(width: width, height: width / 16.0 * 9.0)) 95 | } 96 | self.view.setNeedsLayout() 97 | }) { _ in 98 | } 99 | } 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/ViewController原生旋转/HSPlayerView1.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerView1.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import SnapKit 10 | import UIKit 11 | 12 | class HSPlayerView1: UIView { 13 | var imageView: UIImageView = UIImageView(image: UIImage(named: "movie.jpg")) 14 | var playerControlView: HSPlayerControlView = HSPlayerControlView() 15 | 16 | var playerBackAction: VoidFunc? 17 | var playerFullScreenAction: VoidFunc? 18 | 19 | var isFullScreen: Bool = false 20 | 21 | var playerContainerView: UIView? 22 | 23 | override init(frame: CGRect) { 24 | super.init(frame: frame) 25 | setupUI() 26 | } 27 | 28 | required init(coder: NSCoder) { 29 | super.init(coder: coder)! 30 | setupUI() 31 | } 32 | 33 | init(playerContainerView: UIView) { 34 | super.init(frame: CGRect()) 35 | setupUI() 36 | replacePlayerContainerView(view: playerContainerView) 37 | } 38 | 39 | func setupUI() { 40 | backgroundColor = UIColor.black 41 | addSubview(imageView) 42 | addSubview(playerControlView) 43 | 44 | imageView.contentMode = UIView.ContentMode.scaleAspectFill 45 | imageView.clipsToBounds = true 46 | 47 | imageView.snp.makeConstraints { make in 48 | make.top.left.right.bottom.equalToSuperview() 49 | } 50 | 51 | playerControlView.snp.makeConstraints { make in 52 | make.top.left.right.bottom.equalToSuperview() 53 | } 54 | } 55 | 56 | func replacePlayerContainerView(view: UIView) { 57 | if superview != nil { 58 | removeFromSuperview() 59 | } 60 | playerContainerView = view 61 | playerContainerView?.addSubview(self) 62 | 63 | snp.remakeConstraints { make in 64 | make.top.left.bottom.right.equalToSuperview() 65 | } 66 | 67 | playerControlView.playerControlBackAction = { () -> Void in 68 | if let action = self.playerBackAction { 69 | action() 70 | } 71 | } 72 | 73 | playerControlView.playerControlFullScreenAction = { () -> Void in 74 | if let action = self.playerFullScreenAction { 75 | action() 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器VIew旋转/HSPlayerRotationViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerRotationViewController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/8. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerRotationViewController: UIViewController { 12 | init() { 13 | super.init(nibName: nil, bundle: nil) 14 | } 15 | 16 | required init?(coder: NSCoder) { 17 | super.init(coder: coder) 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setupUI() 23 | } 24 | 25 | override func viewWillAppear(_ animated: Bool) { 26 | super.viewWillAppear(animated) 27 | navigationController?.setNavigationBarHidden(true, animated: animated) 28 | } 29 | 30 | override func viewDidAppear(_ animated: Bool) { 31 | super.viewDidAppear(animated) 32 | } 33 | 34 | override func viewWillDisappear(_ animated: Bool) { 35 | super.viewWillDisappear(animated) 36 | navigationController?.setNavigationBarHidden(false, animated: animated) 37 | } 38 | 39 | override func viewDidDisappear(_ animated: Bool) { 40 | super.viewDidDisappear(animated) 41 | } 42 | 43 | var playerView: HSPlayerView2? 44 | 45 | var playerContainerView: UIView = UIView() 46 | 47 | func setupUI() { 48 | view.backgroundColor = UIColor.white 49 | 50 | view.addSubview(playerContainerView) 51 | playerContainerView.snp.makeConstraints { make in 52 | make.top.equalToSuperview().offset(UIDevice.isIPhoneX() ? 44 : 20) 53 | make.left.equalToSuperview() 54 | make.size.equalTo(CGSize(width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0)) 55 | } 56 | 57 | playerView = HSPlayerView2(playerContainerView: playerContainerView) 58 | playerView?.frame = CGRect(x: 0, y: 0, width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0) 59 | 60 | 61 | playerView?.playerBackAction = { [weak self] () -> Void in 62 | if self?.playerView?.isFullScreen ?? false { 63 | self?.playerView?.exitFullScreen() 64 | } else { 65 | self?.navigationController?.popViewController(animated: true) 66 | } 67 | } 68 | 69 | playerView?.playerFullScreenAction = { [weak self] () -> Void in 70 | if self?.playerView?.isFullScreen ?? false { 71 | self?.playerView?.exitFullScreen() 72 | } else { 73 | self?.playerView?.enterFullScreen() 74 | } 75 | } 76 | } 77 | 78 | override var shouldAutorotate: Bool { 79 | return false 80 | } 81 | 82 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 83 | return .portrait 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器VIew旋转/HSPlayerView2.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerView.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/4. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import SnapKit 10 | import UIKit 11 | 12 | class HSPlayerView2: UIView { 13 | var imageView: UIImageView = UIImageView(image: UIImage(named: "movie.jpg")) 14 | var playerControlView: HSPlayerControlView = HSPlayerControlView() 15 | 16 | var playerBackAction: VoidFunc? 17 | var playerFullScreenAction: VoidFunc? 18 | 19 | var isFullScreen: Bool = false 20 | var isTransitioning:Bool = false 21 | 22 | weak var playerContainerView: UIView? 23 | var playerTransitionView = UIView() 24 | 25 | 26 | override init(frame: CGRect) { 27 | super.init(frame: frame) 28 | setupUI() 29 | } 30 | 31 | required init(coder: NSCoder) { 32 | super.init(coder: coder)! 33 | setupUI() 34 | } 35 | 36 | init(playerContainerView: UIView) { 37 | super.init(frame: CGRect()) 38 | setupUI() 39 | replacePlayerContainerView(view: playerContainerView) 40 | setupDeviceOrientationObserver() 41 | } 42 | 43 | deinit { 44 | self.playerTransitionView.removeFromSuperview() 45 | self.removeFromSuperview() 46 | self.playerContainerView = nil 47 | UIDevice.current.endGeneratingDeviceOrientationNotifications() 48 | } 49 | 50 | func setupUI() { 51 | backgroundColor = UIColor.black 52 | addSubview(imageView) 53 | addSubview(playerControlView) 54 | 55 | imageView.contentMode = UIView.ContentMode.scaleAspectFill 56 | imageView.clipsToBounds = true 57 | 58 | imageView.snp.makeConstraints { make in 59 | make.top.left.right.bottom.equalToSuperview() 60 | } 61 | 62 | playerControlView.snp.makeConstraints { make in 63 | make.top.left.right.bottom.equalToSuperview() 64 | } 65 | } 66 | 67 | func setupDeviceOrientationObserver(){ 68 | UIDevice.current.beginGeneratingDeviceOrientationNotifications() 69 | NotificationCenter.default.addObserver(self, selector: #selector(onDeviceOrientationChange), name: UIDevice.orientationDidChangeNotification, object: nil) 70 | } 71 | 72 | @objc func onDeviceOrientationChange(){ 73 | let currentDeviceOrientation = UIDevice.current.orientation 74 | guard currentDeviceOrientation.isPortrait || currentDeviceOrientation.isLandscape else { 75 | return 76 | } 77 | 78 | switch currentDeviceOrientation { 79 | case UIDeviceOrientation.portrait: 80 | transitionTo(orientation: .portrait, animated: true) 81 | case UIDeviceOrientation.landscapeLeft: 82 | transitionTo(orientation: .landscapeRight, animated: true) 83 | case UIDeviceOrientation.landscapeRight: 84 | transitionTo(orientation: .landscapeLeft, animated: true) 85 | 86 | default: 87 | break 88 | } 89 | 90 | } 91 | 92 | 93 | func replacePlayerContainerView(view: UIView) { 94 | if superview != nil { 95 | removeFromSuperview() 96 | } 97 | playerContainerView = view 98 | playerContainerView?.addSubview(self) 99 | frame = playerControlView.bounds 100 | 101 | playerControlView.playerControlBackAction = {[weak self] () -> Void in 102 | if let action = self?.playerBackAction { 103 | action() 104 | } 105 | } 106 | 107 | playerControlView.playerControlFullScreenAction = {[weak self] () -> Void in 108 | if let action = self?.playerFullScreenAction { 109 | action() 110 | } 111 | } 112 | } 113 | } 114 | 115 | extension HSPlayerView2 { 116 | func transitionTo(orientation: UIInterfaceOrientation, animated: Bool) { 117 | if orientation.isLandscape { 118 | transitionToLandscape(orientation: orientation, animated: animated) 119 | } else if orientation.isPortrait { 120 | transitionToPortrait(animated: animated) 121 | } 122 | } 123 | 124 | func transitionToLandscape(orientation: UIInterfaceOrientation, animated: Bool) { 125 | guard orientation.isLandscape && !isTransitioning else { 126 | return 127 | } 128 | 129 | isFullScreen = true 130 | isTransitioning = true 131 | 132 | let currentOrientation = UIApplication.shared.statusBarOrientation 133 | let keyWindow: UIWindow? = (UIApplication.shared.delegate?.window)! 134 | let containerFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 135 | 136 | let maxValue: CGFloat = max(UIScreen.screenHeight(), UIScreen.screenWidth()) 137 | let minValue: CGFloat = min(UIScreen.screenHeight(), UIScreen.screenWidth()) 138 | 139 | let toBounds = CGRect(x: 0, y: 0, width: maxValue, height: minValue) 140 | let toCenter = keyWindow!.center 141 | 142 | if currentOrientation.isPortrait { 143 | playerTransitionView.frame = containerFrame! 144 | frame = playerTransitionView.bounds 145 | keyWindow?.addSubview(playerTransitionView) 146 | playerTransitionView.addSubview(self) 147 | } 148 | 149 | updateStatusBarAppearance() 150 | let sceneVC = HSPlayerSceneController() 151 | sceneVC.interfaceOrientationMask = (orientation == UIInterfaceOrientation.landscapeLeft) ? UIInterfaceOrientationMask.landscapeLeft : UIInterfaceOrientationMask.landscapeRight 152 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 153 | sceneWnd.rootViewController = sceneVC 154 | 155 | let duration:TimeInterval = animated ?(currentOrientation.isPortrait ?0.35 :0.5) :0.0 156 | UIView.animateKeyframes(withDuration:duration, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 157 | self.playerTransitionView.transform = self.transformForRotation(orientation: orientation) 158 | self.playerTransitionView.center = toCenter 159 | self.playerTransitionView.bounds = toBounds 160 | self.frame = self.playerTransitionView.bounds 161 | }) { _ in 162 | self.isTransitioning = false 163 | } 164 | } 165 | 166 | func transitionToPortrait(animated: Bool) { 167 | let currentOrientation = UIApplication.shared.statusBarOrientation 168 | guard (currentOrientation != UIInterfaceOrientation.portrait) && !isTransitioning else { 169 | return 170 | } 171 | 172 | isTransitioning = true 173 | 174 | let toFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 175 | 176 | updateStatusBarAppearance() 177 | let sceneVC = HSPlayerSceneController() 178 | sceneVC.interfaceOrientationMask = UIInterfaceOrientationMask.portrait 179 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 180 | sceneWnd.rootViewController = sceneVC 181 | 182 | UIView.animateKeyframes(withDuration: 0.35, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 183 | self.playerTransitionView.transform = CGAffineTransform.identity 184 | self.playerTransitionView.frame = toFrame! 185 | self.frame = self.playerTransitionView.bounds 186 | }) { _ in 187 | self.replacePlayerContainerView(view: self.playerContainerView!) 188 | self.isFullScreen = false 189 | self.playerTransitionView.removeFromSuperview() 190 | self.isTransitioning = false 191 | } 192 | } 193 | 194 | func transformForRotation(orientation: UIInterfaceOrientation) -> CGAffineTransform { 195 | switch orientation { 196 | case UIInterfaceOrientation.portrait: 197 | return CGAffineTransform.identity 198 | case UIInterfaceOrientation.landscapeLeft: 199 | return CGAffineTransform(rotationAngle: CGFloat(-Double.pi / 2)) 200 | case UIInterfaceOrientation.landscapeRight: 201 | return CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2)) 202 | default: 203 | return CGAffineTransform.identity 204 | } 205 | } 206 | 207 | func updateStatusBarAppearance() { 208 | let window = (UIApplication.shared.delegate as! AppDelegate).window 209 | var top: UIViewController? = window?.rootViewController 210 | 211 | while true { 212 | if top?.presentingViewController != nil { 213 | top = top?.presentingViewController 214 | } else if top is UINavigationController { 215 | if let nav: UINavigationController = top as? UINavigationController { 216 | top = nav.topViewController 217 | } else { 218 | break 219 | } 220 | } else if top is UITabBarController { 221 | if let tab: UITabBarController = top as? UITabBarController { 222 | top = tab.selectedViewController 223 | } else { 224 | break 225 | } 226 | } else { 227 | break 228 | } 229 | } 230 | 231 | top?.setNeedsStatusBarAppearanceUpdate() 232 | UIViewController.attemptRotationToDeviceOrientation() 233 | } 234 | 235 | func enterFullScreen(_ animated: Bool = true){ 236 | let orientation = UIDevice.current.orientation 237 | switch orientation { 238 | case UIDeviceOrientation.landscapeRight: 239 | transitionTo(orientation: .landscapeLeft, animated: animated) 240 | default: 241 | transitionTo(orientation: .landscapeRight, animated: animated) 242 | break 243 | } 244 | } 245 | 246 | func exitFullScreen(_ animated: Bool = true){ 247 | transitionTo(orientation: .portrait, animated: animated) 248 | } 249 | 250 | } 251 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器View旋转+添加播放器横屏Window/HSPlayerRotationViewWithLandscapeController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerRotationViewWithLandscapeController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerRotationViewWithLandscapeController: UIViewController { 12 | init() { 13 | super.init(nibName: nil, bundle: nil) 14 | } 15 | 16 | required init?(coder: NSCoder) { 17 | super.init(coder: coder) 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setupUI() 23 | } 24 | 25 | override func viewWillAppear(_ animated: Bool) { 26 | super.viewWillAppear(animated) 27 | navigationController?.setNavigationBarHidden(true, animated: animated) 28 | } 29 | 30 | override func viewDidAppear(_ animated: Bool) { 31 | super.viewDidAppear(animated) 32 | } 33 | 34 | override func viewWillDisappear(_ animated: Bool) { 35 | super.viewWillDisappear(animated) 36 | navigationController?.setNavigationBarHidden(false, animated: animated) 37 | } 38 | 39 | override func viewDidDisappear(_ animated: Bool) { 40 | super.viewDidDisappear(animated) 41 | } 42 | 43 | var playerView: HSPlayerView4? 44 | 45 | var playerContainerView: UIView = UIView() 46 | 47 | func setupUI() { 48 | view.backgroundColor = UIColor.white 49 | 50 | view.addSubview(playerContainerView) 51 | playerContainerView.snp.makeConstraints { make in 52 | make.top.equalToSuperview().offset(UIDevice.isIPhoneX() ? 44 : 20) 53 | make.left.equalToSuperview() 54 | make.size.equalTo(CGSize(width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0)) 55 | } 56 | 57 | playerView = HSPlayerView4(playerContainerView: playerContainerView) 58 | playerView?.frame = CGRect(x: 0, y: 0, width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0) 59 | 60 | playerView?.playerBackAction = { [weak self] () -> Void in 61 | if self?.playerView?.isFullScreen ?? false { 62 | self?.playerView?.exitFullScreen() 63 | } else { 64 | self?.navigationController?.popViewController(animated: true) 65 | } 66 | } 67 | 68 | playerView?.playerFullScreenAction = { [weak self] () -> Void in 69 | if self?.playerView?.isFullScreen ?? false { 70 | self?.playerView?.exitFullScreen() 71 | } else { 72 | self?.playerView?.enterFullScreen() 73 | } 74 | } 75 | } 76 | 77 | override var shouldAutorotate: Bool { 78 | return false 79 | } 80 | 81 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 82 | return .portrait 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器View旋转+添加播放器横屏Window/HSPlayerView4.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerView4.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerView4: UIView { 12 | var imageView: UIImageView = UIImageView(image: UIImage(named: "movie.jpg")) 13 | var playerControlView: HSPlayerControlView = HSPlayerControlView() 14 | 15 | var playerBackAction: VoidFunc? 16 | var playerFullScreenAction: VoidFunc? 17 | 18 | var isFullScreen: Bool = false 19 | var isTransitioning: Bool = false 20 | 21 | weak var playerContainerView: UIView? 22 | var playerTransitionView = UIView() 23 | var playerSceneWindow: UIWindow? = HSPlayerSceneWindow(frame: UIScreen.main.bounds) 24 | var playerSceneRootController: HSPlayerSceneController? = HSPlayerSceneController() 25 | 26 | override init(frame: CGRect) { 27 | super.init(frame: frame) 28 | setupUI() 29 | } 30 | 31 | required init(coder: NSCoder) { 32 | super.init(coder: coder)! 33 | setupUI() 34 | } 35 | 36 | init(playerContainerView: UIView) { 37 | super.init(frame: CGRect()) 38 | setupUI() 39 | replacePlayerContainerView(view: playerContainerView) 40 | setupDeviceOrientationObserver() 41 | } 42 | 43 | deinit { 44 | self.playerTransitionView.removeFromSuperview() 45 | self.removeFromSuperview() 46 | self.playerContainerView = nil 47 | UIDevice.current.endGeneratingDeviceOrientationNotifications() 48 | } 49 | 50 | 51 | func setupUI() { 52 | backgroundColor = UIColor.black 53 | addSubview(imageView) 54 | addSubview(playerControlView) 55 | 56 | imageView.contentMode = UIView.ContentMode.scaleAspectFill 57 | imageView.clipsToBounds = true 58 | 59 | imageView.snp.makeConstraints { make in 60 | make.top.left.right.bottom.equalToSuperview() 61 | } 62 | 63 | playerControlView.snp.makeConstraints { make in 64 | make.top.left.right.bottom.equalToSuperview() 65 | } 66 | 67 | let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction)) 68 | addGestureRecognizer(tap) 69 | } 70 | 71 | @objc func tapAction() { 72 | if playerControlView.isHidden { 73 | playerSceneRootController?.statusBarHiden = false 74 | playerControlView.isHidden = false 75 | } else { 76 | playerSceneRootController?.statusBarHiden = true 77 | playerControlView.isHidden = true 78 | } 79 | } 80 | 81 | func setupDeviceOrientationObserver() { 82 | UIDevice.current.beginGeneratingDeviceOrientationNotifications() 83 | NotificationCenter.default.addObserver(self, selector: #selector(onDeviceOrientationChange), name: UIDevice.orientationDidChangeNotification, object: nil) 84 | } 85 | 86 | @objc func onDeviceOrientationChange() { 87 | let currentDeviceOrientation = UIDevice.current.orientation 88 | guard currentDeviceOrientation.isPortrait || currentDeviceOrientation.isLandscape else { 89 | return 90 | } 91 | 92 | switch currentDeviceOrientation { 93 | case UIDeviceOrientation.portrait: 94 | transitionTo(orientation: .portrait, animated: true) 95 | case UIDeviceOrientation.landscapeLeft: 96 | transitionTo(orientation: .landscapeRight, animated: true) 97 | case UIDeviceOrientation.landscapeRight: 98 | transitionTo(orientation: .landscapeLeft, animated: true) 99 | 100 | default: 101 | break 102 | } 103 | } 104 | 105 | func replacePlayerContainerView(view: UIView) { 106 | if superview != nil { 107 | removeFromSuperview() 108 | } 109 | playerContainerView = view 110 | playerContainerView?.addSubview(self) 111 | frame = playerControlView.bounds 112 | 113 | playerControlView.playerControlBackAction = { [weak self] () -> Void in 114 | if let action = self?.playerBackAction { 115 | action() 116 | } 117 | } 118 | 119 | playerControlView.playerControlFullScreenAction = { [weak self] () -> Void in 120 | if let action = self?.playerFullScreenAction { 121 | action() 122 | } 123 | } 124 | } 125 | } 126 | 127 | extension HSPlayerView4 { 128 | func transitionTo(orientation: UIInterfaceOrientation, animated: Bool) { 129 | if orientation.isLandscape { 130 | transitionToLandscape(orientation: orientation, animated: animated) 131 | } else if orientation.isPortrait { 132 | transitionToPortrait(animated: animated) 133 | } 134 | } 135 | 136 | func transitionToLandscape(orientation: UIInterfaceOrientation, animated: Bool) { 137 | let currentOrientation = UIApplication.shared.statusBarOrientation 138 | 139 | // 处于横屏状态下,使用系统默认旋转 140 | guard currentOrientation.isPortrait && !isTransitioning else { 141 | return 142 | } 143 | 144 | isFullScreen = true 145 | isTransitioning = true 146 | 147 | let keyWindow: UIWindow? = (UIApplication.shared.delegate?.window)! 148 | let containerFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 149 | 150 | let maxValue: CGFloat = max(UIScreen.screenHeight(), UIScreen.screenWidth()) 151 | let minValue: CGFloat = min(UIScreen.screenHeight(), UIScreen.screenWidth()) 152 | 153 | let toBounds = CGRect(x: 0, y: 0, width: maxValue, height: minValue) 154 | let toCenter = keyWindow!.center 155 | 156 | playerTransitionView.frame = containerFrame! 157 | frame = playerTransitionView.bounds 158 | keyWindow?.addSubview(playerTransitionView) 159 | playerTransitionView.addSubview(self) 160 | 161 | playerSceneRootController = HSPlayerSceneController() 162 | playerSceneWindow = HSPlayerSceneWindow(frame: UIScreen.main.bounds) 163 | playerSceneWindow?.rootViewController = playerSceneRootController 164 | playerSceneWindow?.makeKeyAndVisible() 165 | 166 | updateStatusBarAppearance() 167 | let sceneVC = HSPlayerSceneController() 168 | sceneVC.interfaceOrientationMask = (orientation == UIInterfaceOrientation.landscapeLeft) ? UIInterfaceOrientationMask.landscapeLeft : UIInterfaceOrientationMask.landscapeRight 169 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 170 | sceneWnd.rootViewController = sceneVC 171 | 172 | let duration: TimeInterval = animated ? (currentOrientation.isPortrait ? 0.35 : 0.5) : 0.0 173 | UIView.animateKeyframes(withDuration: duration, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 174 | self.playerTransitionView.transform = self.transformForRotation(orientation: orientation) 175 | self.playerTransitionView.center = toCenter 176 | self.playerTransitionView.bounds = toBounds 177 | self.frame = self.playerTransitionView.bounds 178 | }) { _ in 179 | self.playerTransitionView.transform = CGAffineTransform.identity 180 | self.playerTransitionView.frame = toBounds 181 | self.playerSceneRootController?.view.addSubview(self.playerTransitionView) 182 | self.isTransitioning = false 183 | } 184 | } 185 | 186 | func transitionToPortrait(animated: Bool) { 187 | let currentOrientation = UIApplication.shared.statusBarOrientation 188 | guard (currentOrientation != UIInterfaceOrientation.portrait) && !isTransitioning else { 189 | return 190 | } 191 | 192 | isTransitioning = true 193 | 194 | let maxValue: CGFloat = max(UIScreen.screenHeight(), UIScreen.screenWidth()) 195 | let minValue: CGFloat = min(UIScreen.screenHeight(), UIScreen.screenWidth()) 196 | 197 | let toFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 198 | let fromBounds = CGRect(x: 0, y: 0, width: minValue, height: maxValue) 199 | playerTransitionView.transform = transformForRotation(orientation: currentOrientation) 200 | playerTransitionView.frame = fromBounds 201 | let keyWindow = UIApplication.shared.delegate?.window 202 | keyWindow??.addSubview(playerTransitionView) 203 | 204 | updateStatusBarAppearance() 205 | let sceneVC = HSPlayerSceneController() 206 | sceneVC.interfaceOrientationMask = UIInterfaceOrientationMask.portrait 207 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 208 | sceneWnd.rootViewController = sceneVC 209 | 210 | UIView.animateKeyframes(withDuration: 0.35, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 211 | self.playerTransitionView.transform = CGAffineTransform.identity 212 | self.playerTransitionView.frame = toFrame! 213 | self.frame = self.playerTransitionView.bounds 214 | }) { _ in 215 | self.replacePlayerContainerView(view: self.playerContainerView!) 216 | self.isFullScreen = false 217 | self.playerTransitionView.removeFromSuperview() 218 | self.playerSceneWindow?.isHidden = true 219 | self.playerSceneWindow = nil 220 | keyWindow??.makeKeyAndVisible() 221 | self.isTransitioning = false 222 | } 223 | } 224 | 225 | func transformForRotation(orientation: UIInterfaceOrientation) -> CGAffineTransform { 226 | switch orientation { 227 | case UIInterfaceOrientation.portrait: 228 | return CGAffineTransform.identity 229 | case UIInterfaceOrientation.landscapeLeft: 230 | return CGAffineTransform(rotationAngle: CGFloat(-Double.pi / 2)) 231 | case UIInterfaceOrientation.landscapeRight: 232 | return CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2)) 233 | default: 234 | return CGAffineTransform.identity 235 | } 236 | } 237 | 238 | func updateStatusBarAppearance() { 239 | let window = (UIApplication.shared.delegate as! AppDelegate).window 240 | var top: UIViewController? = window?.rootViewController 241 | 242 | while true { 243 | if top?.presentingViewController != nil { 244 | top = top?.presentingViewController 245 | } else if top is UINavigationController { 246 | if let nav: UINavigationController = top as? UINavigationController { 247 | top = nav.topViewController 248 | } else { 249 | break 250 | } 251 | } else if top is UITabBarController { 252 | if let tab: UITabBarController = top as? UITabBarController { 253 | top = tab.selectedViewController 254 | } else { 255 | break 256 | } 257 | } else { 258 | break 259 | } 260 | } 261 | 262 | top?.setNeedsStatusBarAppearanceUpdate() 263 | UIViewController.attemptRotationToDeviceOrientation() 264 | } 265 | 266 | func enterFullScreen(_ animated: Bool = true){ 267 | let orientation = UIDevice.current.orientation 268 | switch orientation { 269 | case UIDeviceOrientation.landscapeRight: 270 | transitionTo(orientation: .landscapeLeft, animated: animated) 271 | default: 272 | transitionTo(orientation: .landscapeRight, animated: animated) 273 | break 274 | } 275 | } 276 | 277 | func exitFullScreen(_ animated: Bool = true){ 278 | transitionTo(orientation: .portrait, animated: animated) 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器View旋转+添加播放器竖屏Window/HSPlayerRotationViewWithWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerRotationViewWithWindowController.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class HSPlayerRotationViewWithWindowController: UIViewController { 12 | init() { 13 | super.init(nibName: nil, bundle: nil) 14 | } 15 | 16 | required init?(coder: NSCoder) { 17 | super.init(coder: coder) 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | setupUI() 23 | } 24 | 25 | override func viewWillAppear(_ animated: Bool) { 26 | super.viewWillAppear(animated) 27 | navigationController?.setNavigationBarHidden(true, animated: animated) 28 | } 29 | 30 | override func viewDidAppear(_ animated: Bool) { 31 | super.viewDidAppear(animated) 32 | } 33 | 34 | override func viewWillDisappear(_ animated: Bool) { 35 | super.viewWillDisappear(animated) 36 | navigationController?.setNavigationBarHidden(false, animated: animated) 37 | } 38 | 39 | override func viewDidDisappear(_ animated: Bool) { 40 | super.viewDidDisappear(animated) 41 | } 42 | 43 | var playerView: HSPlayerView3? 44 | 45 | var playerContainerView: UIView = UIView() 46 | 47 | func setupUI() { 48 | view.backgroundColor = UIColor.white 49 | 50 | view.addSubview(playerContainerView) 51 | playerContainerView.snp.makeConstraints { make in 52 | make.top.equalToSuperview().offset(UIDevice.isIPhoneX() ? 44 : 20) 53 | make.left.equalToSuperview() 54 | make.size.equalTo(CGSize(width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0)) 55 | } 56 | 57 | playerView = HSPlayerView3(playerContainerView: playerContainerView) 58 | playerView?.frame = CGRect(x: 0, y: 0, width: UIScreen.screenWidth(), height: UIScreen.screenWidth() / 16.0 * 9.0) 59 | 60 | playerView?.playerBackAction = { [weak self] () -> Void in 61 | if self?.playerView?.isFullScreen ?? false { 62 | self?.playerView?.exitFullScreen() 63 | } else { 64 | self?.navigationController?.popViewController(animated: true) 65 | } 66 | } 67 | 68 | playerView?.playerFullScreenAction = { [weak self] () -> Void in 69 | if self?.playerView?.isFullScreen ?? false { 70 | self?.playerView?.exitFullScreen() 71 | } else { 72 | self?.playerView?.enterFullScreen() 73 | } 74 | } 75 | } 76 | 77 | override var shouldAutorotate: Bool { 78 | return false 79 | } 80 | 81 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 82 | return .portrait 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /HSPlayerFullScreenDemo/播放器View旋转+添加播放器竖屏Window/HSPlayerView3.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HSPlayerView3.swift 3 | // HSPlayerFullScreenDemo 4 | // 5 | // Created by hejianyuan on 2020/6/10. 6 | // Copyright © 2020 hejianyuan. All rights reserved. 7 | // 8 | 9 | import SnapKit 10 | import UIKit 11 | 12 | class HSPlayerView3: UIView { 13 | var imageView: UIImageView = UIImageView(image: UIImage(named: "movie.jpg")) 14 | var playerControlView: HSPlayerControlView = HSPlayerControlView() 15 | 16 | var playerBackAction: VoidFunc? 17 | var playerFullScreenAction: VoidFunc? 18 | 19 | var isFullScreen: Bool = false 20 | var isTransitioning:Bool = false 21 | 22 | weak var playerContainerView: UIView? 23 | var playerTransitionView = UIView() 24 | var playerSceneWindow: UIWindow? = HSPlayerSceneWindow(frame: UIScreen.main.bounds) 25 | var playerSceneRootController: HSPlayerSceneController? = HSPlayerSceneController() 26 | 27 | override init(frame: CGRect) { 28 | super.init(frame: frame) 29 | setupUI() 30 | } 31 | 32 | required init(coder: NSCoder) { 33 | super.init(coder: coder)! 34 | setupUI() 35 | } 36 | 37 | init(playerContainerView: UIView) { 38 | super.init(frame: CGRect()) 39 | setupUI() 40 | replacePlayerContainerView(view: playerContainerView) 41 | setupDeviceOrientationObserver() 42 | } 43 | 44 | deinit { 45 | self.playerSceneWindow = nil 46 | self.playerSceneRootController = nil 47 | self.playerContainerView = nil 48 | self.removeFromSuperview() 49 | UIDevice.current.endGeneratingDeviceOrientationNotifications() 50 | } 51 | 52 | func setupUI() { 53 | backgroundColor = UIColor.black 54 | addSubview(imageView) 55 | addSubview(playerControlView) 56 | 57 | imageView.contentMode = UIView.ContentMode.scaleAspectFill 58 | imageView.clipsToBounds = true 59 | 60 | imageView.snp.makeConstraints { make in 61 | make.top.left.right.bottom.equalToSuperview() 62 | } 63 | 64 | playerControlView.snp.makeConstraints { make in 65 | make.top.left.right.bottom.equalToSuperview() 66 | } 67 | 68 | let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction)) 69 | addGestureRecognizer(tap) 70 | } 71 | 72 | @objc func tapAction() { 73 | if playerControlView.isHidden { 74 | playerSceneRootController?.statusBarHiden = false 75 | playerControlView.isHidden = false 76 | } else { 77 | playerSceneRootController?.statusBarHiden = true 78 | playerControlView.isHidden = true 79 | } 80 | } 81 | 82 | 83 | func setupDeviceOrientationObserver(){ 84 | UIDevice.current.beginGeneratingDeviceOrientationNotifications() 85 | NotificationCenter.default.addObserver(self, selector: #selector(onDeviceOrientationChange), name: UIDevice.orientationDidChangeNotification, object: nil) 86 | } 87 | 88 | @objc func onDeviceOrientationChange(){ 89 | let currentDeviceOrientation = UIDevice.current.orientation 90 | guard currentDeviceOrientation.isPortrait || currentDeviceOrientation.isLandscape else { 91 | return 92 | } 93 | 94 | switch currentDeviceOrientation { 95 | case UIDeviceOrientation.portrait: 96 | transitionTo(orientation: .portrait, animated: true) 97 | case UIDeviceOrientation.landscapeLeft: 98 | transitionTo(orientation: .landscapeRight, animated: true) 99 | case UIDeviceOrientation.landscapeRight: 100 | transitionTo(orientation: .landscapeLeft, animated: true) 101 | 102 | default: 103 | break 104 | } 105 | 106 | } 107 | 108 | func replacePlayerContainerView(view: UIView) { 109 | if superview != nil { 110 | removeFromSuperview() 111 | } 112 | playerContainerView = view 113 | playerContainerView?.addSubview(self) 114 | frame = playerControlView.bounds 115 | 116 | playerControlView.playerControlBackAction = { [weak self]() -> Void in 117 | if let action = self?.playerBackAction { 118 | action() 119 | } 120 | } 121 | 122 | playerControlView.playerControlFullScreenAction = { [weak self]() -> Void in 123 | if let action = self?.playerFullScreenAction { 124 | action() 125 | } 126 | } 127 | } 128 | } 129 | 130 | extension HSPlayerView3 { 131 | func transitionTo(orientation: UIInterfaceOrientation, animated: Bool) { 132 | if orientation.isLandscape { 133 | transitionToLandscape(orientation: orientation, animated: animated) 134 | } else if orientation.isPortrait { 135 | transitionToPortrait(animated: animated) 136 | } 137 | } 138 | 139 | func transitionToLandscape(orientation: UIInterfaceOrientation, animated: Bool) { 140 | guard orientation.isLandscape && !isTransitioning else { 141 | return 142 | } 143 | 144 | isFullScreen = true 145 | isTransitioning = true 146 | 147 | let currentOrientation = UIApplication.shared.statusBarOrientation 148 | let keyWindow: UIWindow? = (UIApplication.shared.delegate?.window)! 149 | let containerFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 150 | 151 | let maxValue: CGFloat = max(UIScreen.screenHeight(), UIScreen.screenWidth()) 152 | let minValue: CGFloat = min(UIScreen.screenHeight(), UIScreen.screenWidth()) 153 | 154 | let toBounds = CGRect(x: 0, y: 0, width: maxValue, height: minValue) 155 | let toCenter = keyWindow!.center 156 | 157 | if currentOrientation.isPortrait { 158 | playerTransitionView.frame = containerFrame! 159 | frame = playerTransitionView.bounds 160 | keyWindow?.addSubview(playerTransitionView) 161 | playerTransitionView.addSubview(self) 162 | 163 | playerSceneRootController?.interfaceOrientationMask = .portrait 164 | playerSceneWindow = HSPlayerSceneWindow(frame: UIScreen.main.bounds) 165 | playerSceneWindow?.rootViewController = playerSceneRootController 166 | playerSceneWindow?.makeKeyAndVisible() 167 | } 168 | 169 | updateStatusBarAppearance() 170 | let sceneVC = HSPlayerSceneController() 171 | sceneVC.interfaceOrientationMask = (orientation == UIInterfaceOrientation.landscapeLeft) ? UIInterfaceOrientationMask.landscapeLeft : UIInterfaceOrientationMask.landscapeRight 172 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 173 | sceneWnd.rootViewController = sceneVC 174 | 175 | let duration:TimeInterval = animated ?(currentOrientation.isPortrait ?0.35 :0.5) :0.0 176 | UIView.animateKeyframes(withDuration: duration, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 177 | self.playerTransitionView.transform = self.transformForRotation(orientation: orientation) 178 | self.playerTransitionView.center = toCenter 179 | self.playerTransitionView.bounds = toBounds 180 | self.frame = self.playerTransitionView.bounds 181 | }) { _ in 182 | self.playerSceneWindow?.addSubview(self.playerTransitionView) 183 | self.isTransitioning = false 184 | } 185 | } 186 | 187 | func transitionToPortrait(animated: Bool) { 188 | let currentOrientation = UIApplication.shared.statusBarOrientation 189 | guard (currentOrientation != UIInterfaceOrientation.portrait) && !isTransitioning else { 190 | return 191 | } 192 | let toFrame = playerContainerView?.convert(playerContainerView!.bounds, to: playerContainerView?.window) 193 | 194 | updateStatusBarAppearance() 195 | let sceneVC = HSPlayerSceneController() 196 | sceneVC.interfaceOrientationMask = UIInterfaceOrientationMask.portrait 197 | let sceneWnd = UIWindow(frame: UIScreen.main.bounds) 198 | sceneWnd.rootViewController = sceneVC 199 | 200 | UIView.animateKeyframes(withDuration: 0.35, delay: 0, options: UIView.KeyframeAnimationOptions.layoutSubviews, animations: { 201 | self.playerTransitionView.transform = CGAffineTransform.identity 202 | self.playerTransitionView.frame = toFrame! 203 | self.frame = self.playerTransitionView.bounds 204 | }) { _ in 205 | self.replacePlayerContainerView(view: self.playerContainerView!) 206 | self.isFullScreen = false 207 | self.playerTransitionView.removeFromSuperview() 208 | self.playerSceneWindow?.isHidden = true 209 | self.playerSceneWindow = nil 210 | self.isTransitioning = false 211 | } 212 | } 213 | 214 | func transformForRotation(orientation: UIInterfaceOrientation) -> CGAffineTransform { 215 | switch orientation { 216 | case UIInterfaceOrientation.portrait: 217 | return CGAffineTransform.identity 218 | case UIInterfaceOrientation.landscapeLeft: 219 | return CGAffineTransform(rotationAngle: CGFloat(-Double.pi / 2)) 220 | case UIInterfaceOrientation.landscapeRight: 221 | return CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2)) 222 | default: 223 | return CGAffineTransform.identity 224 | } 225 | } 226 | 227 | func updateStatusBarAppearance() { 228 | let window = (UIApplication.shared.delegate as! AppDelegate).window 229 | var top: UIViewController? = window?.rootViewController 230 | 231 | while true { 232 | if top?.presentingViewController != nil { 233 | top = top?.presentingViewController 234 | } else if top is UINavigationController { 235 | if let nav: UINavigationController = top as? UINavigationController { 236 | top = nav.topViewController 237 | } else { 238 | break 239 | } 240 | } else if top is UITabBarController { 241 | if let tab: UITabBarController = top as? UITabBarController { 242 | top = tab.selectedViewController 243 | } else { 244 | break 245 | } 246 | } else { 247 | break 248 | } 249 | } 250 | 251 | top?.setNeedsStatusBarAppearanceUpdate() 252 | UIViewController.attemptRotationToDeviceOrientation() 253 | } 254 | 255 | func enterFullScreen(_ animated: Bool = true){ 256 | let orientation = UIDevice.current.orientation 257 | switch orientation { 258 | case UIDeviceOrientation.landscapeRight: 259 | transitionTo(orientation: .landscapeLeft, animated: animated) 260 | default: 261 | transitionTo(orientation: .landscapeRight, animated: animated) 262 | break 263 | } 264 | } 265 | 266 | func exitFullScreen(_ animated: Bool = true){ 267 | transitionTo(orientation: .portrait, animated: animated) 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'HSPlayerFullScreenDemo' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for HSPlayerFullScreenDemo 9 | pod 'SnapKit' 10 | 11 | end 12 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SnapKit (4.2.0) 3 | 4 | DEPENDENCIES: 5 | - SnapKit 6 | 7 | SPEC REPOS: 8 | trunk: 9 | - SnapKit 10 | 11 | SPEC CHECKSUMS: 12 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 13 | 14 | PODFILE CHECKSUM: 9e5d001086e9b77d2aac39fe89d989b5b7f99dd7 15 | 16 | COCOAPODS: 1.9.1 17 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SnapKit (4.2.0) 3 | 4 | DEPENDENCIES: 5 | - SnapKit 6 | 7 | SPEC REPOS: 8 | trunk: 9 | - SnapKit 10 | 11 | SPEC CHECKSUMS: 12 | SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a 13 | 14 | PODFILE CHECKSUM: 9e5d001086e9b77d2aac39fe89d989b5b7f99dd7 15 | 16 | COCOAPODS: 1.9.1 17 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/hejianyuan.xcuserdatad/xcschemes/Pods-HSPlayerFullScreenDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/hejianyuan.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/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/ConstraintAttributes.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 struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral { 32 | 33 | typealias IntegerLiteralType = UInt 34 | 35 | internal init(rawValue: UInt) { 36 | self.rawValue = rawValue 37 | } 38 | internal init(_ rawValue: UInt) { 39 | self.init(rawValue: rawValue) 40 | } 41 | internal init(nilLiteral: ()) { 42 | self.rawValue = 0 43 | } 44 | internal init(integerLiteral rawValue: IntegerLiteralType) { 45 | self.init(rawValue: rawValue) 46 | } 47 | 48 | internal private(set) var rawValue: UInt 49 | internal static var allZeros: ConstraintAttributes { return 0 } 50 | internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 } 51 | internal var boolValue: Bool { return self.rawValue != 0 } 52 | 53 | internal func toRaw() -> UInt { return self.rawValue } 54 | internal static func fromRaw(_ raw: UInt) -> ConstraintAttributes? { return self.init(raw) } 55 | internal static func fromMask(_ raw: UInt) -> ConstraintAttributes { return self.init(raw) } 56 | 57 | // normal 58 | 59 | internal static var none: ConstraintAttributes { return 0 } 60 | internal static var left: ConstraintAttributes { return 1 } 61 | internal static var top: ConstraintAttributes { return 2 } 62 | internal static var right: ConstraintAttributes { return 4 } 63 | internal static var bottom: ConstraintAttributes { return 8 } 64 | internal static var leading: ConstraintAttributes { return 16 } 65 | internal static var trailing: ConstraintAttributes { return 32 } 66 | internal static var width: ConstraintAttributes { return 64 } 67 | internal static var height: ConstraintAttributes { return 128 } 68 | internal static var centerX: ConstraintAttributes { return 256 } 69 | internal static var centerY: ConstraintAttributes { return 512 } 70 | internal static var lastBaseline: ConstraintAttributes { return 1024 } 71 | 72 | @available(iOS 8.0, OSX 10.11, *) 73 | internal static var firstBaseline: ConstraintAttributes { return 2048 } 74 | 75 | @available(iOS 8.0, *) 76 | internal static var leftMargin: ConstraintAttributes { return 4096 } 77 | 78 | @available(iOS 8.0, *) 79 | internal static var rightMargin: ConstraintAttributes { return 8192 } 80 | 81 | @available(iOS 8.0, *) 82 | internal static var topMargin: ConstraintAttributes { return 16384 } 83 | 84 | @available(iOS 8.0, *) 85 | internal static var bottomMargin: ConstraintAttributes { return 32768 } 86 | 87 | @available(iOS 8.0, *) 88 | internal static var leadingMargin: ConstraintAttributes { return 65536 } 89 | 90 | @available(iOS 8.0, *) 91 | internal static var trailingMargin: ConstraintAttributes { return 131072 } 92 | 93 | @available(iOS 8.0, *) 94 | internal static var centerXWithinMargins: ConstraintAttributes { return 262144 } 95 | 96 | @available(iOS 8.0, *) 97 | internal static var centerYWithinMargins: ConstraintAttributes { return 524288 } 98 | 99 | // aggregates 100 | 101 | internal static var edges: ConstraintAttributes { return 15 } 102 | internal static var size: ConstraintAttributes { return 192 } 103 | internal static var center: ConstraintAttributes { return 768 } 104 | 105 | @available(iOS 8.0, *) 106 | internal static var margins: ConstraintAttributes { return 61440 } 107 | 108 | @available(iOS 8.0, *) 109 | internal static var centerWithinMargins: ConstraintAttributes { return 786432 } 110 | 111 | internal var layoutAttributes:[LayoutAttribute] { 112 | var attrs = [LayoutAttribute]() 113 | if (self.contains(ConstraintAttributes.left)) { 114 | attrs.append(.left) 115 | } 116 | if (self.contains(ConstraintAttributes.top)) { 117 | attrs.append(.top) 118 | } 119 | if (self.contains(ConstraintAttributes.right)) { 120 | attrs.append(.right) 121 | } 122 | if (self.contains(ConstraintAttributes.bottom)) { 123 | attrs.append(.bottom) 124 | } 125 | if (self.contains(ConstraintAttributes.leading)) { 126 | attrs.append(.leading) 127 | } 128 | if (self.contains(ConstraintAttributes.trailing)) { 129 | attrs.append(.trailing) 130 | } 131 | if (self.contains(ConstraintAttributes.width)) { 132 | attrs.append(.width) 133 | } 134 | if (self.contains(ConstraintAttributes.height)) { 135 | attrs.append(.height) 136 | } 137 | if (self.contains(ConstraintAttributes.centerX)) { 138 | attrs.append(.centerX) 139 | } 140 | if (self.contains(ConstraintAttributes.centerY)) { 141 | attrs.append(.centerY) 142 | } 143 | if (self.contains(ConstraintAttributes.lastBaseline)) { 144 | attrs.append(.lastBaseline) 145 | } 146 | 147 | #if os(iOS) || os(tvOS) 148 | if (self.contains(ConstraintAttributes.firstBaseline)) { 149 | attrs.append(.firstBaseline) 150 | } 151 | if (self.contains(ConstraintAttributes.leftMargin)) { 152 | attrs.append(.leftMargin) 153 | } 154 | if (self.contains(ConstraintAttributes.rightMargin)) { 155 | attrs.append(.rightMargin) 156 | } 157 | if (self.contains(ConstraintAttributes.topMargin)) { 158 | attrs.append(.topMargin) 159 | } 160 | if (self.contains(ConstraintAttributes.bottomMargin)) { 161 | attrs.append(.bottomMargin) 162 | } 163 | if (self.contains(ConstraintAttributes.leadingMargin)) { 164 | attrs.append(.leadingMargin) 165 | } 166 | if (self.contains(ConstraintAttributes.trailingMargin)) { 167 | attrs.append(.trailingMargin) 168 | } 169 | if (self.contains(ConstraintAttributes.centerXWithinMargins)) { 170 | attrs.append(.centerXWithinMargins) 171 | } 172 | if (self.contains(ConstraintAttributes.centerYWithinMargins)) { 173 | attrs.append(.centerYWithinMargins) 174 | } 175 | #endif 176 | 177 | return attrs 178 | } 179 | } 180 | 181 | internal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes { 182 | return left.union(right) 183 | } 184 | 185 | internal func +=(left: inout ConstraintAttributes, right: ConstraintAttributes) { 186 | left.formUnion(right) 187 | } 188 | 189 | internal func -=(left: inout ConstraintAttributes, right: ConstraintAttributes) { 190 | left.subtract(right) 191 | } 192 | 193 | internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool { 194 | return left.rawValue == right.rawValue 195 | } 196 | -------------------------------------------------------------------------------- /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/ConstraintMaker.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 class ConstraintMaker { 31 | 32 | public var left: ConstraintMakerExtendable { 33 | return self.makeExtendableWithAttributes(.left) 34 | } 35 | 36 | public var top: ConstraintMakerExtendable { 37 | return self.makeExtendableWithAttributes(.top) 38 | } 39 | 40 | public var bottom: ConstraintMakerExtendable { 41 | return self.makeExtendableWithAttributes(.bottom) 42 | } 43 | 44 | public var right: ConstraintMakerExtendable { 45 | return self.makeExtendableWithAttributes(.right) 46 | } 47 | 48 | public var leading: ConstraintMakerExtendable { 49 | return self.makeExtendableWithAttributes(.leading) 50 | } 51 | 52 | public var trailing: ConstraintMakerExtendable { 53 | return self.makeExtendableWithAttributes(.trailing) 54 | } 55 | 56 | public var width: ConstraintMakerExtendable { 57 | return self.makeExtendableWithAttributes(.width) 58 | } 59 | 60 | public var height: ConstraintMakerExtendable { 61 | return self.makeExtendableWithAttributes(.height) 62 | } 63 | 64 | public var centerX: ConstraintMakerExtendable { 65 | return self.makeExtendableWithAttributes(.centerX) 66 | } 67 | 68 | public var centerY: ConstraintMakerExtendable { 69 | return self.makeExtendableWithAttributes(.centerY) 70 | } 71 | 72 | @available(*, deprecated:3.0, message:"Use lastBaseline instead") 73 | public var baseline: ConstraintMakerExtendable { 74 | return self.makeExtendableWithAttributes(.lastBaseline) 75 | } 76 | 77 | public var lastBaseline: ConstraintMakerExtendable { 78 | return self.makeExtendableWithAttributes(.lastBaseline) 79 | } 80 | 81 | @available(iOS 8.0, OSX 10.11, *) 82 | public var firstBaseline: ConstraintMakerExtendable { 83 | return self.makeExtendableWithAttributes(.firstBaseline) 84 | } 85 | 86 | @available(iOS 8.0, *) 87 | public var leftMargin: ConstraintMakerExtendable { 88 | return self.makeExtendableWithAttributes(.leftMargin) 89 | } 90 | 91 | @available(iOS 8.0, *) 92 | public var rightMargin: ConstraintMakerExtendable { 93 | return self.makeExtendableWithAttributes(.rightMargin) 94 | } 95 | 96 | @available(iOS 8.0, *) 97 | public var topMargin: ConstraintMakerExtendable { 98 | return self.makeExtendableWithAttributes(.topMargin) 99 | } 100 | 101 | @available(iOS 8.0, *) 102 | public var bottomMargin: ConstraintMakerExtendable { 103 | return self.makeExtendableWithAttributes(.bottomMargin) 104 | } 105 | 106 | @available(iOS 8.0, *) 107 | public var leadingMargin: ConstraintMakerExtendable { 108 | return self.makeExtendableWithAttributes(.leadingMargin) 109 | } 110 | 111 | @available(iOS 8.0, *) 112 | public var trailingMargin: ConstraintMakerExtendable { 113 | return self.makeExtendableWithAttributes(.trailingMargin) 114 | } 115 | 116 | @available(iOS 8.0, *) 117 | public var centerXWithinMargins: ConstraintMakerExtendable { 118 | return self.makeExtendableWithAttributes(.centerXWithinMargins) 119 | } 120 | 121 | @available(iOS 8.0, *) 122 | public var centerYWithinMargins: ConstraintMakerExtendable { 123 | return self.makeExtendableWithAttributes(.centerYWithinMargins) 124 | } 125 | 126 | public var edges: ConstraintMakerExtendable { 127 | return self.makeExtendableWithAttributes(.edges) 128 | } 129 | public var size: ConstraintMakerExtendable { 130 | return self.makeExtendableWithAttributes(.size) 131 | } 132 | public var center: ConstraintMakerExtendable { 133 | return self.makeExtendableWithAttributes(.center) 134 | } 135 | 136 | @available(iOS 8.0, *) 137 | public var margins: ConstraintMakerExtendable { 138 | return self.makeExtendableWithAttributes(.margins) 139 | } 140 | 141 | @available(iOS 8.0, *) 142 | public var centerWithinMargins: ConstraintMakerExtendable { 143 | return self.makeExtendableWithAttributes(.centerWithinMargins) 144 | } 145 | 146 | private let item: LayoutConstraintItem 147 | private var descriptions = [ConstraintDescription]() 148 | 149 | internal init(item: LayoutConstraintItem) { 150 | self.item = item 151 | self.item.prepare() 152 | } 153 | 154 | internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable { 155 | let description = ConstraintDescription(item: self.item, attributes: attributes) 156 | self.descriptions.append(description) 157 | return ConstraintMakerExtendable(description) 158 | } 159 | 160 | internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { 161 | let maker = ConstraintMaker(item: item) 162 | closure(maker) 163 | var constraints: [Constraint] = [] 164 | for description in maker.descriptions { 165 | guard let constraint = description.constraint else { 166 | continue 167 | } 168 | constraints.append(constraint) 169 | } 170 | return constraints 171 | } 172 | 173 | internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) { 174 | let constraints = prepareConstraints(item: item, closure: closure) 175 | for constraint in constraints { 176 | constraint.activateIfNeeded(updatingExisting: false) 177 | } 178 | } 179 | 180 | internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) { 181 | self.removeConstraints(item: item) 182 | self.makeConstraints(item: item, closure: closure) 183 | } 184 | 185 | internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) { 186 | guard item.constraints.count > 0 else { 187 | self.makeConstraints(item: item, closure: closure) 188 | return 189 | } 190 | 191 | let constraints = prepareConstraints(item: item, closure: closure) 192 | for constraint in constraints { 193 | constraint.activateIfNeeded(updatingExisting: true) 194 | } 195 | } 196 | 197 | internal static func removeConstraints(item: LayoutConstraintItem) { 198 | let constraints = item.constraints 199 | for constraint in constraints { 200 | constraint.deactivateIfNeeded() 201 | } 202 | } 203 | 204 | } 205 | -------------------------------------------------------------------------------- /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 | 77 | #if os(iOS) || os(tvOS) 78 | extension UILayoutPriority: ConstraintPriorityTarget { 79 | 80 | public var constraintPriorityTargetValue: Float { 81 | return self.rawValue 82 | } 83 | 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /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 | #if swift(>=4.2) 29 | typealias LayoutRelation = NSLayoutConstraint.Relation 30 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 31 | #else 32 | typealias LayoutRelation = NSLayoutRelation 33 | typealias LayoutAttribute = NSLayoutAttribute 34 | #endif 35 | typealias LayoutPriority = UILayoutPriority 36 | #else 37 | import AppKit 38 | typealias LayoutRelation = NSLayoutConstraint.Relation 39 | typealias LayoutAttribute = NSLayoutConstraint.Attribute 40 | typealias LayoutPriority = NSLayoutConstraint.Priority 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /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/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-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-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## SnapKit 5 | 6 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-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 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | SnapKit 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_HSPlayerFullScreenDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_HSPlayerFullScreenDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | warn_missing_arch=${2:-true} 88 | if [ -r "$source" ]; then 89 | # Copy the dSYM into the targets temp dir. 90 | 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}\"" 91 | 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}" 92 | 93 | local basename 94 | basename="$(basename -s .dSYM "$source")" 95 | binary_name="$(ls "$source/Contents/Resources/DWARF")" 96 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" 97 | 98 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 99 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 100 | strip_invalid_archs "$binary" "$warn_missing_arch" 101 | fi 102 | 103 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 104 | # Move the stripped file into its final destination. 105 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 106 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 107 | else 108 | # 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. 109 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" 110 | fi 111 | fi 112 | } 113 | 114 | # Copies the bcsymbolmap files of a vendored framework 115 | install_bcsymbolmap() { 116 | local bcsymbolmap_path="$1" 117 | local destination="${BUILT_PRODUCTS_DIR}" 118 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 119 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 120 | } 121 | 122 | # Signs a framework with the provided identity 123 | code_sign_if_enabled() { 124 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 125 | # Use the current code_sign_identity 126 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 127 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 128 | 129 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 130 | code_sign_cmd="$code_sign_cmd &" 131 | fi 132 | echo "$code_sign_cmd" 133 | eval "$code_sign_cmd" 134 | fi 135 | } 136 | 137 | # Strip invalid architectures 138 | strip_invalid_archs() { 139 | binary="$1" 140 | warn_missing_arch=${2:-true} 141 | # Get architectures for current target binary 142 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 143 | # Intersect them with the architectures we are building for 144 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 145 | # If there are no archs supported by this binary then warn the user 146 | if [[ -z "$intersected_archs" ]]; then 147 | if [[ "$warn_missing_arch" == "true" ]]; then 148 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 149 | fi 150 | STRIP_BINARY_RETVAL=0 151 | return 152 | fi 153 | stripped="" 154 | for arch in $binary_archs; do 155 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 156 | # Strip non-valid architectures in-place 157 | lipo -remove "$arch" -output "$binary" "$binary" 158 | stripped="$stripped $arch" 159 | fi 160 | done 161 | if [[ "$stripped" ]]; then 162 | echo "Stripped $binary of architectures:$stripped" 163 | fi 164 | STRIP_BINARY_RETVAL=1 165 | } 166 | 167 | install_artifact() { 168 | artifact="$1" 169 | base="$(basename "$artifact")" 170 | case $base in 171 | *.framework) 172 | install_framework "$artifact" 173 | ;; 174 | *.dSYM) 175 | # Suppress arch warnings since XCFrameworks will include many dSYM files 176 | install_dsym "$artifact" "false" 177 | ;; 178 | *.bcsymbolmap) 179 | install_bcsymbolmap "$artifact" 180 | ;; 181 | *) 182 | echo "error: Unrecognized artifact "$artifact"" 183 | ;; 184 | esac 185 | } 186 | 187 | copy_artifacts() { 188 | file_list="$1" 189 | while read artifact; do 190 | install_artifact "$artifact" 191 | done <$file_list 192 | } 193 | 194 | ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt" 195 | if [ -r "${ARTIFACT_LIST_FILE}" ]; then 196 | copy_artifacts "${ARTIFACT_LIST_FILE}" 197 | fi 198 | 199 | if [[ "$CONFIGURATION" == "Debug" ]]; then 200 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" 201 | fi 202 | if [[ "$CONFIGURATION" == "Release" ]]; then 203 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" 204 | fi 205 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 206 | wait 207 | fi 208 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo-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_HSPlayerFullScreenDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_HSPlayerFullScreenDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -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 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_HSPlayerFullScreenDemo { 2 | umbrella header "Pods-HSPlayerFullScreenDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-HSPlayerFullScreenDemo/Pods-HSPlayerFullScreenDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -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 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SnapKit/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.2.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.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /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.release.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HSPlayerFullScreenDemo 2 | 播放器旋转Demo 3 | --------------------------------------------------------------------------------