Reactions
Reactions copied to clipboard
How to set unselected reaction?
How to set unselected reaction once iboutlet did set?
i am using pod 'Reactions', '~> 1.1.1'
My first item selected reaction is a grey color. Just like its working on facebook reaction
@IBOutlet weak var reactionnButton: ReactionButton! {
didSet {
let select = ReactionSelector()
let reactionLike = Reaction(id: "id", title: "Like", color: .red, icon: #imageLiteral(resourceName: "like"))
let reactionAngry = Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "emoji_angry"))
let reactionEnvy = Reaction(id: "id", title: "Envy", color: .red, icon: #imageLiteral(resourceName: "emoji_envy"))
let reactionLove = Reaction(id: "id", title: "Love", color: .red, icon: #imageLiteral(resourceName: "emoji_love"))
let reactionSick = Reaction(id: "id", title: "Sick", color: .red, icon: #imageLiteral(resourceName: "emoji_sick"))
let reactionHappy = Reaction(id: "id", title: "Happy", color: .red, icon: #imageLiteral(resourceName: "emoji_happy"))
let reactionCrying = Reaction(id: "id", title: "Crying", color: .red, icon: #imageLiteral(resourceName: "emoji_crying"))
select.reactions = [
reactionLike,
reactionAngry,
reactionEnvy,
reactionLove,
reactionSick,
reactionHappy,
reactionCrying
]
//select.reactions = Reaction.facebook.all
//select.selectedReaction = Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "like-template"))
reactionnButton.reactionSelector = select
reactionnButton.config = ReactionButtonConfig() {
$0.iconMarging = 15
$0.spacing = 5
$0.font = UIFont(name: "ApexRounded-Book", size: 14)
$0.neutralTintColor = UIColor(red: 0.47, green: 0.47, blue: 0.47, alpha: 1)
$0.alignment = .centerLeft
}
reactionnButton.reactionSelector?.feedbackDelegate = self
// This one takes a value from ReactionSelector
reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .valueChanged)
// And this one from ReactionButton
reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .touchUpInside)
}
}