Skip to content

Commit

Permalink
Add runtime attributes update support
Browse files Browse the repository at this point in the history
  • Loading branch information
PaoloCuscela committed Nov 1, 2017
1 parent c844271 commit 20ed9ae
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 24 deletions.
3 changes: 0 additions & 3 deletions Cards/Sources/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ class Animator: NSObject, UIViewControllerAnimatedTransitioning {
let xMove = -( xDistance * bounceIntensity )
let yMove = -( yDistance * bounceIntensity )

//let xMove = (old.x < new.x ) ? LayoutHelper.XScreen(bounceIntensity) : -LayoutHelper.XScreen(bounceIntensity)
//let yMove = (old.y < new.y ) ? LayoutHelper.YScreen(bounceIntensity) : -LayoutHelper.YScreen(bounceIntensity)

return CGAffineTransform(translationX: xMove, y: yMove)
}

Expand Down
2 changes: 1 addition & 1 deletion Cards/Sources/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ import UIKit
}

func goParallax() {
let amount = 10
let amount = 20

let horizontal = UIInterpolatingMotionEffect(keyPath: "center.x", type: .tiltAlongHorizontalAxis)
horizontal.minimumRelativeValue = -amount
Expand Down
18 changes: 15 additions & 3 deletions Cards/Sources/CardArticle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,35 @@ import UIKit
/**
Text of the title label.
*/
@IBInspectable public var title: String = "The Art of the Impossible"
@IBInspectable public var title: String = "The Art of the Impossible" {
didSet{
titleLbl.text = title
}
}
/**
Max font size the title label.
*/
@IBInspectable public var titleSize: CGFloat = 26
/**
Text of the subtitle label.
*/
@IBInspectable public var subtitle: String = "Inside the extraordinary world of Monument Valley 2"
@IBInspectable public var subtitle: String = "Inside the extraordinary world of Monument Valley 2" {
didSet{
subtitleLbl.text = subtitle
}
}
/**
Max font size the subtitle label.
*/
@IBInspectable public var subtitleSize: CGFloat = 17
/**
Text of the category label.
*/
@IBInspectable public var category: String = "world premiere"
@IBInspectable public var category: String = "world premiere" {
didSet{
categoryLbl.text = category.uppercased()
}
}

//Priv Vars
var titleLbl = UILabel ()
Expand Down
18 changes: 15 additions & 3 deletions Cards/Sources/CardGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,35 @@ import UIKit
/**
Text of the title label.
*/
@IBInspectable public var title: String = "Welcome to XI Cards !"
@IBInspectable public var title: String = "Welcome to XI Cards !" {
didSet{
titleLbl.text = title
}
}
/**
Max font size the title label.
*/
@IBInspectable public var titleSize: CGFloat = 26
/**
Text of the subtitle label.
*/
@IBInspectable public var subtitle: String = "from the editors"
@IBInspectable public var subtitle: String = "from the editors" {
didSet{
subtitleLbl.text = subtitle.uppercased()
}
}
/**
Max font size the subtitle label.
*/
@IBInspectable public var subtitleSize: CGFloat = 26
/**
Style for the blur effect.
*/
@IBInspectable public var blurEffect: UIBlurEffectStyle = .extraLight
@IBInspectable public var blurEffect: UIBlurEffectStyle = .extraLight {
didSet{
blurV.effect = UIBlurEffect(style: blurEffect)
}
}

//Priv Vars
var subtitleLbl = UILabel ()
Expand Down
12 changes: 10 additions & 2 deletions Cards/Sources/CardGroupSliding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ import UIKit
/**
Size for the collection view items.
*/
@IBInspectable public var iconsSize: CGFloat = 80
@IBInspectable public var iconsSize: CGFloat = 80 {
didSet{
slidingCV.reloadData()
}
}
/**
Corner radius of the collection view items
*/
@IBInspectable public var iconsRadius: CGFloat = 40
@IBInspectable public var iconsRadius: CGFloat = 40 {
didSet{
slidingCV.reloadData()
}
}

/**
Data source for the collection view.
Expand Down
33 changes: 28 additions & 5 deletions Cards/Sources/CardHighlight.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,58 @@ import UIKit
/**
Text of the title label.
*/
@IBInspectable public var title: String = "welcome \nto \ncards !"
@IBInspectable public var title: String = "welcome \nto \ncards !" {
didSet{
titleLbl.text = title.uppercased()
titleLbl.lineHeight(0.70)
}
}
/**
Max font size the title label.
*/
@IBInspectable public var titleSize:CGFloat = 26
/**
Text of the title label of the item at the bottom.
*/
@IBInspectable public var itemTitle: String = "Flappy Bird"
@IBInspectable public var itemTitle: String = "Flappy Bird" {
didSet{
itemTitleLbl.text = itemTitle
}
}
/**
Max font size the subtitle label of the item at the bottom.
*/
@IBInspectable public var itemTitleSize: CGFloat = 16
/**
Text of the subtitle label of the item at the bottom.
*/
@IBInspectable public var itemSubtitle: String = "Flap that !"
@IBInspectable public var itemSubtitle: String = "Flap that !" {
didSet{
itemSubtitleLbl.text = itemSubtitle
}
}
/**
Max font size the subtitle label of the item at the bottom.
*/
@IBInspectable public var itemSubtitleSize: CGFloat = 14
/**
Image displayed in the icon ImageView.
*/
@IBInspectable public var icon: UIImage?
@IBInspectable public var icon: UIImage? {
didSet{
iconIV.image = icon
bgIconIV.image = icon
}
}
/**
Corner radius for the icon ImageView
*/
@IBInspectable public var iconRadius: CGFloat = 16
@IBInspectable public var iconRadius: CGFloat = 16 {
didSet{
iconIV.layer.cornerRadius = iconRadius
bgIconIV.layer.cornerRadius = iconRadius*2
}
}
/**
Text for the card's button.
*/
Expand Down
40 changes: 33 additions & 7 deletions Cards/Sources/CardPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,59 @@ import Player
/**
Text of the title label.
*/
@IBInspectable public var title: String = "Big Buck Bunny"
@IBInspectable public var title: String = "Big Buck Bunny" {
didSet{
titleLbl.text = title
}
}
/**
Max font size of the title label.
*/
@IBInspectable public var titleSize: CGFloat = 26
/**
Text of the subtitle label.
*/
@IBInspectable public var subtitle: String = "Inside the extraordinary world of Buck Bunny"
@IBInspectable public var subtitle: String = "Inside the extraordinary world of Buck Bunny" {
didSet{
subtitleLbl.text = subtitle
}
}
/**
Max font size of the subtitle label.
*/
@IBInspectable public var subtitleSize: CGFloat = 19
/**
Text of the category label.
*/
@IBInspectable public var category: String = "today's movie"
@IBInspectable public var category: String = "today's movie" {
didSet{
categoryLbl.text = category.uppercased()
}
}
/**
Size for the play button in the player.
*/
@IBInspectable public var playBtnSize: CGFloat = 56
@IBInspectable public var playBtnSize: CGFloat = 56 {
didSet {
layout(animating: false)
}
}
/**
Image shown in the play button.
*/
@IBInspectable public var playImage: UIImage?
@IBInspectable public var playImage: UIImage? {
didSet {
playIV.image = playImage
}
}
/**
Image shown before the player is loaded.
*/
@IBInspectable public var playerCover: UIImage?
@IBInspectable public var playerCover: UIImage? {
didSet{
playerCoverIV.image = playerCover
}
}
/**
If the player should start the playback when is ready.
*/
Expand All @@ -56,7 +80,9 @@ import Player
Source for the video ( streaming or local ).
*/
@IBInspectable public var videoSource: URL? {
didSet { player.url = videoSource }
didSet {
player.url = videoSource
}
}

/**
Expand Down

0 comments on commit 20ed9ae

Please sign in to comment.