Skip to content

Instantly share code, notes, and snippets.

@cliss
Created January 23, 2020 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliss/db6835d00194731f0661861c766ad373 to your computer and use it in GitHub Desktop.
Save cliss/db6835d00194731f0661861c766ad373 to your computer and use it in GitHub Desktop.
import UIKit
public typealias RowSectionPair = (row: Int, section: Int)
extension IndexPath: RawRepresentable {
public typealias RawValue = RowSectionPair
public init?(rawValue: RowSectionPair) {
self = IndexPath(row: rawValue.row, section: rawValue.section)
}
public var rawValue: RowSectionPair {
return RowSectionPair(row: self.row, section: self.section)
}
}
let indexPath = IndexPath(rawValue: RowSectionPair(row: 43, section: 1))!
print("Section \(indexPath.section) row \(indexPath.row)")
enum Rows: IndexPath {
}
@cliss
Copy link
Author

cliss commented Jan 23, 2020

Screen Shot 2020-01-23 at 8 32 58 AM

ಠ_ಠ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment