├── .gitignore ├── .swift-version ├── Cards.podspec ├── Cards ├── Dependencies │ └── Player_by_Patric_Piemonte.swift └── Sources │ ├── Animator.swift │ ├── Card.swift │ ├── CardArticle.swift │ ├── CardGroup.swift │ ├── CardGroupSliding.swift │ ├── CardHighlight.swift │ ├── CardPlayer.swift │ ├── DetailViewController.swift │ └── LayoutHelper.swift ├── Demo ├── Demo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── paolocuscela.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── Demo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Demo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── CardPlayerPlayIcon.imageset │ │ │ ├── CardPlayerPlayIcon.pdf │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── Icon.imageset │ │ │ ├── Contents.json │ │ │ └── Group 2.pdf │ │ ├── background.imageset │ │ │ ├── 265186.pdf │ │ │ └── Contents.json │ │ ├── flBackground.imageset │ │ │ ├── 725e5dc00ba49c240cd489e7b87e0496--city-background-flappy-bird.jpg │ │ │ └── Contents.json │ │ ├── flappy.imageset │ │ │ ├── Contents.json │ │ │ └── Flappy_Bird_icon.png │ │ ├── grBackground.imageset │ │ │ ├── Contents.json │ │ │ └── math_equations-wallpaper-800x480.jpg │ │ └── mvBackground.imageset │ │ │ ├── Contents.json │ │ │ └── monument_valley_5k-1920x1080.jpg │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── Main.storyboard │ ├── Storyboards │ │ └── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ ├── ViewController.swift │ └── ViewControllers │ │ ├── ArticleViewController.swift │ │ ├── CardContentViewController.swift │ │ ├── GroupViewController.swift │ │ ├── HighlightViewController.swift │ │ ├── ListTableViewController.swift │ │ └── PlayerViewController.swift ├── Podfile ├── Podfile.lock └── Pods │ ├── Local Podspecs │ └── Cards.podspec.json │ ├── Manifest.lock │ ├── Player │ ├── LICENSE │ ├── README.md │ └── Sources │ │ └── Player.swift │ ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ ├── egonzales.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── paolocuscela.xcuserdatad │ │ └── xcschemes │ │ ├── Cards.xcscheme │ │ ├── Player.xcscheme │ │ ├── Pods-Demo.xcscheme │ │ └── xcschememanagement.plist │ └── Target Support Files │ ├── Cards │ ├── Cards-dummy.m │ ├── Cards-prefix.pch │ ├── Cards-umbrella.h │ ├── Cards.modulemap │ ├── Cards.xcconfig │ └── Info.plist │ ├── Player │ ├── Info.plist │ ├── Player-dummy.m │ ├── Player-prefix.pch │ ├── Player-umbrella.h │ ├── Player.modulemap │ └── Player.xcconfig │ └── Pods-Demo │ ├── Info.plist │ ├── Pods-Demo-acknowledgements.markdown │ ├── Pods-Demo-acknowledgements.plist │ ├── Pods-Demo-dummy.m │ ├── Pods-Demo-frameworks.sh │ ├── Pods-Demo-resources.sh │ ├── Pods-Demo-umbrella.h │ ├── Pods-Demo.debug.xcconfig │ ├── Pods-Demo.modulemap │ └── Pods-Demo.release.xcconfig ├── Images ├── CardGroupSliding.gif ├── CardPlayer.gif ├── CardViewStoryboard.png ├── Customization.png ├── Delegates.png ├── DetailView.gif ├── DetailViewStoryboard.png ├── GetStarted.png ├── Header.png ├── Home Wiki.png ├── Icon.png └── OverviewWiki.png ├── LICENSE ├── README.md └── Wiki ├── Customization.md └── Installation guide.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | Pod/ 3 | *.xccheckout 4 | *.xcuserstate 5 | Images/\.DS_Store 6 | 7 | \.DS_Store 8 | 9 | Demo/Demo\.xcodeproj/xcuserdata/paolocuscela\.xcuserdatad/xcschemes/ 10 | 11 | Demo/Demo\.xcworkspace/xcuserdata/paolocuscela\.xcuserdatad/xcdebugger/ 12 | 13 | Demo/Demo\.xcodeproj/xcuserdata/ 14 | 15 | *.xcbkptlist 16 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /Cards.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'Cards' 3 | s.version = '1.4.0' 4 | s.summary = 'Awesome iOS 11 appstore cards in swift 5.' 5 | s.homepage = 'https://github.com/PaoloCuscela/Cards' 6 | s.screenshots = 'https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Header.png', 'https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/DetailView.gif' 7 | s.license = { :type => 'MIT', :file => 'LICENSE' } 8 | s.author = { 'Paolo Cuscela' => 'cuscio.2@gmail.com'} 9 | s.source = { :git => 'https://github.com/PaoloCuscela/Cards.git', :tag => s.version.to_s } 10 | 11 | s.ios.deployment_target = '9.0' 12 | s.source_files = 'Cards/Sources/*' 13 | s.frameworks = 'UIKit' 14 | s.dependency 'Player', '0.13.0' 15 | end 16 | -------------------------------------------------------------------------------- /Cards/Sources/Animator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Animator.swift 3 | // Cards 4 | // 5 | // Created by Paolo Cuscela on 23/10/17. 6 | // 7 | 8 | import UIKit 9 | 10 | class Animator: NSObject, UIViewControllerAnimatedTransitioning { 11 | 12 | 13 | fileprivate var presenting: Bool 14 | fileprivate var velocity = 0.6 15 | var bounceIntensity: CGFloat = 0.07 16 | var card: Card 17 | 18 | init(presenting: Bool, from card: Card) { 19 | self.presenting = presenting 20 | self.card = card 21 | super.init() 22 | } 23 | 24 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 25 | 26 | // Animation Context Setup 27 | let container = transitionContext.containerView 28 | let to = transitionContext.viewController(forKey: .to)! 29 | let from = transitionContext.viewController(forKey: .from)! 30 | container.addSubview(to.view) 31 | container.addSubview(from.view) 32 | 33 | guard presenting else { 34 | // Detail View Controller Dismiss Animations 35 | card.log("ANIMATOR>> Begin dismiss transition.") 36 | card.isPresenting = false 37 | 38 | let detailVC = from as! DetailViewController 39 | let cardBackgroundFrame = detailVC.scrollView.convert(card.backgroundIV.frame, to: nil) 40 | let bounce = self.bounceTransform(cardBackgroundFrame, to: card.originalFrame) 41 | 42 | // Blur and fade with completion 43 | UIView.animate(withDuration: velocity, delay: 0, options: .curveEaseOut, animations: { 44 | 45 | detailVC.blurView.alpha = 0 46 | detailVC.snap.alpha = 0 47 | self.card.backgroundIV.layer.cornerRadius = self.card.cardRadius 48 | 49 | }, completion: { _ in 50 | 51 | detailVC.layout(self.card.originalFrame, isPresenting: false, isAnimating: false) 52 | self.card.addSubview(detailVC.card.backgroundIV) 53 | transitionContext.completeTransition(true) 54 | }) 55 | 56 | // Layout with bounce effect 57 | let originalFrame = card.originalFrame 58 | UIView.animate(withDuration: velocity/2, delay: 0, options: .curveEaseOut, animations: { 59 | 60 | detailVC.layout(originalFrame, isPresenting: false, transform: bounce) 61 | self.card.delegate?.cardIsHidingDetail?(card: self.card) 62 | 63 | }) { _ in UIView.animate(withDuration: self.velocity/2, delay: 0, options: .curveEaseOut, animations: { 64 | 65 | detailVC.layout(originalFrame, isPresenting: false) 66 | self.card.delegate?.cardIsHidingDetail?(card: self.card) 67 | }) 68 | } 69 | return 70 | 71 | } 72 | 73 | // Detail View Controller Present Animations 74 | card.log("ANIMATOR>> Begin present transition.") 75 | card.isPresenting = true 76 | 77 | let detailVC = to as! DetailViewController 78 | let bounceOffset = self.bounceTransform(card.originalFrame, to: card.backgroundIV.frame) 79 | container.bringSubviewToFront(detailVC.view) 80 | detailVC.card = card 81 | 82 | self.card.delegate?.cardIsShowingDetail?(card: self.card) 83 | 84 | // This code should actually be executed outside the animation but idk why this first animation is executed and skipped ( even with 'duration' setted up ) 85 | UIView.animate(withDuration: 0, delay: 0, options: .curveEaseIn, animations: { 86 | // Setting detail VC in dismissed mode (VC frame = card frame) 87 | detailVC.layout(self.card.originalFrame, isPresenting: false) 88 | 89 | }, completion: { finished in UIView.animate(withDuration: self.velocity/2, delay: 0, options: .curveEaseIn, animations: { 90 | detailVC.blurView.alpha = 1 91 | detailVC.snap.alpha = 1 92 | detailVC.layout(detailVC.view.frame, isPresenting: true, transform: bounceOffset) 93 | 94 | }, completion: { (_) in UIView.animate(withDuration: self.velocity/2, delay: 0, options: .curveEaseIn, animations: { 95 | detailVC.layout(detailVC.view.frame, isPresenting: true) 96 | 97 | }, completion: { (_) in 98 | detailVC.layout(detailVC.view.frame, isPresenting: true) 99 | transitionContext.completeTransition(true) 100 | 101 | }) 102 | }) 103 | }) 104 | 105 | 106 | } 107 | 108 | private func bounceTransform(_ from: CGRect, to: CGRect ) -> CGAffineTransform { 109 | 110 | let old = from.center 111 | let new = to.center 112 | 113 | let xDistance = old.x - new.x 114 | let yDistance = old.y - new.y 115 | 116 | let xMove = -( xDistance * bounceIntensity ) 117 | let yMove = -( yDistance * bounceIntensity ) 118 | 119 | return CGAffineTransform(translationX: xMove, y: yMove) 120 | } 121 | 122 | 123 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 124 | return velocity 125 | } 126 | 127 | } 128 | 129 | 130 | -------------------------------------------------------------------------------- /Cards/Sources/Card.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Card.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 09/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | //TODO: - Risolvere il problema del layout dopo l' animazione passando il backgroundIV al detailVC 10 | //TODO: - Trovare il frame originario relativo alla view del VC della card ( in una table ) 11 | 12 | import UIKit 13 | 14 | @objc public protocol CardDelegate { 15 | 16 | @objc optional func cardDidTapInside(card: Card) 17 | @objc optional func cardWillShowDetailView(card: Card) 18 | @objc optional func cardDidShowDetailView(card: Card) 19 | @objc optional func cardWillCloseDetailView(card: Card) 20 | @objc optional func cardDidCloseDetailView(card: Card) 21 | @objc optional func cardIsShowingDetail(card: Card) 22 | @objc optional func cardIsHidingDetail(card: Card) 23 | @objc optional func cardDetailIsScrolling(card: Card) 24 | 25 | @objc optional func cardHighlightDidTapButton(card: CardHighlight, button: UIButton) 26 | @objc optional func cardPlayerDidPlay(card: CardPlayer) 27 | @objc optional func cardPlayerDidPause(card: CardPlayer) 28 | } 29 | 30 | @IBDesignable open class Card: UIView, CardDelegate { 31 | 32 | // Storyboard Inspectable vars 33 | /** 34 | Color for the card's labels. 35 | */ 36 | @IBInspectable public var textColor: UIColor = UIColor.black 37 | /** 38 | Amount of blur for the card's shadow. 39 | */ 40 | @IBInspectable public var shadowBlur: CGFloat = 14 { 41 | didSet{ 42 | self.layer.shadowRadius = shadowBlur 43 | } 44 | } 45 | /** 46 | Alpha of the card's shadow. 47 | */ 48 | @IBInspectable public var shadowOpacity: Float = 0.6 { 49 | didSet{ 50 | self.layer.shadowOpacity = shadowOpacity 51 | } 52 | } 53 | /** 54 | Color of the card's shadow. 55 | */ 56 | @IBInspectable public var shadowColor: UIColor = UIColor.gray { 57 | didSet{ 58 | self.layer.shadowColor = shadowColor.cgColor 59 | } 60 | } 61 | /** 62 | The image to display in the background. 63 | */ 64 | @IBInspectable public var backgroundImage: UIImage? { 65 | didSet{ 66 | self.backgroundIV.image = backgroundImage 67 | } 68 | } 69 | /** 70 | Corner radius of the card. 71 | */ 72 | @IBInspectable public var cardRadius: CGFloat = 20{ 73 | didSet{ 74 | self.layer.cornerRadius = cardRadius 75 | } 76 | } 77 | /** 78 | Insets between card's content and edges ( in percentage ) 79 | */ 80 | @IBInspectable public var contentInset: CGFloat = 6 { 81 | didSet { 82 | insets = LayoutHelper(rect: frame).X(contentInset) 83 | } 84 | } 85 | /** 86 | Color of the card's background. 87 | */ 88 | override open var backgroundColor: UIColor? { 89 | didSet(new) { 90 | if let color = new { backgroundIV.backgroundColor = color } 91 | if backgroundColor != UIColor.clear { backgroundColor = UIColor.clear } 92 | } 93 | } 94 | /** 95 | contentViewController -> The view controller to present when the card is tapped 96 | from -> Your current ViewController (self) 97 | */ 98 | public func shouldPresent( _ contentViewController: UIViewController?, from superVC: UIViewController?, fullscreen: Bool = false) { 99 | if detailVC.children.count > 0{ 100 | let viewControllers:[UIViewController] = detailVC.children 101 | for viewContoller in viewControllers{ 102 | viewContoller.willMove(toParent: nil) 103 | viewContoller.view.removeFromSuperview() 104 | viewContoller.removeFromParent() 105 | } 106 | } 107 | detailVC.isViewAdded = false 108 | if let content = contentViewController{ 109 | self.superVC = superVC 110 | detailVC.addChild(content) 111 | detailVC.detailView = content.view 112 | detailVC.card = self 113 | detailVC.delegate = self.delegate 114 | detailVC.isFullscreen = fullscreen 115 | } 116 | } 117 | /** 118 | If the card should display parallax effect. 119 | */ 120 | public var hasParallax: Bool = true { 121 | didSet { 122 | if self.motionEffects.isEmpty && hasParallax { goParallax() } 123 | else if !hasParallax && !motionEffects.isEmpty { motionEffects.removeAll() } 124 | } 125 | } 126 | /** 127 | If the card should print debug logs. 128 | */ 129 | public var isDebug: Bool = false 130 | /** 131 | Delegate for the card. Should extend your VC with CardDelegate. 132 | */ 133 | public var delegate: CardDelegate? 134 | 135 | //Private Vars 136 | fileprivate var tap = UITapGestureRecognizer() 137 | var detailVC = DetailViewController() 138 | weak var superVC: UIViewController? 139 | var originalFrame = CGRect.zero 140 | public var backgroundIV = UIImageView() 141 | public var insets = CGFloat() 142 | var isPresenting = false 143 | 144 | //MARK: - View Life Cycle 145 | 146 | public override init(frame: CGRect) { 147 | super.init(frame: frame) 148 | initialize() 149 | } 150 | 151 | public required init?(coder aDecoder: NSCoder) { 152 | super.init(coder: aDecoder) 153 | initialize() 154 | } 155 | 156 | open func initialize() { 157 | log("CARD: Initializing Card") 158 | 159 | // Tap gesture init 160 | self.addGestureRecognizer(tap) 161 | tap.delegate = self 162 | tap.cancelsTouchesInView = false 163 | 164 | detailVC.transitioningDelegate = self 165 | 166 | // Adding Subviews 167 | self.addSubview(backgroundIV) 168 | 169 | backgroundIV.isUserInteractionEnabled = true 170 | 171 | if backgroundIV.backgroundColor == nil { 172 | backgroundIV.backgroundColor = UIColor.white 173 | super.backgroundColor = UIColor.clear 174 | } 175 | } 176 | 177 | override open func draw(_ rect: CGRect) { 178 | super.draw(rect) 179 | 180 | self.layer.shadowOpacity = shadowOpacity 181 | self.layer.shadowColor = shadowColor.cgColor 182 | self.layer.shadowOffset = CGSize.zero 183 | self.layer.shadowRadius = shadowBlur 184 | self.layer.cornerRadius = cardRadius 185 | 186 | backgroundIV.image = backgroundImage 187 | backgroundIV.layer.cornerRadius = self.layer.cornerRadius 188 | backgroundIV.clipsToBounds = true 189 | backgroundIV.contentMode = .scaleAspectFill 190 | 191 | backgroundIV.frame.origin = bounds.origin 192 | backgroundIV.frame.size = CGSize(width: bounds.width, height: bounds.height) 193 | contentInset = 6 194 | } 195 | 196 | /** 197 | Opens the card if detail view is set. 198 | */ 199 | open func open(){ 200 | if let superview = self.superview { 201 | originalFrame = superview.convert(self.frame, to: nil) 202 | log("CARD: open() called, setting original frame to ---> \(originalFrame)" ) 203 | } 204 | shrinkAnimated() 205 | self.cardTapped() 206 | } 207 | 208 | //MARK: - Layout 209 | 210 | open func layout(animating: Bool = true){ } 211 | 212 | 213 | //MARK: - Actions 214 | 215 | @objc func cardTapped() { 216 | self.delegate?.cardDidTapInside?(card: self) 217 | resetAnimated() 218 | 219 | if let vc = superVC { 220 | log("CARD: Card tapped, Presenting DetailViewController") 221 | vc.present(self.detailVC, animated: true, completion: nil) 222 | } 223 | } 224 | 225 | 226 | //MARK: - Animations 227 | 228 | private func shrinkAnimated() { 229 | 230 | UIView.animate(withDuration: 0.2, animations: { self.transform = CGAffineTransform(scaleX: 0.95, y: 0.95) }) 231 | } 232 | 233 | private func resetAnimated() { 234 | 235 | UIView.animate(withDuration: 0.2, animations: { self.transform = CGAffineTransform.identity }) 236 | } 237 | 238 | func goParallax() { 239 | let amount = 20 240 | 241 | let horizontal = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis) 242 | horizontal.minimumRelativeValue = -amount 243 | horizontal.maximumRelativeValue = amount 244 | 245 | let vertical = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis) 246 | vertical.minimumRelativeValue = -amount 247 | vertical.maximumRelativeValue = amount 248 | 249 | let group = UIMotionEffectGroup() 250 | group.motionEffects = [horizontal, vertical] 251 | self.addMotionEffect(group) 252 | } 253 | 254 | } 255 | 256 | 257 | //MARK: - Transition Delegate 258 | 259 | extension Card: UIViewControllerTransitioningDelegate { 260 | 261 | public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { 262 | return Animator(presenting: true, from: self) 263 | } 264 | 265 | public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { 266 | return Animator(presenting: false, from: self) 267 | } 268 | 269 | } 270 | 271 | //MARK: - Gesture Delegate 272 | 273 | extension Card: UIGestureRecognizerDelegate { 274 | 275 | open override func touchesEnded(_ touches: Set, with event: UIEvent?) { 276 | cardTapped() 277 | } 278 | 279 | open override func touchesCancelled(_ touches: Set, with event: UIEvent?) { 280 | resetAnimated() 281 | } 282 | 283 | override open func touchesBegan(_ touches: Set, with event: UIEvent?) { 284 | 285 | if let superview = self.superview { 286 | originalFrame = superview.convert(self.frame, to: nil) 287 | log("CARD: Card's touch began, setting original frame to ---> \(originalFrame)" ) 288 | } 289 | shrinkAnimated() 290 | } 291 | } 292 | 293 | 294 | //MARK: - Helpers 295 | 296 | extension Card { 297 | 298 | public func log(_ message: String){ 299 | if self.isDebug { print(message) } 300 | } 301 | 302 | } 303 | 304 | extension UILabel { 305 | 306 | func lineHeight(_ height: CGFloat) { 307 | 308 | let attributedString = NSMutableAttributedString(string: self.text!) 309 | let paragraphStyle = NSMutableParagraphStyle() 310 | paragraphStyle.lineHeightMultiple = height 311 | attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value:paragraphStyle, range:NSMakeRange(0, attributedString.length)) 312 | self.attributedText = attributedString 313 | } 314 | 315 | } 316 | -------------------------------------------------------------------------------- /Cards/Sources/CardArticle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CardArticle.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 08/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable open class CardArticle: Card { 12 | 13 | // SB Vars 14 | /** 15 | Text of the title label. 16 | */ 17 | @IBInspectable public var title: String = "The Art of the Impossible" { 18 | didSet{ 19 | titleLbl.text = title 20 | } 21 | } 22 | /** 23 | Max font size the title label. 24 | */ 25 | @IBInspectable public var titleSize: CGFloat = 26 26 | /** 27 | Text of the subtitle label. 28 | */ 29 | @IBInspectable public var subtitle: String = "Inside the extraordinary world of Monument Valley 2" { 30 | didSet{ 31 | subtitleLbl.text = subtitle 32 | } 33 | } 34 | /** 35 | Max font size the subtitle label. 36 | */ 37 | @IBInspectable public var subtitleSize: CGFloat = 17 38 | /** 39 | Text of the category label. 40 | */ 41 | @IBInspectable public var category: String = "world premiere" { 42 | didSet{ 43 | categoryLbl.text = category.uppercased() 44 | } 45 | } 46 | 47 | //Priv Vars 48 | var titleLbl = UILabel () 49 | var subtitleLbl = UILabel() 50 | var categoryLbl = UILabel() 51 | 52 | // View Life Cycle 53 | override public init(frame: CGRect) { 54 | super.init(frame: frame) 55 | initialize() 56 | } 57 | required public init?(coder aDecoder: NSCoder) { 58 | super.init(coder: aDecoder) 59 | initialize() 60 | } 61 | 62 | override open func initialize() { 63 | super.initialize() 64 | 65 | backgroundIV.addSubview(titleLbl) 66 | backgroundIV.addSubview(subtitleLbl) 67 | backgroundIV.addSubview(categoryLbl) 68 | } 69 | 70 | 71 | override open func draw(_ rect: CGRect) { 72 | 73 | //Draw 74 | super.draw(rect) 75 | 76 | categoryLbl.text = category.uppercased() 77 | categoryLbl.textColor = textColor.withAlphaComponent(0.3) 78 | categoryLbl.font = UIFont.systemFont(ofSize: 100, weight: .bold) 79 | categoryLbl.shadowColor = UIColor.black 80 | categoryLbl.shadowOffset = CGSize.zero 81 | categoryLbl.adjustsFontSizeToFitWidth = true 82 | categoryLbl.minimumScaleFactor = 0.1 83 | categoryLbl.lineBreakMode = .byTruncatingTail 84 | categoryLbl.numberOfLines = 0 85 | 86 | titleLbl.textColor = textColor 87 | titleLbl.text = title 88 | titleLbl.font = UIFont.systemFont(ofSize: titleSize, weight: .bold) 89 | titleLbl.adjustsFontSizeToFitWidth = true 90 | titleLbl.minimumScaleFactor = 0.1 91 | titleLbl.lineBreakMode = .byClipping 92 | titleLbl.numberOfLines = 2 93 | titleLbl.baselineAdjustment = .none 94 | 95 | subtitleLbl.text = subtitle 96 | subtitleLbl.textColor = textColor 97 | subtitleLbl.font = UIFont.systemFont(ofSize: subtitleSize, weight: .medium) 98 | subtitleLbl.shadowColor = UIColor.black 99 | subtitleLbl.shadowOffset = CGSize.zero 100 | subtitleLbl.adjustsFontSizeToFitWidth = true 101 | subtitleLbl.minimumScaleFactor = 0.1 102 | subtitleLbl.lineBreakMode = .byTruncatingTail 103 | subtitleLbl.numberOfLines = 0 104 | subtitleLbl.textAlignment = .left 105 | 106 | self.layout() 107 | 108 | } 109 | 110 | override open func layout(animating: Bool = true) { 111 | super.layout(animating: animating) 112 | 113 | let gimme = LayoutHelper(rect: backgroundIV.bounds) 114 | 115 | categoryLbl.frame = CGRect(x: insets, 116 | y: insets, 117 | width: gimme.X(80), 118 | height: gimme.Y(7)) 119 | 120 | titleLbl.frame = CGRect(x: insets, 121 | y: gimme.Y(1, from: categoryLbl), 122 | width: gimme.X(80), 123 | height: gimme.Y(17)) 124 | 125 | subtitleLbl.frame = CGRect(x: insets, 126 | y: gimme.RevY(0, height: gimme.Y(14)) - insets, 127 | width: gimme.X(80), 128 | height: gimme.Y(14)) 129 | titleLbl.sizeToFit() 130 | } 131 | 132 | } 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Cards/Sources/CardGroup.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CardGroup.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 08/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable open class CardGroup: Card { 12 | 13 | // SB Vars 14 | /** 15 | Text of the title label. 16 | */ 17 | @IBInspectable public var title: String = "Welcome to XI Cards !" { 18 | didSet{ 19 | titleLbl.text = title 20 | } 21 | } 22 | /** 23 | Max font size the title label. 24 | */ 25 | @IBInspectable public var titleSize: CGFloat = 26 26 | /** 27 | Text of the subtitle label. 28 | */ 29 | @IBInspectable public var subtitle: String = "from the editors" { 30 | didSet{ 31 | subtitleLbl.text = subtitle.uppercased() 32 | } 33 | } 34 | /** 35 | Max font size the subtitle label. 36 | */ 37 | @IBInspectable public var subtitleSize: CGFloat = 26 38 | /** 39 | Style for the blur effect. 40 | */ 41 | @IBInspectable public var blurEffect: UIBlurEffect.Style = .extraLight { 42 | didSet{ 43 | blurV.effect = UIBlurEffect(style: blurEffect) 44 | } 45 | } 46 | 47 | //Priv Vars 48 | var subtitleLbl = UILabel () 49 | var titleLbl = UILabel() 50 | var blurV = UIVisualEffectView() 51 | var vibrancyV = UIVisualEffectView() 52 | 53 | // View Life Cycle 54 | override public init(frame: CGRect) { 55 | super.init(frame: frame) 56 | initialize() 57 | } 58 | 59 | required public init?(coder aDecoder: NSCoder) { 60 | super.init(coder: aDecoder) 61 | initialize() 62 | } 63 | 64 | override open func initialize() { 65 | super.initialize() 66 | 67 | vibrancyV = UIVisualEffectView(effect: UIVibrancyEffect(blurEffect: UIBlurEffect(style: blurEffect))) 68 | backgroundIV.addSubview(blurV) 69 | blurV.contentView.addSubview(titleLbl) 70 | blurV.contentView.addSubview(vibrancyV) 71 | vibrancyV.contentView.addSubview(subtitleLbl) 72 | 73 | } 74 | 75 | override open func draw(_ rect: CGRect) { 76 | 77 | //Draw 78 | super.draw(rect) 79 | 80 | subtitleLbl.text = subtitle.uppercased() 81 | subtitleLbl.textColor = textColor 82 | subtitleLbl.font = UIFont.systemFont(ofSize: subtitleSize, weight: .semibold) 83 | subtitleLbl.adjustsFontSizeToFitWidth = true 84 | subtitleLbl.minimumScaleFactor = 0.1 85 | subtitleLbl.lineBreakMode = .byTruncatingTail 86 | subtitleLbl.numberOfLines = 0 87 | 88 | titleLbl.textColor = textColor 89 | titleLbl.text = title 90 | titleLbl.font = UIFont.systemFont(ofSize: titleSize, weight: .bold) 91 | titleLbl.adjustsFontSizeToFitWidth = true 92 | titleLbl.minimumScaleFactor = 0.1 93 | titleLbl.lineBreakMode = .byTruncatingTail 94 | titleLbl.numberOfLines = 2 95 | 96 | let blur = UIBlurEffect(style: blurEffect) 97 | blurV.effect = blur 98 | 99 | layout() 100 | } 101 | 102 | override open func layout(animating: Bool = true) { 103 | super.layout(animating: animating) 104 | 105 | let gimme = LayoutHelper(rect: backgroundIV.bounds) 106 | 107 | blurV.frame = CGRect(x: 0, 108 | y: 0, 109 | width: backgroundIV.bounds.width, 110 | height: gimme.Y(42)) 111 | 112 | vibrancyV.frame = blurV.frame 113 | 114 | 115 | subtitleLbl.frame = CGRect(x: insets, 116 | y: insets, 117 | width: gimme.X(80), 118 | height: gimme.Y(6)) 119 | 120 | titleLbl.frame = CGRect(x: insets, 121 | y: gimme.Y(0, from: subtitleLbl), 122 | width: gimme.X(80), 123 | height: gimme.Y(20)) 124 | titleLbl.sizeToFit() 125 | } 126 | 127 | } 128 | 129 | 130 | -------------------------------------------------------------------------------- /Cards/Sources/CardGroupSliding.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CardGroupSliding.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 08/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | import Foundation 9 | import UIKit 10 | 11 | @IBDesignable open class CardGroupSliding: CardGroup { 12 | 13 | /** 14 | Size for the collection view items. 15 | */ 16 | @IBInspectable public var iconsSize: CGFloat = 80 { 17 | didSet{ 18 | slidingCV.reloadData() 19 | } 20 | } 21 | /** 22 | Corner radius of the collection view items 23 | */ 24 | @IBInspectable public var iconsRadius: CGFloat = 40 { 25 | didSet{ 26 | slidingCV.reloadData() 27 | } 28 | } 29 | 30 | /** 31 | Data source for the collection view. 32 | */ 33 | public var icons: [UIImage]? 34 | 35 | // Priv vars 36 | fileprivate final let CellID = "SlidingCVCell" 37 | fileprivate var slidingCV: UICollectionView! 38 | fileprivate var timer = Timer() 39 | fileprivate var w: CGFloat = 0 40 | fileprivate var layout = UICollectionViewFlowLayout() 41 | 42 | override public init(frame: CGRect) { 43 | super.init(frame: frame) 44 | initialize() 45 | } 46 | 47 | required public init?(coder aDecoder: NSCoder) { 48 | super.init(coder: aDecoder) 49 | initialize() 50 | } 51 | 52 | override open func initialize() { 53 | super.initialize() 54 | 55 | self.delegate = self 56 | 57 | layout.scrollDirection = .horizontal 58 | slidingCV = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) 59 | slidingCV.register(SlidingCVCell.self, forCellWithReuseIdentifier: CellID) 60 | slidingCV.delegate = self 61 | slidingCV.dataSource = self 62 | slidingCV.backgroundColor = UIColor.clear 63 | slidingCV.isUserInteractionEnabled = false 64 | 65 | backgroundIV.addSubview(subtitleLbl) 66 | backgroundIV.addSubview(titleLbl) 67 | backgroundIV.addSubview(slidingCV) 68 | blurV.removeFromSuperview() 69 | 70 | backgroundIV.backgroundColor = UIColor.white 71 | 72 | startSlide() 73 | } 74 | 75 | override open func draw(_ rect: CGRect) { 76 | super.draw(rect) 77 | 78 | subtitleLbl.textColor = textColor.withAlphaComponent(0.4) 79 | layout(animating: false) 80 | } 81 | 82 | override open func layout(animating: Bool) { 83 | super.layout(animating: animating) 84 | 85 | let gimme = LayoutHelper(rect: backgroundIV.bounds) 86 | 87 | slidingCV.frame = CGRect(x: 0, 88 | y: gimme.Y(5, from: titleLbl), 89 | width: backgroundIV.frame.width, 90 | height: backgroundIV.bounds.height - blurV.frame.height ) 91 | } 92 | 93 | //MARK: - Sliding Logic 94 | 95 | public func startSlide() { 96 | timer = Timer.scheduledTimer(timeInterval: 0.04, target: self, selector: #selector(self.slide), userInfo: nil, repeats: true) 97 | } 98 | 99 | public func stopSlide() { 100 | timer.invalidate() 101 | } 102 | 103 | private func onTimer(){ slide() } 104 | 105 | @objc private func slide(){ 106 | let startPoint = CGPoint(x: w, y: 0) 107 | if __CGPointEqualToPoint(startPoint, slidingCV.contentOffset) { 108 | 109 | if w Int { 125 | if icons?.count != nil { return 10000 } 126 | else { return 0 } 127 | } 128 | 129 | public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{ 130 | 131 | let icon = icons?[indexPath.row % icons!.count] 132 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellID, for: indexPath) as! SlidingCVCell 133 | cell.radius = cell.frame.height/2 134 | cell.icon = icon 135 | return cell 136 | 137 | } 138 | 139 | } 140 | 141 | extension CardGroupSliding: UICollectionViewDelegateFlowLayout{ 142 | 143 | public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 144 | 145 | iconsSize = collectionView.frame.height/3 - layout.minimumLineSpacing 146 | return CGSize(width: iconsSize, height: iconsSize ) 147 | } 148 | } 149 | 150 | 151 | open class SlidingCVCell: UICollectionViewCell { 152 | 153 | public var icon = UIImage(named: "math") 154 | public var iconIV = UIImageView() 155 | public var radius: CGFloat? 156 | 157 | override public init(frame: CGRect) { 158 | super.init(frame: frame) 159 | self.addSubview(iconIV) 160 | self.backgroundColor = UIColor.clear 161 | self.layer.backgroundColor = UIColor.lightGray.cgColor 162 | 163 | } 164 | 165 | required public init?(coder aDecoder: NSCoder) { 166 | super.init(coder: aDecoder) 167 | } 168 | 169 | override open func draw(_ rect: CGRect) { 170 | super.draw(rect) 171 | 172 | self.layer.cornerRadius = radius ?? 15 173 | iconIV.image = icon 174 | iconIV.frame = CGRect(x: 0, y: 0, width: rect.width, height: rect.width) 175 | iconIV.layer.cornerRadius = radius ?? 15 176 | iconIV.clipsToBounds = true 177 | iconIV.contentMode = .scaleAspectFill 178 | } 179 | } 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /Cards/Sources/CardHighlight.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CardHighlight.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 07/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable open class CardHighlight: Card { 12 | 13 | /** 14 | Text of the title label. 15 | */ 16 | @IBInspectable public var title: String = "welcome \nto \ncards !" { 17 | didSet{ 18 | titleLbl.text = title.uppercased() 19 | titleLbl.lineHeight(0.70) 20 | } 21 | } 22 | /** 23 | Max font size the title label. 24 | */ 25 | @IBInspectable public var titleSize:CGFloat = 26 26 | /** 27 | Text of the title label of the item at the bottom. 28 | */ 29 | @IBInspectable public var itemTitle: String = "Flappy Bird" { 30 | didSet{ 31 | itemTitleLbl.text = itemTitle 32 | } 33 | } 34 | /** 35 | Max font size the subtitle label of the item at the bottom. 36 | */ 37 | @IBInspectable public var itemTitleSize: CGFloat = 16 38 | /** 39 | Text of the subtitle label of the item at the bottom. 40 | */ 41 | @IBInspectable public var itemSubtitle: String = "Flap that !" { 42 | didSet{ 43 | itemSubtitleLbl.text = itemSubtitle 44 | } 45 | } 46 | /** 47 | Max font size the subtitle label of the item at the bottom. 48 | */ 49 | @IBInspectable public var itemSubtitleSize: CGFloat = 14 50 | /** 51 | Image displayed in the icon ImageView. 52 | */ 53 | @IBInspectable public var icon: UIImage? { 54 | didSet{ 55 | iconIV.image = icon 56 | bgIconIV.image = icon 57 | } 58 | } 59 | /** 60 | Corner radius for the icon ImageView 61 | */ 62 | @IBInspectable public var iconRadius: CGFloat = 16 { 63 | didSet{ 64 | iconIV.layer.cornerRadius = iconRadius 65 | bgIconIV.layer.cornerRadius = iconRadius*2 66 | } 67 | } 68 | /** 69 | Text for the card's button. 70 | Set to [nil] or "" to hide the button. 71 | */ 72 | @IBInspectable public var buttonText: String? = "view" { 73 | didSet{ 74 | self.actionBtn.isHidden = (buttonText == nil || buttonText!.isEmpty) 75 | self.setNeedsDisplay() 76 | } 77 | } 78 | 79 | //Priv Vars 80 | private var iconIV = UIImageView() 81 | private var actionBtn = UIButton() 82 | private var titleLbl = UILabel () 83 | private var itemTitleLbl = UILabel() 84 | private var itemSubtitleLbl = UILabel() 85 | private var lightColor = UIColor(red: 239/255, green: 239/255, blue: 244/255, alpha: 1) 86 | private var bgIconIV = UIImageView() 87 | 88 | fileprivate var btnWidth = CGFloat() 89 | 90 | // View Life Cycle 91 | override public init(frame: CGRect) { 92 | super.init(frame: frame) 93 | initialize() 94 | } 95 | 96 | required public init?(coder aDecoder: NSCoder) { 97 | super.init(coder: aDecoder) 98 | initialize() 99 | } 100 | 101 | override open func initialize() { 102 | super.initialize() 103 | 104 | actionBtn.addTarget(self, action: #selector(buttonTapped), for: UIControl.Event.touchUpInside) 105 | 106 | backgroundIV.addSubview(iconIV) 107 | backgroundIV.addSubview(titleLbl) 108 | backgroundIV.addSubview(itemTitleLbl) 109 | backgroundIV.addSubview(itemSubtitleLbl) 110 | backgroundIV.addSubview(actionBtn) 111 | 112 | if backgroundImage == nil { backgroundIV.addSubview(bgIconIV); } 113 | else { bgIconIV.alpha = 0 } 114 | } 115 | 116 | 117 | override open func draw(_ rect: CGRect) { 118 | super.draw(rect) 119 | 120 | //Draw 121 | bgIconIV.image = icon 122 | bgIconIV.alpha = backgroundImage != nil ? 0 : 0.6 123 | bgIconIV.clipsToBounds = true 124 | 125 | iconIV.image = icon 126 | iconIV.clipsToBounds = true 127 | 128 | titleLbl.text = title.uppercased() 129 | titleLbl.textColor = textColor 130 | titleLbl.font = UIFont.systemFont(ofSize: titleSize, weight: .heavy) 131 | titleLbl.adjustsFontSizeToFitWidth = true 132 | titleLbl.lineHeight(0.70) 133 | titleLbl.minimumScaleFactor = 0.1 134 | titleLbl.lineBreakMode = .byTruncatingTail 135 | titleLbl.numberOfLines = 3 136 | backgroundIV.bringSubviewToFront(titleLbl) 137 | 138 | itemTitleLbl.textColor = textColor 139 | itemTitleLbl.text = itemTitle 140 | itemTitleLbl.font = UIFont.boldSystemFont(ofSize: itemTitleSize) 141 | itemTitleLbl.adjustsFontSizeToFitWidth = true 142 | itemTitleLbl.minimumScaleFactor = 0.1 143 | itemTitleLbl.lineBreakMode = .byTruncatingTail 144 | itemTitleLbl.numberOfLines = 0 145 | 146 | itemSubtitleLbl.textColor = textColor 147 | itemSubtitleLbl.text = itemSubtitle 148 | itemSubtitleLbl.font = UIFont.systemFont(ofSize: itemSubtitleSize) 149 | itemSubtitleLbl.adjustsFontSizeToFitWidth = true 150 | itemSubtitleLbl.minimumScaleFactor = 0.1 151 | itemSubtitleLbl.lineBreakMode = .byTruncatingTail 152 | itemSubtitleLbl.numberOfLines = 2 153 | itemSubtitleLbl.sizeToFit() 154 | 155 | actionBtn.backgroundColor = UIColor.clear 156 | actionBtn.layer.backgroundColor = lightColor.cgColor 157 | actionBtn.clipsToBounds = true 158 | if self.buttonText != nil { 159 | let btnTitle = NSAttributedString(string: buttonText!.uppercased(), attributes: [ NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16, weight: .black), NSAttributedString.Key.foregroundColor : self.tintColor ?? UIColor.black]) 160 | actionBtn.setAttributedTitle(btnTitle, for: .normal) 161 | btnWidth = CGFloat((buttonText!.count + 2) * 10) 162 | } 163 | 164 | 165 | layout() 166 | 167 | } 168 | 169 | override open func layout(animating: Bool = true) { 170 | super.layout(animating: animating) 171 | 172 | let gimme = LayoutHelper(rect: backgroundIV.frame) 173 | 174 | iconIV.frame = CGRect(x: insets, 175 | y: insets, 176 | width: gimme.Y(25), 177 | height: gimme.Y(25)) 178 | 179 | titleLbl.frame.origin = CGPoint(x: insets, y: gimme.Y(5, from: iconIV)) 180 | titleLbl.frame.size.width = (frame.width * 0.65) + ((backgroundIV.bounds.width - frame.width)/3) 181 | titleLbl.frame.size.height = gimme.Y(35) 182 | 183 | itemSubtitleLbl.sizeToFit() 184 | itemSubtitleLbl.frame.origin = CGPoint(x: insets, y: gimme.RevY(0, height: itemSubtitleLbl.bounds.size.height) - insets) 185 | 186 | itemTitleLbl.frame = CGRect(x: insets, 187 | y: gimme.RevY(0, height: gimme.Y(9), from: itemSubtitleLbl), 188 | width: gimme.X(80) - btnWidth, 189 | height: gimme.Y(9)) 190 | 191 | bgIconIV.transform = CGAffineTransform.identity 192 | 193 | 194 | iconIV.layer.cornerRadius = iconRadius 195 | 196 | bgIconIV.frame.size = CGSize(width: iconIV.bounds.width * 2, height: iconIV.bounds.width * 2) 197 | bgIconIV.frame.origin = CGPoint(x: gimme.RevX(0, width: bgIconIV.frame.width) + LayoutHelper.Width(40, of: bgIconIV) , y: 0) 198 | 199 | 200 | bgIconIV.transform = CGAffineTransform(rotationAngle: CGFloat(-Double.pi/6)) 201 | bgIconIV.layer.cornerRadius = iconRadius * 2 202 | 203 | actionBtn.frame = CGRect(x: gimme.RevX(0, width: btnWidth) - insets, 204 | y: gimme.RevY(0, height: 32) - insets, 205 | width: btnWidth, 206 | height: 32) 207 | actionBtn.layer.cornerRadius = actionBtn.layer.bounds.height/2 208 | } 209 | 210 | //Actions 211 | 212 | @objc func buttonTapped(){ 213 | UIView.animate(withDuration: 0.2, animations: { 214 | self.actionBtn.transform = CGAffineTransform(scaleX: 0.90, y: 0.90) 215 | }) { _ in 216 | UIView.animate(withDuration: 0.1, animations: { 217 | self.actionBtn.transform = CGAffineTransform.identity 218 | }) 219 | } 220 | delegate?.cardHighlightDidTapButton?(card: self, button: actionBtn) 221 | } 222 | } 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /Cards/Sources/CardPlayer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CardPlayer.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 12/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import Player 12 | 13 | @IBDesignable open class CardPlayer: Card { 14 | 15 | /** 16 | Text of the title label. 17 | */ 18 | @IBInspectable public var title: String = "Big Buck Bunny" { 19 | didSet{ 20 | titleLbl.text = title 21 | } 22 | } 23 | /** 24 | Max font size of the title label. 25 | */ 26 | @IBInspectable public var titleSize: CGFloat = 26 27 | /** 28 | Text of the subtitle label. 29 | */ 30 | @IBInspectable public var subtitle: String = "Inside the extraordinary world of Buck Bunny" { 31 | didSet{ 32 | subtitleLbl.text = subtitle 33 | } 34 | } 35 | /** 36 | Max font size of the subtitle label. 37 | */ 38 | @IBInspectable public var subtitleSize: CGFloat = 19 39 | /** 40 | Text of the category label. 41 | */ 42 | @IBInspectable public var category: String = "today's movie" { 43 | didSet{ 44 | categoryLbl.text = category.uppercased() 45 | } 46 | } 47 | /** 48 | Size for the play button in the player. 49 | */ 50 | @IBInspectable public var playBtnSize: CGFloat = 56 { 51 | didSet { 52 | layout(animating: false) 53 | } 54 | } 55 | /** 56 | Image shown in the play button. 57 | */ 58 | @IBInspectable public var playImage: UIImage? { 59 | didSet { 60 | playIV.image = playImage 61 | } 62 | } 63 | /** 64 | Image shown before the player is loaded. 65 | */ 66 | @IBInspectable public var playerCover: UIImage? { 67 | didSet{ 68 | playerCoverIV.image = playerCover 69 | } 70 | } 71 | /** 72 | If the player should start the playback when is ready. 73 | */ 74 | @IBInspectable public var isAutoplayEnabled: Bool = false 75 | /** 76 | If the player should restart the playback when it ends. 77 | */ 78 | @IBInspectable public var shouldRestartVideoWhenPlaybackEnds: Bool = true 79 | /** 80 | Source for the video ( streaming or local ). 81 | */ 82 | @IBInspectable public var videoSource: URL? { 83 | didSet { 84 | player.url = videoSource 85 | } 86 | } 87 | 88 | /** 89 | Required. View controller that should display the player. 90 | */ 91 | public func shouldDisplayPlayer( from vc: UIViewController ) { 92 | vc.addChild(player) 93 | } 94 | 95 | private var player = Player() // Player provided by Patrik Piemonte 96 | 97 | private var titleLbl = UILabel () 98 | private var subtitleLbl = UILabel() 99 | private var playPauseV = UIVisualEffectView() 100 | private var playIV = UIImageView() 101 | private var playerCoverIV = UIImageView() 102 | private var categoryLbl = UILabel() 103 | 104 | // View Life Cycle 105 | public override init(frame: CGRect) { 106 | super.init(frame: frame) 107 | initialize() 108 | } 109 | 110 | public required init?(coder aDecoder: NSCoder) { 111 | super.init(coder: aDecoder) 112 | initialize() 113 | } 114 | 115 | override open func initialize() { 116 | super.initialize() 117 | self.delegate = self 118 | 119 | backgroundIV.addSubview(categoryLbl) 120 | backgroundIV.addSubview(titleLbl) 121 | backgroundIV.addSubview(subtitleLbl) 122 | backgroundIV.addSubview(playerCoverIV) 123 | 124 | // Player Init 125 | player.playerDelegate = self 126 | player.playbackDelegate = self 127 | player.fillMode = PlayerFillMode.resizeAspectFill 128 | if let url = videoSource { player.url = url } 129 | else { print("CARDS: Something wrong with the video source URL") } 130 | 131 | backgroundIV.addSubview(self.player.view) 132 | playPauseV.contentView.addSubview(playIV) 133 | playPauseV.contentView.bringSubviewToFront(playIV) 134 | 135 | // Gestures 136 | player.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playerTapped))) 137 | playPauseV.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(playTapped))) 138 | 139 | backgroundIV.isUserInteractionEnabled = true 140 | player.view.isUserInteractionEnabled = true 141 | playPauseV.isUserInteractionEnabled = true 142 | 143 | } 144 | 145 | 146 | override open func draw(_ rect: CGRect) { 147 | super.draw(rect) 148 | 149 | if let cover = playerCover { 150 | playerCoverIV.image = cover 151 | } 152 | 153 | playPauseV.effect = UIBlurEffect(style: .dark) 154 | playPauseV.clipsToBounds = true 155 | 156 | playIV.contentMode = .scaleAspectFit 157 | playIV.tintColor = UIColor.white 158 | if let img = playImage ?? UIImage(named: "CardPlayerPlayIcon") { 159 | playIV.image = img.withRenderingMode(.alwaysTemplate) 160 | } else { 161 | print("CARDS: Missing play icon, assign one to 'playImage' or download it from my repo and import it to your assests folder") 162 | } 163 | 164 | categoryLbl.text = category.uppercased() 165 | categoryLbl.textColor = textColor.withAlphaComponent(0.3) 166 | categoryLbl.font = UIFont.systemFont(ofSize: 100, weight: .bold) 167 | categoryLbl.shadowColor = UIColor.black 168 | categoryLbl.shadowOffset = CGSize.zero 169 | categoryLbl.adjustsFontSizeToFitWidth = true 170 | categoryLbl.minimumScaleFactor = 0.1 171 | categoryLbl.lineBreakMode = .byTruncatingTail 172 | categoryLbl.numberOfLines = 0 173 | 174 | titleLbl.textColor = textColor 175 | titleLbl.text = title 176 | titleLbl.font = UIFont.systemFont(ofSize: titleSize, weight: .bold) 177 | titleLbl.adjustsFontSizeToFitWidth = true 178 | titleLbl.minimumScaleFactor = 0.1 179 | titleLbl.lineBreakMode = .byClipping 180 | titleLbl.numberOfLines = 2 181 | titleLbl.baselineAdjustment = .none 182 | 183 | subtitleLbl.text = subtitle 184 | subtitleLbl.textColor = textColor 185 | subtitleLbl.font = UIFont.systemFont(ofSize: subtitleSize, weight: .medium) 186 | subtitleLbl.shadowColor = UIColor.black 187 | subtitleLbl.shadowOffset = CGSize.zero 188 | subtitleLbl.adjustsFontSizeToFitWidth = true 189 | subtitleLbl.minimumScaleFactor = 0.1 190 | subtitleLbl.lineBreakMode = .byTruncatingTail 191 | subtitleLbl.numberOfLines = 0 192 | subtitleLbl.textAlignment = .left 193 | 194 | self.layout() 195 | } 196 | 197 | override open func layout(animating: Bool = true) { 198 | super.layout(animating: animating) 199 | 200 | let gimme = LayoutHelper(rect: backgroundIV.bounds) 201 | 202 | let aspect1016 = backgroundIV.bounds.width * (10/16) 203 | let aspect921 = backgroundIV.bounds.width * (9/21) 204 | let move = ( aspect1016 - aspect921 ) * 2 205 | 206 | subtitleLbl.transform = isPresenting ? CGAffineTransform(translationX: 0, y: move) : CGAffineTransform.identity 207 | let currentHeight = backgroundIV.frame.size.height 208 | backgroundIV.frame.size.height = originalFrame.height + ( isPresenting ? move/2 : 0 ) 209 | 210 | if backgroundIV.frame.size.height <= 0 { 211 | backgroundIV.frame.size.height = currentHeight 212 | } 213 | 214 | player.view.frame.origin = CGPoint.zero 215 | player.view.frame.size = CGSize(width: backgroundIV.bounds.width, height: isPresenting ? aspect1016 : aspect921 ) 216 | playerCoverIV.frame = player.view.bounds 217 | 218 | 219 | playPauseV.center = player.view.center 220 | playIV.center = playPauseV.contentView.center.applying(CGAffineTransform(translationX: LayoutHelper.Width(5, of: playPauseV), y: 0)) 221 | 222 | categoryLbl.frame.origin.y = gimme.Y(3, from: player.view) 223 | titleLbl.frame.origin.y = gimme.Y(0, from: categoryLbl) 224 | titleLbl.sizeToFit() 225 | 226 | categoryLbl.frame = CGRect(x: insets, 227 | y: gimme.Y(3, from: player.view), 228 | width: gimme.X(80), 229 | height: gimme.Y(5)) 230 | 231 | titleLbl.frame = CGRect(x: insets, 232 | y: gimme.Y(0, from: categoryLbl), 233 | width: gimme.X(70), 234 | height: gimme.Y(12)) 235 | titleLbl.sizeToFit() 236 | 237 | subtitleLbl.frame = CGRect(x: insets, 238 | y: gimme.RevY(0, height: gimme.Y(14)) - insets, 239 | width: gimme.X(80), 240 | height: gimme.Y(12)) 241 | } 242 | 243 | 244 | //MARK: - Actions 245 | 246 | public func play() { 247 | 248 | player.playFromCurrentTime() 249 | UIView.animate(withDuration: 0.2) { 250 | self.playPauseV.transform = CGAffineTransform(scaleX: 0.1, y: 0.1) 251 | self.playPauseV.alpha = 0 252 | } 253 | } 254 | 255 | public func pause() { 256 | 257 | player.pause() 258 | UIView.animate(withDuration: 0.1) { 259 | self.playPauseV.transform = CGAffineTransform.identity 260 | self.playPauseV.alpha = 1 261 | } 262 | } 263 | 264 | public func stop() { 265 | 266 | pause() 267 | player.stop() 268 | } 269 | 270 | @objc func playTapped() { 271 | 272 | play() 273 | delegate?.cardPlayerDidPlay?(card: self) 274 | } 275 | 276 | @objc func playerTapped() { 277 | 278 | pause() 279 | delegate?.cardPlayerDidPause?(card: self) 280 | } 281 | 282 | open override func touchesBegan(_ touches: Set, with event: UIEvent?) { 283 | if touches.first?.view == player.view || touches.first?.view == playPauseV.contentView { playerTapped() } 284 | else { super.touchesBegan(touches, with: event) } 285 | } 286 | 287 | } 288 | 289 | 290 | // Player Delegates 291 | extension CardPlayer: PlayerDelegate { 292 | public func player(_ player: Player, didFailWithError error: Error?) { 293 | if let errorMessage = error { 294 | print(errorMessage.localizedDescription) 295 | } 296 | } 297 | 298 | public func playerReady(_ player: Player) { 299 | 300 | player.view.addSubview(playPauseV) 301 | playPauseV.frame.size = CGSize(width: playBtnSize, height: playBtnSize) 302 | playPauseV.layer.cornerRadius = playPauseV.frame.height/2 303 | playIV.frame.size = CGSize(width: LayoutHelper.Width(50, of: playPauseV), 304 | height: LayoutHelper.Width(50, of: playPauseV)) 305 | playPauseV.center = player.view.center 306 | playIV.center = playPauseV.contentView.center.applying(CGAffineTransform(translationX: LayoutHelper.Width(5, of: playPauseV), y: 0)) 307 | 308 | if isAutoplayEnabled { 309 | 310 | play() 311 | } else { 312 | pause() 313 | } 314 | } 315 | 316 | public func playerPlaybackStateDidChange(_ player: Player) { } 317 | public func playerBufferingStateDidChange(_ player: Player) { } 318 | public func playerBufferTimeDidChange(_ bufferTime: Double) { } 319 | } 320 | 321 | extension CardPlayer: PlayerPlaybackDelegate { 322 | 323 | public func playerPlaybackDidEnd(_ player: Player) { 324 | 325 | if shouldRestartVideoWhenPlaybackEnds { player.playFromBeginning() } 326 | else { playerTapped() } 327 | 328 | } 329 | 330 | public func playerPlaybackWillLoop(_ player: Player) { } 331 | public func playerCurrentTimeDidChange(_ player: Player) { } 332 | public func playerPlaybackWillStartFromBeginning(_ player: Player) { } 333 | } 334 | 335 | 336 | -------------------------------------------------------------------------------- /Cards/Sources/DetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.swift 3 | // Cards 4 | // 5 | // Created by Paolo Cuscela on 23/10/17. 6 | // 7 | 8 | import UIKit 9 | 10 | internal class DetailViewController: UIViewController { 11 | 12 | var blurView = UIVisualEffectView(effect: UIBlurEffect(style: .extraLight )) 13 | var detailView: UIView? 14 | var scrollView = UIScrollView() 15 | var snap = UIView() 16 | var card: Card! 17 | weak var delegate: CardDelegate? 18 | var isFullscreen = false { 19 | didSet { scrollViewOriginalYPosition = isFullscreen ? 0 : 40 } 20 | } 21 | 22 | fileprivate var xButton = XButton() 23 | fileprivate var scrollPosition = CGFloat() 24 | fileprivate var scrollViewOriginalYPosition = CGFloat() 25 | 26 | override var prefersStatusBarHidden: Bool { 27 | if isFullscreen { return true } 28 | else { return false } 29 | } 30 | var isViewAdded = false 31 | 32 | //MARK: - View Lifecycle 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | card.log("DetailVC: Loaded") 37 | self.setupView() 38 | } 39 | 40 | func setupView() { 41 | if #available(iOS 11.0, *) { 42 | scrollView.contentInsetAdjustmentBehavior = .never 43 | } 44 | 45 | self.snap = UIScreen.main.snapshotView(afterScreenUpdates: true) 46 | self.view.addSubview(blurView) 47 | self.view.addSubview(scrollView) 48 | 49 | if let detail = detailView { 50 | 51 | scrollView.addSubview(detail) 52 | detail.alpha = 0 53 | detail.autoresizingMask = .flexibleWidth 54 | } 55 | 56 | blurView.frame = self.view.bounds 57 | 58 | scrollView.layer.backgroundColor = detailView?.backgroundColor?.cgColor ?? UIColor.white.cgColor 59 | scrollView.layer.cornerRadius = isFullscreen ? 0 : 20 60 | 61 | scrollView.delegate = self 62 | scrollView.alwaysBounceVertical = true 63 | scrollView.showsVerticalScrollIndicator = false 64 | scrollView.showsHorizontalScrollIndicator = false 65 | 66 | xButton.addTarget(self, action: #selector(dismissVC), for: .touchUpInside) 67 | blurView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(dismissVC))) 68 | xButton.isUserInteractionEnabled = true 69 | view.isUserInteractionEnabled = true 70 | isViewAdded = true 71 | } 72 | 73 | override func viewWillAppear(_ animated: Bool) { 74 | super.viewWillAppear(animated) 75 | if isViewAdded == false { 76 | self.setupView() 77 | } 78 | scrollView.addSubview(card.backgroundIV) 79 | self.delegate?.cardWillShowDetailView?(card: self.card) 80 | } 81 | 82 | override func viewDidAppear(_ animated: Bool) { 83 | super.viewDidAppear(animated) 84 | //originalFrame = scrollView.frame 85 | 86 | if isFullscreen { 87 | view.addSubview(xButton) 88 | } 89 | 90 | view.insertSubview(snap, belowSubview: blurView) 91 | 92 | if let detail = detailView { 93 | 94 | detail.alpha = 1 95 | detail.frame = CGRect(x: 0, 96 | y: card.backgroundIV.bounds.maxY, 97 | width: scrollView.frame.width, 98 | height: detail.frame.height) 99 | 100 | scrollView.contentSize = CGSize(width: scrollView.bounds.width, height: detail.frame.maxY) 101 | 102 | xButton.frame = CGRect (x: scrollView.frame.maxX - 20 - 40, 103 | y: scrollView.frame.minY + 20, 104 | width: 40, 105 | height: 40) 106 | 107 | } 108 | 109 | self.delegate?.cardDidShowDetailView?(card: self.card) 110 | self.scrollView.contentOffset.y = 0 // Jie - Sometimes backgroundIV is pushed down. This make sure it is pinned to top of scrollView 111 | } 112 | 113 | override func viewWillDisappear(_ animated: Bool) { 114 | self.delegate?.cardWillCloseDetailView?(card: self.card) 115 | detailView?.alpha = 0 116 | snap.removeFromSuperview() 117 | xButton.removeFromSuperview() 118 | super.viewWillDisappear(animated) 119 | } 120 | 121 | override func viewDidDisappear(_ animated: Bool) { 122 | self.delegate?.cardDidCloseDetailView?(card: self.card) 123 | super.viewDidDisappear(animated) 124 | } 125 | 126 | 127 | //MARK: - Layout & Animations for the content ( rect = Scrollview + card + detail ) 128 | 129 | func layout(_ rect: CGRect, isPresenting: Bool, isAnimating: Bool = true, transform: CGAffineTransform = CGAffineTransform.identity){ 130 | self.card.log("DetailVC>> Will layout to: ---> \(rect)") 131 | 132 | // Layout for dismiss 133 | guard isPresenting else { 134 | 135 | scrollView.frame = rect.applying(transform) 136 | scrollView.layer.cornerRadius = card.cardRadius 137 | card.backgroundIV.frame = scrollView.bounds 138 | card.layout(animating: isAnimating) 139 | return 140 | } 141 | 142 | // Layout for present in fullscreen 143 | if isFullscreen { 144 | 145 | scrollView.layer.cornerRadius = 0 146 | scrollView.frame = view.bounds 147 | scrollView.frame.origin.y = 0 148 | self.card.backgroundIV.layer.cornerRadius = 0 149 | 150 | // Layout for present in non-fullscreen 151 | } else { 152 | scrollView.frame.size = CGSize(width: LayoutHelper.XScreen(90), height: LayoutHelper.YScreen(100) - 20) 153 | scrollView.center = blurView.center 154 | scrollView.frame.origin.y = 40 155 | } 156 | 157 | scrollView.frame = scrollView.frame.applying(transform) 158 | 159 | card.backgroundIV.frame.origin = scrollView.bounds.origin 160 | card.backgroundIV.frame.size = CGSize( width: scrollView.bounds.width, 161 | height: card.backgroundIV.bounds.height) 162 | card.layout(animating: isAnimating) 163 | 164 | } 165 | 166 | 167 | //MARK: - Actions 168 | 169 | @objc func dismissVC(){ 170 | scrollView.contentOffset.y = 0 171 | dismiss(animated: true, completion: nil) 172 | } 173 | } 174 | 175 | 176 | //MARK: - ScrollView Behaviour 177 | 178 | extension DetailViewController: UIScrollViewDelegate { 179 | 180 | public func scrollViewDidScroll(_ scrollView: UIScrollView) { 181 | 182 | let y = scrollView.contentOffset.y 183 | let offset = scrollView.frame.origin.y - scrollViewOriginalYPosition 184 | 185 | // Behavior when scroll view is pulled down 186 | if (y<0) { 187 | scrollView.frame.origin.y -= y/2 188 | scrollView.contentOffset.y = 0 189 | 190 | // Behavior when scroll view is pulled down and then up 191 | } else if ( offset > 0) { 192 | 193 | scrollView.contentOffset.y = 0 194 | scrollView.frame.origin.y -= y/2 195 | } 196 | 197 | card.delegate?.cardDetailIsScrolling?(card: card) 198 | } 199 | 200 | public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { 201 | 202 | let offset = scrollView.frame.origin.y - scrollViewOriginalYPosition 203 | 204 | // Pull down speed calculations 205 | let max = 4.0 206 | let min = 2.0 207 | var speed = Double(-velocity.y) 208 | if speed > max { speed = max } 209 | if speed < min { speed = min } 210 | speed = (max/speed*min)/10 211 | 212 | guard offset < 60 else { dismissVC(); return } 213 | guard offset > 0 else { return } 214 | 215 | // Come back after pull animation 216 | UIView.animate(withDuration: speed, animations: { 217 | scrollView.frame.origin.y = self.scrollViewOriginalYPosition 218 | self.scrollView.contentOffset.y = 0 219 | }) 220 | } 221 | 222 | func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { 223 | 224 | let offset = scrollView.frame.origin.y - scrollViewOriginalYPosition 225 | guard offset > 0 else { return } 226 | 227 | // Come back after pull animation 228 | UIView.animate(withDuration: 0.1, animations: { 229 | scrollView.frame.origin.y = self.scrollViewOriginalYPosition 230 | self.scrollView.contentOffset.y = 0 231 | }) 232 | } 233 | 234 | } 235 | 236 | class XButton: UIButton { 237 | 238 | private let circle = UIVisualEffectView(effect: UIBlurEffect(style: .dark)) 239 | 240 | override var frame: CGRect { 241 | didSet{ 242 | setNeedsDisplay() 243 | } 244 | } 245 | 246 | override init(frame: CGRect) { 247 | super.init(frame: frame) 248 | self.addSubview(circle) 249 | } 250 | 251 | required init?(coder aDecoder: NSCoder) { 252 | super.init(coder: aDecoder) 253 | } 254 | 255 | override func draw(_ rect: CGRect) { 256 | super.draw(rect) 257 | 258 | let xPath = UIBezierPath() 259 | let xLayer = CAShapeLayer() 260 | let inset = rect.width * 0.3 261 | 262 | xPath.move(to: CGPoint(x: inset, y: inset)) 263 | xPath.addLine(to: CGPoint(x: rect.maxX - inset, y: rect.maxY - inset)) 264 | 265 | xPath.move(to: CGPoint(x: rect.maxX - inset, y: inset)) 266 | xPath.addLine(to: CGPoint(x: inset, y: rect.maxY - inset)) 267 | 268 | xLayer.path = xPath.cgPath 269 | 270 | xLayer.strokeColor = UIColor.white.cgColor 271 | xLayer.lineWidth = 2.0 272 | self.layer.addSublayer(xLayer) 273 | 274 | circle.frame = rect 275 | circle.layer.cornerRadius = circle.bounds.width / 2 276 | circle.clipsToBounds = true 277 | circle.isUserInteractionEnabled = false 278 | 279 | 280 | } 281 | 282 | 283 | } 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | -------------------------------------------------------------------------------- /Cards/Sources/LayoutHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Lay.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 15/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | open class LayoutHelper { 13 | 14 | let rect: CGRect 15 | 16 | public init(rect: CGRect) { 17 | self.rect = rect 18 | } 19 | 20 | open func X(_ percentage: CGFloat) -> CGFloat { 21 | return percentage * rect.width / 100 22 | } 23 | 24 | open func Y(_ percentage: CGFloat) -> CGFloat { 25 | return percentage * rect.height / 100 26 | } 27 | 28 | open func X(_ percentage: CGFloat, from: UIView) -> CGFloat { 29 | return X(percentage) + from.frame.maxX 30 | } 31 | 32 | open func Y(_ percentage: CGFloat, from: UIView) -> CGFloat { 33 | return Y(percentage) + from.frame.maxY 34 | } 35 | 36 | open func RevX(_ percentage: CGFloat, width: CGFloat) -> CGFloat { 37 | return (rect.width - X(percentage)) - width 38 | } 39 | 40 | open func RevY(_ percentage: CGFloat, height: CGFloat) -> CGFloat { 41 | return (rect.height - Y(percentage)) - height 42 | } 43 | 44 | open func RevY(_ percentage: CGFloat, height: CGFloat, from: UIView) -> CGFloat { 45 | return from.frame.minY - Y(percentage) - height 46 | } 47 | 48 | static public func Width(_ percentage: CGFloat, of view: UIView) -> CGFloat { 49 | return view.frame.width * (percentage / 100) 50 | } 51 | 52 | static public func Height(_ percentage: CGFloat, of view: UIView) -> CGFloat { 53 | return view.frame.height * (percentage / 100) 54 | } 55 | 56 | static public func XScreen(_ percentage: CGFloat) -> CGFloat { 57 | return percentage * UIScreen.main.bounds.width / 100 58 | } 59 | 60 | static public func YScreen(_ percentage: CGFloat) -> CGFloat { 61 | return percentage * UIScreen.main.bounds.height / 100 62 | } 63 | 64 | } 65 | 66 | extension CGRect { 67 | 68 | var center: CGPoint { 69 | return CGPoint(x: width/2 + minX, y: height/2 + minY) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D0C91591FA8BF350073554B /* ArticleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D0C91581FA8BF350073554B /* ArticleViewController.swift */; }; 11 | 6D1F24521FACC2E6002E41FF /* CardContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D1F24511FACC2E6002E41FF /* CardContentViewController.swift */; }; 12 | 6D37D92C1FA8852C00B33EA0 /* GroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D37D92B1FA8852C00B33EA0 /* GroupViewController.swift */; }; 13 | 6D3CD3421F9BDE0D00C0592C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D3CD3411F9BDE0D00C0592C /* Assets.xcassets */; }; 14 | 6D436D571F9BD34600B05FA6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D436D561F9BD34600B05FA6 /* AppDelegate.swift */; }; 15 | 6D436D611F9BD34600B05FA6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D436D5F1F9BD34600B05FA6 /* LaunchScreen.storyboard */; }; 16 | 6D965BA21FA7974100705AAA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D965BA01FA7974100705AAA /* Main.storyboard */; }; 17 | 6D965BA41FA79A6300705AAA /* HighlightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D965BA31FA79A6300705AAA /* HighlightViewController.swift */; }; 18 | 6D965BA81FA7B6DD00705AAA /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D965BA71FA7B6DD00705AAA /* PlayerViewController.swift */; }; 19 | 6DEE676E2115989400FF2EB4 /* ListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEE676D2115989400FF2EB4 /* ListTableViewController.swift */; }; 20 | 6FDABBFFC80A25A8DEEFE3E3 /* Pods_Demo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DB13C5E8ADDE29D425A8FEC /* Pods_Demo.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 38CFFDBE6D3C33B1A464184C /* Pods-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig"; sourceTree = ""; }; 25 | 6D0C91581FA8BF350073554B /* ArticleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleViewController.swift; sourceTree = ""; }; 26 | 6D1F24511FACC2E6002E41FF /* CardContentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardContentViewController.swift; sourceTree = ""; }; 27 | 6D37D92B1FA8852C00B33EA0 /* GroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupViewController.swift; sourceTree = ""; }; 28 | 6D3CD3321F9BD40B00C0592C /* Cards.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Cards.podspec; path = ../Cards.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 29 | 6D3CD3411F9BDE0D00C0592C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 6D436D531F9BD34600B05FA6 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 6D436D561F9BD34600B05FA6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 32 | 6D436D601F9BD34600B05FA6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | 6D436D621F9BD34600B05FA6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 6D965BA11FA7974100705AAA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | 6D965BA31FA79A6300705AAA /* HighlightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightViewController.swift; sourceTree = ""; }; 36 | 6D965BA71FA7B6DD00705AAA /* PlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewController.swift; sourceTree = ""; }; 37 | 6DEE676D2115989400FF2EB4 /* ListTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTableViewController.swift; sourceTree = ""; }; 38 | 8DB13C5E8ADDE29D425A8FEC /* Pods_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | A67AFDB912F87244FCB0C745 /* Pods-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig"; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | 6D436D501F9BD34600B05FA6 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | 6FDABBFFC80A25A8DEEFE3E3 /* Pods_Demo.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 6D436D4A1F9BD34600B05FA6 = { 55 | isa = PBXGroup; 56 | children = ( 57 | 6D3CD3321F9BD40B00C0592C /* Cards.podspec */, 58 | 6D436D551F9BD34600B05FA6 /* Demo */, 59 | 6D436D541F9BD34600B05FA6 /* Products */, 60 | 8F906564362B7B6F05CF3756 /* Pods */, 61 | AAC894ED1B64C9E66AF9ECEC /* Frameworks */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | 6D436D541F9BD34600B05FA6 /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 6D436D531F9BD34600B05FA6 /* Demo.app */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | 6D436D551F9BD34600B05FA6 /* Demo */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 6D436D561F9BD34600B05FA6 /* AppDelegate.swift */, 77 | 6D965BA51FA79A6800705AAA /* ViewControllers */, 78 | 6D965BA61FA79A8D00705AAA /* Storyboards */, 79 | 6D3CD3411F9BDE0D00C0592C /* Assets.xcassets */, 80 | 6D436D621F9BD34600B05FA6 /* Info.plist */, 81 | ); 82 | path = Demo; 83 | sourceTree = ""; 84 | }; 85 | 6D965BA51FA79A6800705AAA /* ViewControllers */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 6D965BA31FA79A6300705AAA /* HighlightViewController.swift */, 89 | 6D965BA71FA7B6DD00705AAA /* PlayerViewController.swift */, 90 | 6D37D92B1FA8852C00B33EA0 /* GroupViewController.swift */, 91 | 6D0C91581FA8BF350073554B /* ArticleViewController.swift */, 92 | 6D1F24511FACC2E6002E41FF /* CardContentViewController.swift */, 93 | 6DEE676D2115989400FF2EB4 /* ListTableViewController.swift */, 94 | ); 95 | path = ViewControllers; 96 | sourceTree = ""; 97 | }; 98 | 6D965BA61FA79A8D00705AAA /* Storyboards */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 6D965BA01FA7974100705AAA /* Main.storyboard */, 102 | 6D436D5F1F9BD34600B05FA6 /* LaunchScreen.storyboard */, 103 | ); 104 | path = Storyboards; 105 | sourceTree = ""; 106 | }; 107 | 8F906564362B7B6F05CF3756 /* Pods */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 38CFFDBE6D3C33B1A464184C /* Pods-Demo.debug.xcconfig */, 111 | A67AFDB912F87244FCB0C745 /* Pods-Demo.release.xcconfig */, 112 | ); 113 | name = Pods; 114 | sourceTree = ""; 115 | }; 116 | AAC894ED1B64C9E66AF9ECEC /* Frameworks */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 8DB13C5E8ADDE29D425A8FEC /* Pods_Demo.framework */, 120 | ); 121 | name = Frameworks; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | 6D436D521F9BD34600B05FA6 /* Demo */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = 6D436D651F9BD34600B05FA6 /* Build configuration list for PBXNativeTarget "Demo" */; 130 | buildPhases = ( 131 | 93015ADBE87A8D2AB5D07F95 /* [CP] Check Pods Manifest.lock */, 132 | 6D436D4F1F9BD34600B05FA6 /* Sources */, 133 | 6D436D501F9BD34600B05FA6 /* Frameworks */, 134 | 6D436D511F9BD34600B05FA6 /* Resources */, 135 | F00B028E32056EAAB78B17B6 /* [CP] Embed Pods Frameworks */, 136 | ); 137 | buildRules = ( 138 | ); 139 | dependencies = ( 140 | ); 141 | name = Demo; 142 | productName = Demo; 143 | productReference = 6D436D531F9BD34600B05FA6 /* Demo.app */; 144 | productType = "com.apple.product-type.application"; 145 | }; 146 | /* End PBXNativeTarget section */ 147 | 148 | /* Begin PBXProject section */ 149 | 6D436D4B1F9BD34600B05FA6 /* Project object */ = { 150 | isa = PBXProject; 151 | attributes = { 152 | LastSwiftUpdateCheck = 0900; 153 | LastUpgradeCheck = 0900; 154 | ORGANIZATIONNAME = "Paolo Cuscela"; 155 | TargetAttributes = { 156 | 6D436D521F9BD34600B05FA6 = { 157 | CreatedOnToolsVersion = 9.0.1; 158 | LastSwiftMigration = 1020; 159 | ProvisioningStyle = Automatic; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 6D436D4E1F9BD34600B05FA6 /* Build configuration list for PBXProject "Demo" */; 164 | compatibilityVersion = "Xcode 8.0"; 165 | developmentRegion = en; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 6D436D4A1F9BD34600B05FA6; 172 | productRefGroup = 6D436D541F9BD34600B05FA6 /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 6D436D521F9BD34600B05FA6 /* Demo */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 6D436D511F9BD34600B05FA6 /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 6D965BA21FA7974100705AAA /* Main.storyboard in Resources */, 187 | 6D3CD3421F9BDE0D00C0592C /* Assets.xcassets in Resources */, 188 | 6D436D611F9BD34600B05FA6 /* LaunchScreen.storyboard in Resources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXResourcesBuildPhase section */ 193 | 194 | /* Begin PBXShellScriptBuildPhase section */ 195 | 93015ADBE87A8D2AB5D07F95 /* [CP] Check Pods Manifest.lock */ = { 196 | isa = PBXShellScriptBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | ); 200 | inputPaths = ( 201 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 202 | "${PODS_ROOT}/Manifest.lock", 203 | ); 204 | name = "[CP] Check Pods Manifest.lock"; 205 | outputPaths = ( 206 | "$(DERIVED_FILE_DIR)/Pods-Demo-checkManifestLockResult.txt", 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | shellPath = /bin/sh; 210 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 211 | showEnvVarsInLog = 0; 212 | }; 213 | F00B028E32056EAAB78B17B6 /* [CP] Embed Pods Frameworks */ = { 214 | isa = PBXShellScriptBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | inputPaths = ( 219 | "${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh", 220 | "${BUILT_PRODUCTS_DIR}/Cards/Cards.framework", 221 | "${BUILT_PRODUCTS_DIR}/Player/Player.framework", 222 | ); 223 | name = "[CP] Embed Pods Frameworks"; 224 | outputPaths = ( 225 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cards.framework", 226 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Player.framework", 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | shellPath = /bin/sh; 230 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh\"\n"; 231 | showEnvVarsInLog = 0; 232 | }; 233 | /* End PBXShellScriptBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 6D436D4F1F9BD34600B05FA6 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 6DEE676E2115989400FF2EB4 /* ListTableViewController.swift in Sources */, 241 | 6D37D92C1FA8852C00B33EA0 /* GroupViewController.swift in Sources */, 242 | 6D436D571F9BD34600B05FA6 /* AppDelegate.swift in Sources */, 243 | 6D0C91591FA8BF350073554B /* ArticleViewController.swift in Sources */, 244 | 6D1F24521FACC2E6002E41FF /* CardContentViewController.swift in Sources */, 245 | 6D965BA41FA79A6300705AAA /* HighlightViewController.swift in Sources */, 246 | 6D965BA81FA7B6DD00705AAA /* PlayerViewController.swift in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | 6D436D5F1F9BD34600B05FA6 /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 6D436D601F9BD34600B05FA6 /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | 6D965BA01FA7974100705AAA /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | 6D965BA11FA7974100705AAA /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | /* End PBXVariantGroup section */ 270 | 271 | /* Begin XCBuildConfiguration section */ 272 | 6D436D631F9BD34600B05FA6 /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ALWAYS_SEARCH_USER_PATHS = NO; 276 | CLANG_ANALYZER_NONNULL = YES; 277 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 278 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 279 | CLANG_CXX_LIBRARY = "libc++"; 280 | CLANG_ENABLE_MODULES = YES; 281 | CLANG_ENABLE_OBJC_ARC = YES; 282 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 283 | CLANG_WARN_BOOL_CONVERSION = YES; 284 | CLANG_WARN_COMMA = YES; 285 | CLANG_WARN_CONSTANT_CONVERSION = YES; 286 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 287 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 288 | CLANG_WARN_EMPTY_BODY = YES; 289 | CLANG_WARN_ENUM_CONVERSION = YES; 290 | CLANG_WARN_INFINITE_RECURSION = YES; 291 | CLANG_WARN_INT_CONVERSION = YES; 292 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 293 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 296 | CLANG_WARN_STRICT_PROTOTYPES = YES; 297 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 298 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 299 | CLANG_WARN_UNREACHABLE_CODE = YES; 300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 301 | CODE_SIGN_IDENTITY = "iPhone Developer"; 302 | COPY_PHASE_STRIP = NO; 303 | DEBUG_INFORMATION_FORMAT = dwarf; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | ENABLE_TESTABILITY = YES; 306 | GCC_C_LANGUAGE_STANDARD = gnu11; 307 | GCC_DYNAMIC_NO_PIC = NO; 308 | GCC_NO_COMMON_BLOCKS = YES; 309 | GCC_OPTIMIZATION_LEVEL = 0; 310 | GCC_PREPROCESSOR_DEFINITIONS = ( 311 | "DEBUG=1", 312 | "$(inherited)", 313 | ); 314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 316 | GCC_WARN_UNDECLARED_SELECTOR = YES; 317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 318 | GCC_WARN_UNUSED_FUNCTION = YES; 319 | GCC_WARN_UNUSED_VARIABLE = YES; 320 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 321 | MTL_ENABLE_DEBUG_INFO = YES; 322 | ONLY_ACTIVE_ARCH = YES; 323 | SDKROOT = iphoneos; 324 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 325 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 326 | }; 327 | name = Debug; 328 | }; 329 | 6D436D641F9BD34600B05FA6 /* Release */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_ANALYZER_NONNULL = YES; 334 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 340 | CLANG_WARN_BOOL_CONVERSION = YES; 341 | CLANG_WARN_COMMA = YES; 342 | CLANG_WARN_CONSTANT_CONVERSION = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INFINITE_RECURSION = YES; 348 | CLANG_WARN_INT_CONVERSION = YES; 349 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 352 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 353 | CLANG_WARN_STRICT_PROTOTYPES = YES; 354 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 355 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 356 | CLANG_WARN_UNREACHABLE_CODE = YES; 357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 358 | CODE_SIGN_IDENTITY = "iPhone Developer"; 359 | COPY_PHASE_STRIP = NO; 360 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 361 | ENABLE_NS_ASSERTIONS = NO; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | GCC_C_LANGUAGE_STANDARD = gnu11; 364 | GCC_NO_COMMON_BLOCKS = YES; 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 372 | MTL_ENABLE_DEBUG_INFO = NO; 373 | SDKROOT = iphoneos; 374 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 375 | VALIDATE_PRODUCT = YES; 376 | }; 377 | name = Release; 378 | }; 379 | 6D436D661F9BD34600B05FA6 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | baseConfigurationReference = 38CFFDBE6D3C33B1A464184C /* Pods-Demo.debug.xcconfig */; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 385 | CODE_SIGN_STYLE = Automatic; 386 | DEVELOPMENT_TEAM = 4B98PNC6BV; 387 | INFOPLIST_FILE = Demo/Info.plist; 388 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 390 | PRODUCT_BUNDLE_IDENTIFIER = it.paolocuscela.Cardz; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | PROVISIONING_PROFILE_SPECIFIER = ""; 393 | SWIFT_VERSION = 5.0; 394 | TARGETED_DEVICE_FAMILY = "1,2"; 395 | }; 396 | name = Debug; 397 | }; 398 | 6D436D671F9BD34600B05FA6 /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | baseConfigurationReference = A67AFDB912F87244FCB0C745 /* Pods-Demo.release.xcconfig */; 401 | buildSettings = { 402 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 404 | CODE_SIGN_STYLE = Automatic; 405 | DEVELOPMENT_TEAM = 4B98PNC6BV; 406 | INFOPLIST_FILE = Demo/Info.plist; 407 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 408 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 409 | PRODUCT_BUNDLE_IDENTIFIER = it.paolocuscela.Cardz; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | PROVISIONING_PROFILE_SPECIFIER = ""; 412 | SWIFT_VERSION = 5.0; 413 | TARGETED_DEVICE_FAMILY = "1,2"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | 6D436D4E1F9BD34600B05FA6 /* Build configuration list for PBXProject "Demo" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 6D436D631F9BD34600B05FA6 /* Debug */, 424 | 6D436D641F9BD34600B05FA6 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 6D436D651F9BD34600B05FA6 /* Build configuration list for PBXNativeTarget "Demo" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 6D436D661F9BD34600B05FA6 /* Debug */, 433 | 6D436D671F9BD34600B05FA6 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | /* End XCConfigurationList section */ 439 | }; 440 | rootObject = 6D436D4B1F9BD34600B05FA6 /* Project object */; 441 | } 442 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/paolocuscela.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Demo.xcscheme 8 | 9 | orderHint 10 | 3 11 | 12 | Demo.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 3 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Demo/Demo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo/Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 21/10/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | return true 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Demo/Demo/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 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/CardPlayerPlayIcon.imageset/CardPlayerPlayIcon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/CardPlayerPlayIcon.imageset/CardPlayerPlayIcon.pdf -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/CardPlayerPlayIcon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "CardPlayerPlayIcon.pdf", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/Icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Group 2.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/Icon.imageset/Group 2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/Icon.imageset/Group 2.pdf -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/background.imageset/265186.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/background.imageset/265186.pdf -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "265186.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/flBackground.imageset/725e5dc00ba49c240cd489e7b87e0496--city-background-flappy-bird.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/flBackground.imageset/725e5dc00ba49c240cd489e7b87e0496--city-background-flappy-bird.jpg -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/flBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "725e5dc00ba49c240cd489e7b87e0496--city-background-flappy-bird.jpg" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/flappy.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Flappy_Bird_icon.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/flappy.imageset/Flappy_Bird_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/flappy.imageset/Flappy_Bird_icon.png -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/grBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "math_equations-wallpaper-800x480.jpg" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/grBackground.imageset/math_equations-wallpaper-800x480.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/grBackground.imageset/math_equations-wallpaper-800x480.jpg -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/mvBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "monument_valley_5k-1920x1080.jpg" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | }, 12 | "properties" : { 13 | "template-rendering-intent" : "original" 14 | } 15 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/mvBackground.imageset/monument_valley_5k-1920x1080.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Demo/Demo/Assets.xcassets/mvBackground.imageset/monument_valley_5k-1920x1080.jpg -------------------------------------------------------------------------------- /Demo/Demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Demo/Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | UILaunchStoryboardName 29 | LaunchScreen 30 | UIMainStoryboardFile 31 | Main 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Demo/Demo/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 98 | 105 | 106 | 107 | 108 | 109 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /Demo/Demo/Storyboards/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Demo/Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Cards 4 | // 5 | // Created by Paolo on 05/10/17. 6 | // Copyright © 2017 Apple. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var tableView: UITableView! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | tableView.dataSource = self 20 | tableView.rowHeight = 300 21 | 22 | /* let icons: [UIImage] = [ 23 | 24 | UIImage(named: "grBackground")!, 25 | UIImage(named: "background")!, 26 | UIImage(named: "flappy")!, 27 | UIImage(named: "flBackground")!, 28 | UIImage(named: "Icon")!, 29 | UIImage(named: "mvBackground")! 30 | 31 | ] // Data source for CardGroupSliding */ 32 | 33 | let card = CardPlayer(frame: CGRect(x: 40, y: 50, width: 300 , height: 360)) 34 | card.textColor = UIColor.black 35 | card.videoSource = URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") 36 | self.addChildViewController(card.player) /// IMPORTANT: Don't forget this 37 | 38 | card.playerCover = UIImage(named: "mvBackground")! // Shows while the player is loading 39 | card.playImage = UIImage(named: "CardPlayerPlayIcon")! // Play button icon 40 | 41 | card.isAutoplayEnabled = true 42 | card.shouldRestartVideoWhenPlaybackEnds = true 43 | 44 | card.title = "Big Buck Bunny" 45 | card.subtitle = "Inside the extraordinary world of Buck Bunny" 46 | card.category = "today's movie" 47 | 48 | card.hasParallax = true 49 | 50 | let cardContentVC = storyboard!.instantiateViewController(withIdentifier: "CardContent") 51 | card.shouldPresent(cardContentVC.view, from: self) 52 | 53 | //view.addSubview(card) 54 | } 55 | } 56 | 57 | extension ViewController: UITableViewDataSource { 58 | 59 | func numberOfSections(in tableView: UITableView) -> Int { 60 | return 1 61 | } 62 | 63 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 64 | return 3 65 | } 66 | 67 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 68 | let cell = tableView.dequeueReusableCell(withIdentifier: "CardCell", for: indexPath) 69 | let card = cell.viewWithTag(1000) as! CardHighlight 70 | let detailVC = storyboard?.instantiateViewController(withIdentifier: "CardContent") 71 | 72 | card.shouldPresent(detailVC?.view, from: self) 73 | card.textColor = UIColor.white 74 | card.title = "Welcome \nto \ncards !" 75 | 76 | switch indexPath.row { 77 | case 0: 78 | card.icon = UIImage(named: "Icon") 79 | card.textColor = UIColor.black 80 | card.backgroundColor = UIColor.white 81 | card.tintColor = UIColor.red 82 | break 83 | case 1: 84 | card.icon = UIImage(named: "flappy") 85 | card.backgroundColor = UIColor.lightGray 86 | card.tintColor = UIColor.green 87 | break 88 | case 2: 89 | card.icon = UIImage(named: "flappy") 90 | card.backgroundImage = UIImage(named: "flBackground") 91 | card.tintColor = UIColor.green 92 | 93 | default: 94 | break 95 | } 96 | 97 | return cell 98 | } 99 | 100 | 101 | } 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/ArticleViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArticleViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 31/10/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | 12 | class ArticleViewController: UIViewController { 13 | 14 | @IBOutlet weak var card: CardArticle! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | let cardContent = storyboard?.instantiateViewController(withIdentifier: "CardContent") 20 | card.shouldPresent(cardContent, from: self) 21 | 22 | 23 | } 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/CardContentViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 03/11/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CardContentViewController: UIViewController { 12 | 13 | 14 | let colors = [ 15 | 16 | UIColor.red, 17 | UIColor.yellow, 18 | UIColor.blue, 19 | UIColor.green, 20 | UIColor.brown, 21 | UIColor.purple, 22 | UIColor.orange 23 | 24 | ] 25 | 26 | override func viewDidLoad() { 27 | print("Loaded!") 28 | } 29 | 30 | @IBAction func doMagic(_ sender: Any) { 31 | 32 | view.backgroundColor = colors[Int(arc4random_uniform(UInt32(colors.count)))] 33 | 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/GroupViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GroupViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 31/10/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | 12 | class GroupViewController: UIViewController { 13 | 14 | @IBOutlet weak var group: CardGroup! 15 | @IBOutlet weak var sliding: CardGroupSliding! 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | let icons: [UIImage] = [ 21 | 22 | UIImage(named: "grBackground")!, 23 | UIImage(named: "background")!, 24 | UIImage(named: "flappy")!, 25 | UIImage(named: "flBackground")!, 26 | UIImage(named: "Icon")!, 27 | UIImage(named: "mvBackground")! 28 | 29 | ] 30 | 31 | sliding.icons = icons 32 | 33 | let groupCardContent = storyboard?.instantiateViewController(withIdentifier: "CardContent") 34 | group.shouldPresent(groupCardContent, from: self) 35 | 36 | let slidingCardContent = storyboard?.instantiateViewController(withIdentifier: "CardContent") 37 | sliding.shouldPresent(slidingCardContent, from: self) 38 | 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/HighlightViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HighlightViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 30/10/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | import Foundation 12 | 13 | class HighlightViewController: UIViewController { 14 | 15 | @IBOutlet weak var first: CardHighlight! 16 | @IBOutlet weak var second: CardHighlight! 17 | 18 | let colors = [ 19 | 20 | UIColor.red, 21 | UIColor.yellow, 22 | UIColor.blue, 23 | UIColor.green, 24 | UIColor.gray, 25 | UIColor.brown, 26 | UIColor.purple, 27 | UIColor.orange 28 | 29 | ] 30 | 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | 34 | first.delegate = self 35 | first.hasParallax = true 36 | 37 | second.delegate = self 38 | let cardContent = storyboard?.instantiateViewController(withIdentifier: "CardContent") 39 | second.shouldPresent(cardContent, from: self, fullscreen: true) 40 | 41 | 42 | } 43 | 44 | func random(min: Int, max:Int) -> Int { 45 | return min + Int(arc4random_uniform(UInt32(max - min + 1))) 46 | } 47 | } 48 | 49 | 50 | extension HighlightViewController: CardDelegate { 51 | 52 | func cardDidTapInside(card: Card) { 53 | 54 | if card == first { 55 | card.shadowColor = colors[random(min: 0, max: colors.count-1)] 56 | (card as! CardHighlight).title = "everyday \nI'm \nshufflin'" 57 | } else { 58 | print("Hey, I'm the second one :)") 59 | } 60 | } 61 | 62 | func cardHighlightDidTapButton(card: CardHighlight, button: UIButton) { 63 | 64 | card.buttonText = "OPEN!" 65 | 66 | if card == self.second { 67 | card.open() 68 | } 69 | } 70 | 71 | } 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/ListTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListTTableViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 04/08/18. 6 | // Copyright © 2018 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | 12 | class ListTableViewController: UITableViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | } 18 | 19 | // MARK: - Table view data source 20 | 21 | override func numberOfSections(in tableView: UITableView) -> Int { 22 | // #warning Incomplete implementation, return the number of sections 23 | return 1 24 | } 25 | 26 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 27 | // #warning Incomplete implementation, return the number of rows 28 | return 10 29 | } 30 | 31 | 32 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 33 | let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) 34 | let card = cell.viewWithTag(1000) as! CardArticle 35 | let cardContent = storyboard!.instantiateViewController(withIdentifier: "CardContent") 36 | 37 | card.shouldPresent(cardContent, from: self, fullscreen: true) 38 | return cell 39 | } 40 | 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Demo/Demo/ViewControllers/PlayerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerViewController.swift 3 | // Demo 4 | // 5 | // Created by Paolo Cuscela on 30/10/17. 6 | // Copyright © 2017 Paolo Cuscela. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Cards 11 | 12 | class PlayerViewController: UIViewController { 13 | 14 | @IBOutlet weak var card: CardPlayer! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | card.videoSource = URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") 20 | card.shouldDisplayPlayer(from: self) //Required. 21 | 22 | card.playerCover = UIImage(named: "mvBackground")! // Shows while the player is loading 23 | card.playImage = UIImage(named: "CardPlayerPlayIcon")! // Play button icon 24 | 25 | card.isAutoplayEnabled = false 26 | card.shouldRestartVideoWhenPlaybackEnds = true 27 | 28 | card.title = "Big Buck Bunny" 29 | card.subtitle = "Inside the extraordinary world of Buck Bunny" 30 | card.category = "today's movie" 31 | 32 | let cardContent = storyboard?.instantiateViewController(withIdentifier: "CardContent") 33 | card.shouldPresent(cardContent, from: self) 34 | 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Demo/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | 3 | target 'Demo' do 4 | 5 | use_frameworks! 6 | 7 | # Pods for Demo 8 | pod 'Cards', :path => '../' 9 | 10 | end 11 | -------------------------------------------------------------------------------- /Demo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Cards (1.3.5): 3 | - Player (= 0.13.0) 4 | - Player (0.13.0) 5 | 6 | DEPENDENCIES: 7 | - Cards (from `../`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - Player 12 | 13 | EXTERNAL SOURCES: 14 | Cards: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | Cards: 19bdbd7d891d83d5d36f3e4423e68e29a2ad215a 19 | Player: 968d8d07d923bcdd6f7e4091c9e306eb44a5f7a4 20 | 21 | PODFILE CHECKSUM: 1c52c57701e5a2124294248068eef20a103c5b0e 22 | 23 | COCOAPODS: 1.5.3 24 | -------------------------------------------------------------------------------- /Demo/Pods/Local Podspecs/Cards.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cards", 3 | "version": "1.3.5", 4 | "summary": "Awesome iOS 11 appstore cards in swift 4.", 5 | "homepage": "https://github.com/PaoloCuscela/Cards", 6 | "screenshots": [ 7 | "https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Header.png", 8 | "https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/DetailView.gif" 9 | ], 10 | "license": { 11 | "type": "MIT", 12 | "file": "LICENSE" 13 | }, 14 | "authors": { 15 | "Paolo Cuscela": "cuscio.2@gmail.com" 16 | }, 17 | "source": { 18 | "git": "https://github.com/PaoloCuscela/Cards.git", 19 | "tag": "1.3.5" 20 | }, 21 | "platforms": { 22 | "ios": "9.0" 23 | }, 24 | "source_files": "Cards/Sources/*", 25 | "frameworks": "UIKit", 26 | "dependencies": { 27 | "Player": [ 28 | "0.13.0" 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Demo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Cards (1.3.5): 3 | - Player (= 0.13.0) 4 | - Player (0.13.0) 5 | 6 | DEPENDENCIES: 7 | - Cards (from `../`) 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - Player 12 | 13 | EXTERNAL SOURCES: 14 | Cards: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | Cards: 19bdbd7d891d83d5d36f3e4423e68e29a2ad215a 19 | Player: 968d8d07d923bcdd6f7e4091c9e306eb44a5f7a4 20 | 21 | PODFILE CHECKSUM: 1c52c57701e5a2124294248068eef20a103c5b0e 22 | 23 | COCOAPODS: 1.5.3 24 | -------------------------------------------------------------------------------- /Demo/Pods/Player/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-present patrick piemonte (http://patrickpiemonte.com/) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Demo/Pods/Player/README.md: -------------------------------------------------------------------------------- 1 | ![Player](https://github.com/piemonte/Player/raw/master/Player.gif) 2 | 3 | ## Player 4 | 5 | `Player` is a simple iOS video player library written in [Swift](https://developer.apple.com/swift/). 6 | 7 | [![Build Status](https://travis-ci.org/piemonte/Player.svg?branch=master)](https://travis-ci.org/piemonte/Player) [![Pod Version](https://img.shields.io/cocoapods/v/Player.svg?style=flat)](http://cocoadocs.org/docsets/Player/) [![Swift Version](https://img.shields.io/badge/language-swift%205.0-brightgreen.svg)](https://developer.apple.com/swift) [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/piemonte/Player/blob/master/LICENSE) [![Downloads](https://img.shields.io/cocoapods/dt/Player.svg?style=flat)](http://cocoapods.org/pods/Player) 8 | 9 | - Looking for an obj-c video player? Check out [PBJVideoPlayer (obj-c)](https://github.com/piemonte/PBJVideoPlayer). 10 | - Looking for a Swift camera library? Check out [Next Level](https://github.com/NextLevel/NextLevel). 11 | 12 | Need a different version of Swift? 13 | * `5.0` - Target your Podfile to the latest release or master 14 | * `4.2` - Target your Podfile to the `swift4.2` branch 15 | * `4.0` - Target your Podfile to the `swift4.0` branch 16 | * `3.0` – Target your Podfile to release `0.7.0` 17 | 18 | ### Features 19 | 20 | - [x] plays local media or streams remote media over HTTP 21 | - [x] customizable UI and user interaction 22 | - [x] no size restrictions 23 | - [x] orientation change support 24 | - [x] simple API 25 | - [x] video frame snapshot support 26 | 27 | # Quick Start 28 | 29 | `Player` is available for installation using the Cocoa dependency manager [CocoaPods](http://cocoapods.org/). Alternatively, you can simply copy the `Player.swift` file into your Xcode project. 30 | 31 | ```ruby 32 | # CocoaPods 33 | pod "Player", "~> 0.13.0" 34 | 35 | # Carthage 36 | github "piemonte/Player" ~> 0.13.0 37 | ``` 38 | 39 | ## Usage 40 | 41 | The sample project provides an example of how to integrate `Player`, otherwise you can follow these steps. 42 | 43 | Allocate and add the `Player` controller to your view hierarchy. 44 | 45 | ``` Swift 46 | self.player = Player() 47 | self.player.playerDelegate = self 48 | self.player.playbackDelegate = self 49 | self.player.view.frame = self.view.bounds 50 | 51 | self.addChild(self.player) 52 | self.view.addSubview(self.player.view) 53 | self.player.didMove(toParent: self) 54 | ``` 55 | 56 | Provide the file path to the resource you would like to play locally or stream. Ensure you're including the file extension. 57 | 58 | ``` Swift 59 | let videoUrl: URL = // file or http url 60 | self.player.url = videoUrl 61 | ``` 62 | 63 | play/pause/chill 64 | 65 | ``` Swift 66 | self.player.playFromBeginning() 67 | ``` 68 | 69 | Adjust the fill mode for the video, if needed. 70 | 71 | ``` Swift 72 | self.player.fillMode = PlayerFillMode.resizeAspectFit.avFoundationType 73 | ``` 74 | 75 | Display video playback progress, if needed. 76 | 77 | ``` Swift 78 | extension ViewController: PlayerPlaybackDelegate { 79 | 80 | public func playerPlaybackWillStartFromBeginning(_ player: Player) { 81 | } 82 | 83 | public func playerPlaybackDidEnd(_ player: Player) { 84 | } 85 | 86 | public func playerCurrentTimeDidChange(_ player: Player) { 87 | let fraction = Double(player.currentTime) / Double(player.maximumDuration) 88 | self._playbackViewController?.setProgress(progress: CGFloat(fraction), animated: true) 89 | } 90 | 91 | public func playerPlaybackWillLoop(_ player: Player) { 92 | self. _playbackViewController?.reset() 93 | } 94 | 95 | } 96 | ``` 97 | 98 | ## Documentation 99 | 100 | You can find [the docs here](http://piemonte.github.io/Player/). Documentation is generated with [jazzy](https://github.com/realm/jazzy) and hosted on [GitHub-Pages](https://pages.github.com). 101 | 102 | ## Community 103 | 104 | - Need help? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/player-swift) with the tag 'player-swift'. 105 | - Questions? Use [Stack Overflow](http://stackoverflow.com/questions/tagged/player-swift) with the tag 'player-swift'. 106 | - Found a bug? Open an [issue](https://github.com/piemonte/player/issues). 107 | - Feature idea? Open an [issue](https://github.com/piemonte/player/issues). 108 | - Want to contribute? Submit a [pull request](https://github.com/piemonte/player/pulls). 109 | 110 | ## Resources 111 | 112 | * [Swift Evolution](https://github.com/apple/swift-evolution) 113 | * [AV Foundation Programming Guide](https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html) 114 | * [Next Level](https://github.com/NextLevel/NextLevel/), rad media capture in Swift 115 | * [PBJVision](https://github.com/piemonte/PBJVision), iOS camera engine, features touch-to-record video, slow motion video, and photo capture 116 | * [PBJVideoPlayer](https://github.com/piemonte/PBJVideoPlayer), a simple iOS video player library, written in obj-c 117 | 118 | ## License 119 | 120 | Player is available under the MIT license, see the [LICENSE](https://github.com/piemonte/player/blob/master/LICENSE) file for more information. 121 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcuserdata/egonzales.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Cards.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | Player.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 2 16 | 17 | Pods-Demo.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 3 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcuserdata/paolocuscela.xcuserdatad/xcschemes/Cards.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcuserdata/paolocuscela.xcuserdatad/xcschemes/Player.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcuserdata/paolocuscela.xcuserdatad/xcschemes/Pods-Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Demo/Pods/Pods.xcodeproj/xcuserdata/paolocuscela.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Cards.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Player.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | Pods-Demo.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/Cards-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Cards : NSObject 3 | @end 4 | @implementation PodsDummy_Cards 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/Cards-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 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/Cards-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 CardsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char CardsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/Cards.modulemap: -------------------------------------------------------------------------------- 1 | framework module Cards { 2 | umbrella header "Cards-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/Cards.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Cards 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Player" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = -framework "UIKit" 5 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Cards/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.3.5 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/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 | 0.13.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/Player-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Player : NSObject 3 | @end 4 | @implementation PodsDummy_Player 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/Player-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 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/Player-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 PlayerVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char PlayerVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/Player.modulemap: -------------------------------------------------------------------------------- 1 | framework module Player { 2 | umbrella header "Player-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Player/Player.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Player 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}/Player 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/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 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Cards 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 PaoloCuscela 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## Player 30 | 31 | The MIT License (MIT) 32 | 33 | Copyright (c) 2014-present patrick piemonte (http://patrickpiemonte.com/) 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | 53 | Generated by CocoaPods - https://cocoapods.org 54 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2017 PaoloCuscela 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | Cards 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | The MIT License (MIT) 49 | 50 | Copyright (c) 2014-present patrick piemonte (http://patrickpiemonte.com/) 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining a copy 53 | of this software and associated documentation files (the "Software"), to deal 54 | in the Software without restriction, including without limitation the rights 55 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 56 | copies of the Software, and to permit persons to whom the Software is 57 | furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all 60 | copies or substantial portions of the Software. 61 | 62 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 65 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 66 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 68 | SOFTWARE. 69 | 70 | License 71 | MIT 72 | Title 73 | Player 74 | Type 75 | PSGroupSpecifier 76 | 77 | 78 | FooterText 79 | Generated by CocoaPods - https://cocoapods.org 80 | Title 81 | 82 | Type 83 | PSGroupSpecifier 84 | 85 | 86 | StringsTable 87 | Acknowledgements 88 | Title 89 | Acknowledgements 90 | 91 | 92 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Demo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Demo 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | 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}\"" 80 | 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}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # 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. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | 145 | if [[ "$CONFIGURATION" == "Debug" ]]; then 146 | install_framework "${BUILT_PRODUCTS_DIR}/Cards/Cards.framework" 147 | install_framework "${BUILT_PRODUCTS_DIR}/Player/Player.framework" 148 | fi 149 | if [[ "$CONFIGURATION" == "Release" ]]; then 150 | install_framework "${BUILT_PRODUCTS_DIR}/Cards/Cards.framework" 151 | install_framework "${BUILT_PRODUCTS_DIR}/Player/Player.framework" 152 | fi 153 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 154 | wait 155 | fi 156 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-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_DemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_DemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Cards" "${PODS_CONFIGURATION_BUILD_DIR}/Player" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Cards/Cards.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Player/Player.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "Cards" -framework "Player" 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 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Demo { 2 | umbrella header "Pods-Demo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Cards" "${PODS_CONFIGURATION_BUILD_DIR}/Player" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Cards/Cards.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Player/Player.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "Cards" -framework "Player" 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 | -------------------------------------------------------------------------------- /Images/CardGroupSliding.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/CardGroupSliding.gif -------------------------------------------------------------------------------- /Images/CardPlayer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/CardPlayer.gif -------------------------------------------------------------------------------- /Images/CardViewStoryboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/CardViewStoryboard.png -------------------------------------------------------------------------------- /Images/Customization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/Customization.png -------------------------------------------------------------------------------- /Images/Delegates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/Delegates.png -------------------------------------------------------------------------------- /Images/DetailView.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/DetailView.gif -------------------------------------------------------------------------------- /Images/DetailViewStoryboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/DetailViewStoryboard.png -------------------------------------------------------------------------------- /Images/GetStarted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/GetStarted.png -------------------------------------------------------------------------------- /Images/Header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/Header.png -------------------------------------------------------------------------------- /Images/Home Wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/Home Wiki.png -------------------------------------------------------------------------------- /Images/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/Icon.png -------------------------------------------------------------------------------- /Images/OverviewWiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaoloCuscela/Cards/cfaa2a92cb699f88348b58c04583709a7264ddc8/Images/OverviewWiki.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 PaoloCuscela 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | GitHub Stars 5 | 6 | Pod Version 8 | 9 | Platform 11 | 12 | License 14 |

