Skip to content

Commit bdba539

Browse files
author
Lorenzo
committed
Merge branch 'release/0.3.1'
2 parents 3cb1e44 + f18a8b2 commit bdba539

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

ALTableView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = "ALTableView"
11-
s.version = "0.3.0"
11+
s.version = "0.3.1"
1212
s.summary = "An easy way to manage UITableView and UITableViewController"
1313

1414
# This description is used to generate tags and improve search results.

ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableView.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class ALTableView: NSObject {
2222
public weak var editingDelegate: ALTableViewRowEditingProtocol?
2323
public weak var viewController: UIViewController?
2424
public weak var tableView: UITableView?
25-
public var editingAllowed: Bool
2625
public var movingRowsAllowed: Bool
2726

2827

@@ -31,11 +30,9 @@ public class ALTableView: NSObject {
3130
public init(sectionElements: Array<ALSectionElement>,
3231
viewController: UIViewController,
3332
tableView: UITableView,
34-
editingAllowed: Bool = false,
3533
movingRowsAllowed: Bool = false) {
3634

3735
self.sectionElements = sectionElements
38-
self.editingAllowed = editingAllowed
3936
self.movingRowsAllowed = movingRowsAllowed
4037
super.init()
4138
self.viewController = viewController

ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/ALTableView/ALTableViewEditingManaging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ extension ALTableView {
3333
}
3434

3535
public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
36-
37-
return editingAllowed
36+
let canEditRow = self.getSectionElementAt(index: indexPath.section)?.getRowElementAt(index: indexPath.row)?.editingAllowed ?? false
37+
return canEditRow
3838
}
3939

4040
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {

ALTableViewSwift/ALTableView/ALTableView/ALTableViewClasses/Elements/Row/ALRowElement.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,28 @@ public class ALRowElement: ALElement, ALRowElementProtocol {
4747
private var className: AnyClass //TODO es posible que el className no sea necesario
4848

4949
private let cellStyle: UITableViewCell.CellStyle
50+
internal var editingAllowed: Bool
5051

5152
private var pressedHandler: ALCellPressedHandler?
5253
private var createdHandler: ALCellCreatedHandler?
5354
private var deselectedHandler: ALCellDeselectedHandler?
5455

5556
//MARK: - Initializers
5657

57-
public init(className: AnyClass, identifier: String, dataObject: Any?, cellStyle: UITableViewCell.CellStyle = .default, estimateHeightMode: Bool = false, height: CGFloat = 44.0, pressedHandler: ALCellPressedHandler? = nil, createdHandler: ALCellCreatedHandler? = nil, deselectedHandler: ALCellDeselectedHandler? = nil) {
58+
public init(className: AnyClass,
59+
identifier: String,
60+
dataObject: Any?,
61+
cellStyle: UITableViewCell.CellStyle = .default,
62+
estimateHeightMode: Bool = false,
63+
height: CGFloat = 44.0,
64+
editingAllowed: Bool = false,
65+
pressedHandler: ALCellPressedHandler? = nil,
66+
createdHandler: ALCellCreatedHandler? = nil,
67+
deselectedHandler: ALCellDeselectedHandler? = nil) {
5868

5969
self.className = className
6070
self.cellStyle = cellStyle
71+
self.editingAllowed = editingAllowed
6172
self.pressedHandler = pressedHandler
6273
self.createdHandler = createdHandler
6374
self.deselectedHandler = deselectedHandler

ALTableViewSwift/ALTableView/ALTableView/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.3.0</string>
18+
<string>0.3.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

ALTableViewSwift/TestALTableView/TestALTableView/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.2.0</string>
18+
<string>0.3.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
<key>LSRequiresIPhoneOS</key>

ALTableViewSwift/TestALTableView/TestALTableView/MasterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class MasterViewController: UITableViewController, ALTableViewProtocol {
6262
var sectionElements = [ALSectionElement]()
6363
for _ in 0...4 {
6464
var rowElements = Array<ALRowElement>()
65-
let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true)
65+
let rowElement = ALRowElement(className:MasterTableViewCell.classForCoder(), identifier: MasterTableViewCell.reuseIdentifier, dataObject: "Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1Texto 1", estimateHeightMode: true, editingAllowed: true)
6666
let rowElement2 = ALRowElement(className:Master2TableViewCell.classForCoder(), identifier: Master2TableViewCell.reuseIdentifier, dataObject: 12, estimateHeightMode: true)
6767
rowElements.append(rowElement)
6868
rowElements.append(rowElement2)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The development of the Objective-C part of this project has been discontinued. T
88

99
This framework is still on development. We cannot guarantee yet that all the features work.
1010

11-
The latest stable version for swift is [0.3.0](https://github.com/ALiOSDev/ALTableView/tree/0.3.0), which includes support for swift 4.2
11+
The latest stable version for swift is [0.3.1](https://github.com/ALiOSDev/ALTableView/tree/0.3.1), which includes support for swift 4.2
1212

1313

1414
**CocoaPods**

0 commit comments

Comments
 (0)