Skip to content

Commit

Permalink
Changed public class to open class
Browse files Browse the repository at this point in the history
  • Loading branch information
younatics@gmail.com committed Mar 21, 2017
1 parent 3117b34 commit 2727e48
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Updates

## [v0.4.0](https://github.com/younatics/YNExpandableCell/releases/tag/0.4.0)
* Public to Open class

## [v0.3.1](https://github.com/younatics/YNExpandableCell/releases/tag/0.3.1)
* Change podspec image

Expand Down
2 changes: 1 addition & 1 deletion YNExpandableCell.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'YNExpandableCell'
s.version = '0.3.1'
s.version = '0.4.0'
s.summary = 'Easiest way to expand and collapse cell for iOS with Swift 3'

s.description = <<-DESC
Expand Down
14 changes: 7 additions & 7 deletions YNExpandableCell/YNExpandableCell/YNExpandableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import UIKit

/// Inherit YNExpandableCell when you want to use custom accessory type
public class YNExpandableCell: UITableViewCell {
open class YNExpandableCell: UITableViewCell {

/// Normal Custom Accessory Type change UIImage
public var normalCustomAccessoryType: UIImageView!
open var normalCustomAccessoryType: UIImageView!

/// Selected Custom Accessory Type change UIImage
public var selectedCustomAccessoryType: UIImageView!
open var selectedCustomAccessoryType: UIImageView!

/// Basic Init method
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
Expand All @@ -30,14 +30,14 @@ public class YNExpandableCell: UITableViewCell {
}

/// Basic awakeFromNib method
public override func awakeFromNib() {
open override func awakeFromNib() {
super.awakeFromNib()

self.initView()
}

/// Init method. override this method whatever you like. Mainly about Custom Accessory Type
public func initView() {
open func initView() {
let width = UIScreen.main.bounds.size.width
let height = self.frame.size.height

Expand All @@ -54,15 +54,15 @@ public class YNExpandableCell: UITableViewCell {
}

/// Normal function when cell is unclicked
public func normal() {
open func normal() {
self.selectedCustomAccessoryType.isHidden = true
self.normalCustomAccessoryType.isHidden = false

self.rotateAnimationFrom(selectedCustomAccessoryType, toItem: normalCustomAccessoryType, duration: 0.3)
}

/// Selected function when cell is clicked
public func selected() {
open func selected() {
self.selectedCustomAccessoryType.isHidden = false
self.normalCustomAccessoryType.isHidden = true

Expand Down
16 changes: 8 additions & 8 deletions YNExpandableCell/YNExpandableCell/YNTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate
- Parameter nibNames: [String]
- Parameter reuseIdentifiers: [String]
*/
public func registerCellsWith(nibNames: [String], and reuseIdentifiers: [String]) {
open func registerCellsWith(nibNames: [String], and reuseIdentifiers: [String]) {
self.checkValueIsSame(first: nibNames, second: reuseIdentifiers)

for i in 0..<nibNames.count {
Expand All @@ -63,7 +63,7 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate
- Parameter cells: [AnyClass]
- Parameter reuseIdentifiers: [String]
*/
public func registerCellsWith(cells: [AnyClass], and reuseIdentifiers: [String]) {
open func registerCellsWith(cells: [AnyClass], and reuseIdentifiers: [String]) {
self.checkValueIsSame(first: cells, second: reuseIdentifiers)

for i in 0..<cells.count {
Expand All @@ -87,21 +87,21 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate


/// Basic UITableViewDelegate: func numberOfSections(in tableView: UITableView) -> Int
public func numberOfSections(in tableView: UITableView) -> Int {
open func numberOfSections(in tableView: UITableView) -> Int {
guard let delegate = self.ynDelegate else { return Int() }
guard let numberOfSection = delegate.numberOfSections?(in: self) else { return Int() }
return numberOfSection
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard let delegate = self.ynDelegate else { return Int() }

return delegate.tableView(self, numberOfRowsInSection: section) + self.checkExpandRowIn(section: section)
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let delegate = self.ynDelegate else { return UITableViewCell() }

for expandedIndexPath in self.expandedIndexPaths {
Expand All @@ -125,7 +125,7 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate

}
/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let delegate = self.ynDelegate else { return }


Expand Down Expand Up @@ -153,7 +153,7 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath)
public func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
open func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
for expandedIndexPath in self.expandedIndexPaths {
let internalIndexPath = IndexPath(row: expandedIndexPath.row - 1, section: expandedIndexPath.section)

Expand All @@ -172,7 +172,7 @@ open class YNTableView: UITableView, UITableViewDataSource, UITableViewDelegate
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}

Expand Down
6 changes: 3 additions & 3 deletions YNExpandableCell/YNExpandableCell/YNTableViewExtenstion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import UIKit

extension YNTableView {
/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
public func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
guard let delegate = self.ynDelegate else { return nil }
guard let titleForHeaderInSection = delegate.tableView?(self, titleForHeaderInSection: section) else { return nil }

return titleForHeaderInSection
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
guard let delegate = self.ynDelegate else { return CGFloat() }
guard let heightForHeaderInSection = delegate.tableView?(self, heightForHeaderInSection: section) else { return CGFloat() }

return heightForHeaderInSection
}

/// Basic UITableViewDelegate: func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
guard let delegate = self.ynDelegate else { return nil }
guard let viewForHeaderInSection = delegate.tableView?(self, viewForHeaderInSection: section) else { return nil }
return viewForHeaderInSection
Expand Down

0 comments on commit 2727e48

Please sign in to comment.