15 | 16 | ![Overview](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Header.png) 17 | 18 |

Cards brings to Xcode the card views seen in the new iOS XI Appstore.

19 | 20 | ## Getting Started 21 | 22 | ### Storyboard 23 | - Go to **main.storyboard** and add a **blank UIView** 24 | - Open the **Identity Inspector** and type '**CardHighlight**' the '**class**' field 25 | - Make sure you have '**Cards**' selected in '**Module**' field 26 | - Switch to the **Attributes Inspector** and **configure** it as you like. 27 | 28 | ![CardViewStoryboard](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/CardViewStoryboard.png) 29 | 30 | * Drag a blank **UIViewController** and design its view as you like 31 | * Move to the **Identity inspector** 32 | * Type '**CardContent**' in the **StoryboardID** field. 33 | 34 | ![DetailViewStoryboard](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/DetailViewStoryboard.png) 35 | 36 | ### Code 37 | ```swift 38 | import Cards 39 | 40 | // Aspect Ratio of 5:6 is preferred 41 | let card = CardHighlight(frame: CGRect(x: 10, y: 30, width: 200 , height: 240)) 42 | 43 | card.backgroundColor = UIColor(red: 0, green: 94/255, blue: 112/255, alpha: 1) 44 | card.icon = UIImage(named: "flappy") 45 | card.title = "Welcome \nto \nCards !" 46 | card.itemTitle = "Flappy Bird" 47 | card.itemSubtitle = "Flap That !" 48 | card.textColor = UIColor.white 49 | 50 | card.hasParallax = true 51 | 52 | let cardContentVC = storyboard!.instantiateViewController(withIdentifier: "CardContent") 53 | card.shouldPresent(cardContentVC, from: self, fullscreen: false) 54 | 55 | view.addSubview(card) 56 | ``` 57 | 58 | ![GetStarted](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/GetStarted.png) 59 | 60 | ## Prerequisites 61 | 62 | - **Xcode 10.2** or newer 63 | - **Swift 5.0** 64 | 65 | ## Installation 66 | 67 | ### Cocoapods 68 | ```ruby 69 | use_frameworks! 70 | pod 'Cards' 71 | ``` 72 | ### Manual 73 | - **Download** the repo 74 | - ⌘C ⌘V the **'Cards' folder** in your project 75 | - In your **Project's Info** go to '**Build Phases**' 76 | - Open '**Compile Sources**' and **add all the files** in the folder 77 | 78 | ## Overview 79 | 80 |

81 | 82 | 83 | 84 |

85 | 86 | ## Customization 87 | 88 | ```swift 89 | //Shadow settings 90 | var shadowBlur: CGFloat 91 | var shadowOpacity: Float 92 | var shadowColor: UIColor 93 | var backgroundImage: UIImage? 94 | var backgroundColor: UIColor 95 | 96 | var textColor: UIColor //Color used for the labels 97 | var insets: CGFloat //Spacing between content and card borders 98 | var cardRadius: CGFloat //Corner radius of the card 99 | var icons: [UIImage]? //DataSource for CardGroupSliding 100 | var blurEffect: UIBlurEffectStyle //Blur effect of CardGroup 101 | ``` 102 | 103 | ## Usage 104 | 105 | ### CardPlayer 106 | ```swift 107 | let card = CardPlayer(frame: CGRect(x: 40, y: 50, width: 300 , height: 360)) 108 | card.textColor = UIColor.black 109 | card.videoSource = URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") 110 | card.shouldDisplayPlayer(from: self) //Required. 111 | 112 | card.playerCover = UIImage(named: "mvBackground")! // Shows while the player is loading 113 | card.playImage = UIImage(named: "CardPlayerPlayIcon")! // Play button icon 114 | 115 | card.isAutoplayEnabled = true 116 | card.shouldRestartVideoWhenPlaybackEnds = true 117 | 118 | card.title = "Big Buck Bunny" 119 | card.subtitle = "Inside the extraordinary world of Buck Bunny" 120 | card.category = "today's movie" 121 | 122 | view.addSubview(card) 123 | ``` 124 | 125 | ### CardGroupSliding 126 | ```swift 127 | let icons: [UIImage] = [ 128 | 129 | UIImage(named: "grBackground")!, 130 | UIImage(named: "background")!, 131 | UIImage(named: "flappy")!, 132 | UIImage(named: "flBackground")!, 133 | UIImage(named: "icon")!, 134 | UIImage(named: "mvBackground")! 135 | 136 | ] // Data source for CardGroupSliding 137 | 138 | let card = CardGroupSliding(frame: CGRect(x: 40, y: 50, width: 300 , height: 360)) 139 | card.textColor = UIColor.black 140 | 141 | card.icons = icons 142 | card.iconsSize = 60 143 | card.iconsRadius = 30 144 | 145 | card.title = "from the editors" 146 | card.subtitle = "Welcome to XI Cards !" 147 | 148 | view.addSubview(card) 149 | ``` 150 | 151 | ## Documentation 152 | 153 | See the **Wiki**, to learn in depth infos about Cards. 154 | [GO!](https://github.com/PaoloCuscela/Cards/wiki) 155 | 156 | ## Issues & Feature requests 157 | 158 | If you encounter any problems or have any trouble using Cards, feel free to open an issue. I'll answer you as soon as I see it. 159 | 160 | New features, or improvements to the framework are welcome (open an issue). 161 | 162 | ## Thanksto 163 | 164 | - **Patrick Piemonte** - providing [Player](https://github.com/piemonte/Player) framework used in [CardPlayer.swift](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Cards/CardPlayer.swift) 165 | - **Mac Bellingrath** 166 | 167 | ## License 168 | 169 | Cards is released under the [MIT License](LICENSE). 170 | -------------------------------------------------------------------------------- /Wiki/Customization.md: -------------------------------------------------------------------------------- 1 | ![https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Customization.png](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Customization.png) 2 | 3 | # Common parameters 4 | 5 | ## Shadows 6 | 7 | 8 | ``` 9 | @IBInspectable public var shadowBlur: CGFloat = 14 // How much blur is applied to the shadow 10 | @IBInspectable public var shadowOpacity: Float = 0.6 // Alpha value of the shadow 11 | @IBInspectable public var shadowColor: UIColor = UIColor.gray // Color of the shadow 12 | ``` 13 | 14 | ## Card Content 15 | 16 | 17 | ```swift 18 | open var backgroundColor: UIColor? // Color of the Card's layer 19 | @IBInspectable public var backgroundImage: UIImage? // Image displayed below content 20 | @IBInspectable public var textColor: UIColor = UIColor.black // Text color of every label inside the Card content 21 | @IBInspectable public var cardRadius: CGFloat = 20 // Corner radius of the Card's layer 22 | @IBInspectable public var contentInset: CGFloat = 6 // The insets of the content inside the card's view ( in % ) 23 | open var detailView: UIView? // The view shown as content when the detail is presented 24 | 25 | ``` 26 | 27 | ## Behaviour 28 | 29 | ``` 30 | @IBInspectable public var shouldPresentDetailView: Bool = true // If the detail should be presented or not 31 | var delegate: CardDelegate? // Delegate protocol for intercepting actions 32 | ``` 33 | 34 | ![Cards](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/Overview.png) 35 | 36 | # Card Highlight 37 | 38 | ## Content 39 | 40 | 41 | ``` 42 | @IBInspectable public var title: String // Highlight title text 43 | @IBInspectable public var itemTitle: String // Title of the item at the bottom of the card 44 | @IBInspectable public var itemSubtitle: String // Subitle of the item at the bottom of the card 45 | @IBInspectable public var buttonText: String // Text of the button 46 | @IBInspectable public var icon: UIImage? // Image for the icon 47 | /* If no background image is set, the card will show a faded icon in the top-right corner of the card */ 48 | ``` 49 | 50 | ## Content settings 51 | 52 | ``` 53 | @IBInspectable public var titleSize:CGFloat = 26 // Max font size for the title 54 | @IBInspectable public var itemTitleSize:CGFloat = 16 // Max font size for the itemTitle 55 | @IBInspectable public var itemSubitleSize:CGFloat = 14 // Max font size for the itemSubtitle 56 | @IBInspectable public var iconRadius: CGFloat = 16 // Corner radius for the icon 57 | 58 | ``` 59 | 60 | # Card Article 61 | 62 | ## Content 63 | 64 | 65 | ``` 66 | @IBInspectable public var title: String 67 | @IBInspectable public var subtitle: String 68 | @IBInspectable public var category: String // Text for the label on top of the title 69 | 70 | ``` 71 | 72 | ## Content settings 73 | 74 | ``` 75 | @IBInspectable public var titleSize:CGFloat = 26 76 | @IBInspectable public var subitleSize:CGFloat = 17 77 | @IBInspectable public var blurEffect: UIBlurEffectStyle = .extraLight // The style of the blur effect below content 78 | 79 | ``` 80 | 81 | # Card Group 82 | 83 | ## Content 84 | 85 | 86 | ``` 87 | @IBInspectable public var title: String 88 | @IBInspectable public var subtitle: String 89 | 90 | ``` 91 | 92 | ## Content settings 93 | 94 | ``` 95 | @IBInspectable public var titleSize:CGFloat = 26 96 | @IBInspectable public var subitleSize:CGFloat = 17 97 | @IBInspectable public var blurEffect: UIBlurEffectStyle = .extraLight 98 | 99 | ``` 100 | 101 | # Card Group Sliding (CardGroup) 102 | 103 | ## Content 104 | 105 | 106 | ``` 107 | [...] 108 | public var icons: [UIImage]? // Data source for the sliding view 109 | 110 | ``` 111 | 112 | ## Content settings 113 | 114 | ``` 115 | [...] 116 | @IBInspectable public var iconsSize: CGFloat = 80 // Size for the icons in the sliding view 117 | @IBInspectable public var iconsRadius: CGFloat = 40 // Corner radius for the icons in the sliding view 118 | ``` 119 | 120 | 121 | # Card Player 122 | 123 | ## Content 124 | 125 | 126 | ``` 127 | @IBInspectable public var title: String 128 | @IBInspectable public var subtitle: String 129 | @IBInspectable public var category: String 130 | open var player = Player() // The player from 131 | patrickpiemonte 132 | 133 | ``` 134 | 135 | ## Content settings 136 | 137 | ``` 138 | @IBInspectable public var titleSize:CGFloat = 26 139 | @IBInspectable public var subitleSize:CGFloat = 17 140 | @IBInspectable public var playBtnSize: CGFloat = 56 // Size for the Play/Pause button 141 | @IBInspectable public var playImage: UIImage? // Image for the play icon (if you don't have any download the one in the assets folder of the Demo project) 142 | @IBInspectable public var playerCover: UIImage? // The image shown while the player is buffering 143 | @IBInspectable public var videoSource: URL? // URL Path for the video ( streaming or local ) 144 | /* If you're going to stream a video from an http source remember to set 145 | App Transport Security Settings -> Allow Arbitrary Loads to "YES" in your info.plist file */ 146 | 147 | ``` 148 | 149 | ## Behaviour 150 | 151 | ``` 152 | @IBInspectable public var isAutoplayEnabled: Bool = false // If the card should (or not) play the video whenever the player is ready 153 | @IBInspectable public var shouldRestartVideoWhenPlaybackEnds: Bool = true // If the player should start the video from beginning when it ends 154 | 155 | ``` 156 | -------------------------------------------------------------------------------- /Wiki/Installation guide.md: -------------------------------------------------------------------------------- 1 | ![https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/OverviewWiki.png](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/OverviewWiki.png) 2 | 3 | # Installation guide 4 | 5 | ## Cocoapods 6 | 7 | - Make sure you have **Cocoapods Command Line** installed on your Mac 8 | - Open Terminal app and move to your project folder: 9 | 10 | ``` 11 | cd ~/path/to/your/project/ 12 | ``` 13 | 14 | - Init a new Podfile: 15 | 16 | ``` 17 | pod init 18 | ``` 19 | 20 | - Paste this below #Pods for 'Your project' in the pod file 21 | 22 | ``` 23 | pod 'Cards' 24 | ``` 25 | 26 | - Save, return to terminal and do a pod install 27 | 28 | ``` 29 | pod install 30 | ``` 31 | 32 | 33 | ## Manual 34 | - **Download** the repo 35 | - ⌘C ⌘V the **'Cards' folder** in your project 36 | - In your **Project's Info** go to **'Build Phases'** 37 | - Open '**Compile Sources**' and **add all the files** in the folder 38 | 39 | 40 | # Creating your first card 41 | 42 | ## Storyboard 43 | - Go to **main.storyboard** and add a **blank UIView** 44 | - Open the **Identity Inspector** and type '**CardHighlight**' the '**class**' field 45 | - Switch to the **Attributes Inspector** and **configure** it as you like. (See [Configuration](https://github.com/PaoloCuscela/Cards/wiki/Customization) for a detailed overview of all the attributes. ) 46 | 47 | ![CardViewStoryboard](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/CardViewStoryboard.png) 48 | 49 | * Drag a blank **UIViewController** and design its view as you like 50 | * Move to the **Identity inspector** and type '**CardContent**' in the **StoryboardID** field 51 | 52 | ![DetailViewStoryboard](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/DetailViewStoryboard.png) 53 | 54 | - Now while holding **cmd** drag the card from the **Storyboard** to your **ViewController** swift file and name the new @IBOutlet **"card"** 55 | - In **''viewDidLoad()"** method init your **CardContent** view controller and assign its view to card.detailView 56 | 57 | ```swift 58 | let detailVC = storyboard?.instantiateViewController(withIdentifier: "CardContent") 59 | // Or init a new one and programmatically design its view 60 | card.detailView = detailVC?.view 61 | ``` 62 | 63 | 64 | ## From Code 65 | 66 | ```swift 67 | // Aspect Ratio of 5:6 is preferred 68 | let card = CardHighlight(frame: CGRect(x: 10, y: 30, width: 200 , height: 240)) 69 | card.backgroundColor = UIColor(red: 0, green: 94/255, blue: 112/255, alpha: 1) 70 | card.icon = UIImage(named: "flappy") 71 | card.title = "Welcome \nto \nCards !" 72 | card.itemTitle = "Flappy Bird" 73 | card.itemSubtitle = "Flap That !" 74 | card.textColor = UIColor.white 75 | 76 | let detailVC = storyboard?.instantiateViewController(withIdentifier: "CardContent") 77 | // Or init a new one and programmatically design its view 78 | card.detailView = detailVC?.view 79 | 80 | view.addSubview(card) 81 | ``` 82 | 83 | ![GetStarted](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/GetStarted.png) 84 | ![DetailView](https://raw.githubusercontent.com/PaoloCuscela/Cards/master/Images/DetailView.gif) 85 | --------------------------------------------------------------------------------