Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift3 conversion #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Swift3 conversion #48

wants to merge 5 commits into from

Conversation

eskizyen
Copy link

Converted the code to Swift 3.0, example project runs without any problem.

@gorbat-o
Copy link

Hi,
It's working for me,
verify the travis conf if it's swift 3 ?
thanks for update to 3
see ya

@@ -18,10 +18,10 @@ class CustomCell: Cell, CellType {
return
}

titleLabel.text = cellmodel.title + "(\(cellmodel.indexPath.section),\(cellmodel.indexPath.row))"
titleLabel.text = cellmodel.title + "(\((cellmodel.indexPath as NSIndexPath).section),\((cellmodel.indexPath as NSIndexPath).row))"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded casting

titleLabel.text = cellmodel.title + "(\(cellmodel.indexPath.section,\(cellmodel.indexPath.row))"

subscript(indexPath: NSIndexPath) -> CellModel? {
return self[indexPath.section][indexPath.row]
subscript(indexPath: IndexPath) -> CellModel? {
return self[(indexPath as NSIndexPath).section][(indexPath as NSIndexPath).row]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded casting

public func getCellmodel(indexPath: NSIndexPath) -> CellModel? {
return sections.get(indexPath.section)?[indexPath.row]
public func getCellmodel(_ indexPath: IndexPath) -> CellModel? {
return sections.get((indexPath as NSIndexPath).section)?[(indexPath as NSIndexPath).row]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded casting

return remove(indexes: [index])
}

func remove(range: Range<Int>) -> Self {
func remove(_ range: CountableClosedRange<Int>) -> Self {
let indexes = range.map { $0 }
return remove(indexes: indexes)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better if you add

func remove(_ range: CountableRange<Int>) -> Self {...}

delegate?.scrollViewDidScroll?(scrollView)

if let indexPath = tableView?.indexPathsForVisibleRows?.first {
let topSection = indexPath.section
let topSection = (indexPath as NSIndexPath).section

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded casting

.filter { $0 >= 0 && $0 < self.sectionsCount }

var remainSections: [Section] = []
var i = 0

for j in 0..<sectionsCount {
if let k = sortedIndexes.get(i) where k == j {
if let k = sortedIndexes.get(i) , k == j {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a space previous to ,

public func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
guard let view = view as? HeaderFooterView where section == willFloatingSection else {
public func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
guard let view = view as? HeaderFooterView , section == willFloatingSection else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a space previous to ,

.filter { $0 >= 0 && $0 < self.count }

var remainCellmodels: [CellModel] = []
var i = 0

for j in 0..<count {
if let k = sortedIndexes.get(i) where k == j {
if let k = sortedIndexes.get(i) , k == j {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a space previous to ,

func remove(range: Range<Int>) -> Self {
let indexes = range.map { $0 }
func remove(_ range: CountableClosedRange<Int>) -> Self {
let indexes = [Int](range)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better if you add

func remove(_ range: CountableRange<Int>) -> Self {...}

@ra1028
Copy link
Collaborator

ra1028 commented Oct 24, 2016

I think you should add @discardableResult to some functions that required it.

@eskizyen
Copy link
Author

eskizyen commented Nov 1, 2016

@ra1028 I updated the project according to your notes. Thanks for the review.

@ra1028
Copy link
Collaborator

ra1028 commented Nov 8, 2016

@eskizyen
I think, there are more functions that which you should to add @discardableResult! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants