File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Pod ::Spec . new do |spec |
22 spec . name = 'Static'
3- spec . version = '4.0.1 '
3+ spec . version = '4.1.0 '
44 spec . summary = 'Simple static table views for iOS in Swift.'
55 spec . description = 'Static provides simple static table views for iOS in Swift.'
66 spec . homepage = 'https://github.com/venmo/static'
77 spec . license = { type : 'MIT' , file : 'LICENSE' }
88 spec . source = { git : 'https://github.com/venmo/Static.git' , tag : "v#{ spec . version } " }
99 spec . author = { 'Venmo' => 'ios@venmo.com' , 'Sam Soffes' => 'sam@soff.es' }
10-
11- spec . platform = :ios , '8.0'
10+ spec . ios . deployment_target = '11.0'
1211 spec . frameworks = 'UIKit'
1312 spec . source_files = 'Static/*.{swift,h}'
1413end
Original file line number Diff line number Diff line change @@ -264,6 +264,22 @@ extension DataSource: UITableViewDataSource {
264264 return rowAction
265265 }
266266 }
267+
268+ public func tableView( _ tableView: UITableView , leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath ) -> UISwipeActionsConfiguration ? {
269+ return row ( at: indexPath) ? . leadingSwipeActionsConfiguration. map {
270+ let actionsConfiguration = UISwipeActionsConfiguration ( actions: $0. actions)
271+ actionsConfiguration. performsFirstActionWithFullSwipe = $0. performsFirstActionWithFullSwipe
272+ return actionsConfiguration
273+ }
274+ }
275+
276+ public func tableView( _ tableView: UITableView , trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath ) -> UISwipeActionsConfiguration ? {
277+ return row ( at: indexPath) ? . trailingSwipeActionsConfiguration. map {
278+ let actionsConfiguration = UISwipeActionsConfiguration ( actions: $0. actions)
279+ actionsConfiguration. performsFirstActionWithFullSwipe = $0. performsFirstActionWithFullSwipe
280+ return actionsConfiguration
281+ }
282+ }
267283
268284 public func sectionIndexTitles( for tableView: UITableView ) -> [ String ] ? {
269285 guard let sectionIndexTitles = sectionIndexTitles, sectionIndexTitles. count >= sections. count else { return nil }
Original file line number Diff line number Diff line change @@ -103,6 +103,19 @@ public struct Row: Hashable, Equatable {
103103 self . selection = selection
104104 }
105105 }
106+
107+ /// Representation of the set of actions to perform when swiping on rows of a table.
108+ public struct SwipeActionsConfiguration {
109+ /// The swipe actions.
110+ public let actions : [ UIContextualAction ]
111+
112+ /// A Boolean value indicating whether a full swipe automatically performs the first action.
113+ public var performsFirstActionWithFullSwipe : Bool = true
114+
115+ public init ( actions: [ UIContextualAction ] ) {
116+ self . actions = actions
117+ }
118+ }
106119
107120 // MARK: - Properties
108121
@@ -135,9 +148,15 @@ public struct Row: Hashable, Equatable {
135148
136149 /// Actions to show when swiping the cell, such as Delete.
137150 public var editActions : [ EditAction ]
151+
152+ /// Returns the swipe actions to display on the leading edge of the row.
153+ public var leadingSwipeActionsConfiguration : SwipeActionsConfiguration ?
154+
155+ /// Returns the swipe actions to display on the trailing edge of the row.
156+ public var trailingSwipeActionsConfiguration : SwipeActionsConfiguration ?
138157
139158 var canEdit : Bool {
140- return editActions. count > 0
159+ return ( editActions. count > 0 ) || ( leadingSwipeActionsConfiguration != nil ) || ( trailingSwipeActionsConfiguration != nil )
141160 }
142161
143162 var isSelectable : Bool {
You can’t perform that action at this time.
0 commit comments