Skip to content

Commit

Permalink
Merge pull request #14 from lojals/feat/change-identity
Browse files Browse the repository at this point in the history
Add features for V4.0.0
  • Loading branch information
lojals committed Nov 1, 2020
2 parents eab91e7 + c693c3d commit e2ed075
Show file tree
Hide file tree
Showing 27 changed files with 952 additions and 880 deletions.
2 changes: 1 addition & 1 deletion EmojiSelectorView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/lojals/EmojiSelectorView.git", :tag => s.version.to_s }
s.social_media_url = 'https://github.com/lojals'

s.ios.deployment_target = '10.0'
s.ios.deployment_target = '13.0'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.0' }
s.swift_version = '5.0'

Expand Down
168 changes: 87 additions & 81 deletions Example/EmojiSelectorView.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Example/EmojiSelectorView/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

Expand Down
156 changes: 148 additions & 8 deletions Example/EmojiSelectorView/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Example/EmojiSelectorView/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 2 additions & 0 deletions Example/EmojiSelectorView/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
65 changes: 65 additions & 0 deletions Example/EmojiSelectorView/SampleTableViewController.swift
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
}
}
74 changes: 74 additions & 0 deletions Example/EmojiSelectorView/SampleViewController.swift
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
}

}
98 changes: 0 additions & 98 deletions Example/EmojiSelectorView/ViewController.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use_frameworks!
platform :ios, '12.0'
platform :ios, '13.0'

target 'EmojiSelectorView_Example' do
pod 'EmojiSelectorView', :path => '../'
Expand Down
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
EmojiSelectorView: b658b7d87c27acdf5ffa4b6be828adf88b03109d
EmojiSelectorView: 54edeb0646f45013d6ff79e68290e54769c61ac8

PODFILE CHECKSUM: 51e94af6b43e01a708f019db669b91c92e99f4e7
PODFILE CHECKSUM: 928697acf9e5ca535d0967349d8d6904545adc18

COCOAPODS: 1.8.4
4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e2ed075

Please sign in to comment.