-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add support for copy action #81
base: master
Are you sure you want to change the base?
Conversation
Static/Row.swift
Outdated
@@ -134,7 +144,7 @@ public struct Row: Hashable, Equatable { | |||
// MARK: - Initializers | |||
|
|||
public init(text: String? = nil, detailText: String? = nil, selection: Selection? = nil, | |||
image: UIImage? = nil, accessory: Accessory = .None, cellClass: CellType.Type? = nil, context: Context? = nil, editActions: [EditAction] = [], UUID: String = NSUUID().UUIDString) { | |||
image: UIImage? = nil, accessory: Accessory = .None, cellClass: CellType.Type? = nil, context: Context? = nil, editActions: [EditAction] = [], copyAction: CopyAction? = nil, UUID: String = NSUUID().UUIDString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about reverting this whitespace change at the beginning of the line? Agreed that this init
takes in a lot of parameters and could use some better clarity, but it might be best to scope that out to a different PR. 😄
TIL about those other I'd love to have this more generic than only supporting Perhaps something like: enum RowAction {
case Copy(Row -> Void)
case Paste(Row -> Void)
} I've honestly not used this table view API enough to know use-cases! Would love to learn more. |
* commit '8a05589ea367f568542a536ad0bfe7d4731ddded': Update readme with Swift version compatibility table Update test target to Swift 2.3 Update to recommended build settings Migrate to Swift 2.3 Update podspec to 1.1.1 Add gitignore
946a03d
to
321e997
Compare
# Conflicts: # Example/CustomTableViewCell.swift # Example/ViewController.swift # Example/WindowController.swift # Static.podspec # Static.xcodeproj/project.pbxproj # Static/ButtonCell.swift # Static/Cell.swift # Static/DataSource.swift # Static/Row.swift # Static/Section.swift # Static/SubtitleCell.swift # Static/TableViewController.swift # Static/Value1Cell.swift # Static/Value2Cell.swift
Static/DataSource.swift
Outdated
// The parameter indexPath: IndexPath? is optinal for a purpose. See: https://openradar.appspot.com/31375101 | ||
public func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath?, withSender sender: Any?) -> Bool { | ||
guard let indexPath = indexPath else { return false } | ||
public func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool { | ||
return action == #selector(UIResponder.copy(_:)) && (row(at: indexPath)?.canCopy ?? false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be tied to a specific selector case?
Closes #80