-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from lojals/feat/change-identity
Add features for V4.0.0
- Loading branch information
Showing
27 changed files
with
952 additions
and
880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// SampleTableViewController.swift | ||
// EmojiSelectorView_Example | ||
// | ||
// Created by Jorge Ovalle on 31/10/20. | ||
// Copyright © 2020 CocoaPods. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import EmojiSelectorView | ||
|
||
final class SampleTableViewController: UITableViewController { | ||
|
||
override func numberOfSections(in tableView: UITableView) -> Int { | ||
return 1 | ||
} | ||
|
||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return 10 | ||
} | ||
|
||
|
||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
return tableView.dequeueReusableCell(withIdentifier: "SampleCell", for: indexPath) | ||
} | ||
|
||
} | ||
|
||
final class CustomSelectorView: EmojiSelectorView, EmojiSelectorViewDataSource { | ||
|
||
let optionsDataset = [ | ||
(imageName: "img_1", title: "Like"), | ||
(imageName: "img_2", title: "Smile"), | ||
(imageName: "img_3", title: "Heart"), | ||
(imageName: "img_4", title: "Idea"), | ||
(imageName: "img_5", title: "Slow"), | ||
(imageName: "img_6", title: "Fast") | ||
] | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.dataSource = self | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
self.dataSource = self | ||
} | ||
|
||
func numberOfOptions(in selector: EmojiSelectorView) -> Int { | ||
optionsDataset.count | ||
} | ||
|
||
func emojiSelector(_ selector: EmojiSelectorView, viewForIndex index: Int) -> UIView { | ||
let option = optionsDataset[index].imageName | ||
guard let image = UIImage(named: option) else { | ||
return UIView() | ||
} | ||
return UIImageView(image: image) | ||
} | ||
|
||
func emojiSelector(_ selector: EmojiSelectorView, nameForIndex index: Int) -> String { | ||
optionsDataset[index].title | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// SampleViewController.swift | ||
// EmojiSelectorView | ||
// | ||
// Created by Jorge R Ovalle Z on 2/28/16. | ||
// | ||
|
||
import UIKit | ||
import EmojiSelectorView | ||
|
||
final class SampleViewController: UIViewController { | ||
|
||
@IBOutlet weak var selectorView: EmojiSelectorView! | ||
@IBOutlet weak var informationLabel: UILabel! | ||
|
||
let optionsDataset = [ | ||
(imageName: "img_1", title: "Like"), | ||
(imageName: "img_2", title: "Smile"), | ||
(imageName: "img_3", title: "Heart"), | ||
(imageName: "img_4", title: "Idea"), | ||
(imageName: "img_5", title: "Slow"), | ||
(imageName: "img_6", title: "Fast") | ||
] | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
selectorView.delegate = self | ||
selectorView.dataSource = self | ||
} | ||
|
||
} | ||
|
||
// MARK: EmojiSelectorViewDelegate | ||
extension SampleViewController: EmojiSelectorViewDelegate { | ||
|
||
func emojiSelector(_ sender: EmojiSelectorView, didSelectedIndex index: Int) { | ||
informationLabel.text = "Option \(index) selected" | ||
} | ||
|
||
func emojiSelector(_ sender: EmojiSelectorView, didChangeFocusTo index: Int?) { | ||
guard let index = index else { | ||
informationLabel.text = "Lose focus" | ||
return | ||
} | ||
|
||
informationLabel.text = "Focused on \(index) option" | ||
} | ||
|
||
func emojiSelectorDidCancelledAction(_ sender: EmojiSelectorView) { | ||
informationLabel.text = "User cancelled selection" | ||
} | ||
|
||
} | ||
|
||
// MARK: EmojiSelectorViewDataSource | ||
extension SampleViewController: EmojiSelectorViewDataSource { | ||
|
||
func numberOfOptions(in selector: EmojiSelectorView) -> Int { | ||
optionsDataset.count | ||
} | ||
|
||
func emojiSelector(_ selector: EmojiSelectorView, viewForIndex index: Int) -> UIView { | ||
let option = optionsDataset[index].imageName | ||
guard let image = UIImage(named: option) else { | ||
return UIView() | ||
} | ||
return UIImageView(image: image) | ||
} | ||
|
||
func emojiSelector(_ selector: EmojiSelectorView, nameForIndex index: Int) -> String { | ||
optionsDataset[index].title | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.