Skip to content

Commit 88b3cc5

Browse files
committed
fix a11y issues
1 parent 9cab6d6 commit 88b3cc5

File tree

9 files changed

+34
-22
lines changed

9 files changed

+34
-22
lines changed

Components/Sources/Collection/CollectionWrappedCell.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ public final class CollectionWrappedCell<View: ConfigurableItem>: UICollectionVi
2828
extension CollectionWrappedCell: CalculatableHeightItem where View: CalculatableHeightItem {
2929

3030
public static func getHeight(forWidth width: CGFloat, with model: Model) -> CGFloat {
31-
return View.getHeight(forWidth: width, with: model)
31+
let nestedViewHeight = View.getHeight(forWidth: width, with: model)
32+
if let alignment = (model as? AlignmentProvider)?.alignment {
33+
switch alignment {
34+
case .leading(let insets), .trailing(let insets), .all(let insets):
35+
return nestedViewHeight + insets.top + insets.bottom
36+
}
37+
} else {
38+
return nestedViewHeight
39+
}
3240
}
3341

3442
}
@@ -38,7 +46,15 @@ extension CollectionWrappedCell: CalculatableHeightItem where View: Calculatable
3846
extension CollectionWrappedCell: CalculatableWidthItem where View: CalculatableWidthItem {
3947

4048
public static func getWidth(forHeight height: CGFloat, with model: View.Model) -> CGFloat {
41-
return View.getWidth(forHeight: height, with: model)
49+
let nestedViewWidth = View.getWidth(forHeight: height, with: model)
50+
if let alignment = (model as? AlignmentProvider)?.alignment {
51+
switch alignment {
52+
case .leading(let insets), .trailing(let insets), .all(let insets):
53+
return nestedViewWidth + insets.left + insets.right
54+
}
55+
} else {
56+
return nestedViewWidth
57+
}
4258
}
4359

4460
}

Components/Sources/Table/TableWrappedCell.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ public final class TableWrappedCell<View: ConfigurableItem>: UITableViewCell, Vi
2828
extension TableWrappedCell: CalculatableHeightItem where View: CalculatableHeightItem {
2929

3030
public static func getHeight(forWidth width: CGFloat, with model: Model) -> CGFloat {
31-
return View.getHeight(forWidth: width, with: model)
31+
let nestedViewHeight = View.getHeight(forWidth: width, with: model)
32+
if let alignment = (model as? AlignmentProvider)?.alignment {
33+
switch alignment {
34+
case .leading(let insets), .trailing(let insets), .all(let insets):
35+
return nestedViewHeight + insets.top + insets.bottom
36+
}
37+
} else {
38+
return nestedViewHeight
39+
}
3240
}
3341

3442
}

Example/ReactiveDataDisplayManager/Application/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1919
UITabBar.appearance().tintColor = .rddm
2020
UITableView.appearance().sectionIndexColor = .rddm
2121
UICollectionView.appearance().tintColor = .rddm
22+
UITextView.appearance().adjustsFontForContentSizeCategory = true
2223
UILabel.appearance().adjustsFontForContentSizeCategory = true
2324
UIButton.appearance().adjustsImageSizeForAccessibilityContentSizeCategory = true
2425

Example/ReactiveDataDisplayManager/Collection/CollectionViewController/CollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private extension CollectionViewController {
6464
CollectionGenerators {
6565
titles.map { title -> CollectionCellGenerator in
6666
// Create generator
67-
let generator = TitleCollectionViewCell.rddm.baseGenerator(with: title)
67+
let generator = TitleCollectionViewCell.rddm.calculatableHeightGenerator(with: title, referencedWidth: 100)
6868
generator.didSelectEvent += {
6969
debugPrint("\(title) selected")
7070
}

Example/ReactiveDataDisplayManager/Collection/StackCellExampleCollectionViewController/StackCellExampleCollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ final class StackCellExampleCollectionViewController: UIViewController {
5353

5454
override func viewDidLoad() {
5555
super.viewDidLoad()
56-
title = "Stack cell collection"
56+
title = "Stack incide collection"
5757

5858
let flowLayout = makeFlowLayout()
5959
collectionView.setCollectionViewLayout(flowLayout, animated: false)

Example/ReactiveDataDisplayManager/Table/ComponentsOverviewTableViewController/ComponentsOverviewTableViewController.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,6 @@ final class ComponentsOverviewTableViewController: UIViewController {
100100
bottom: 3,
101101
right: 5))
102102
property.text(.string("Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet"))
103-
104-
let tapAction: () -> Void = {
105-
if var topController = UIApplication.shared.keyWindow?.rootViewController {
106-
while let presentedViewController = topController.presentedViewController {
107-
topController = presentedViewController
108-
}
109-
110-
let alertController = UIAlertController(title: "MessageView Tapped", message: "The MessageView was tapped!", preferredStyle: .alert)
111-
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
112-
topController.present(alertController, animated: true, completion: nil)
113-
}
114-
}
115-
116103
}
117104

118105
private lazy var sentMessageGenerator = MessageView.rddm.tableGenerator(with: sentMessageModel, and: .class)

Example/ReactiveDataDisplayManager/Table/DiffableTableViewController/DiffableTableViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ private extension DiffableTableViewController {
113113
generators: generators,
114114
header: EmptyTableHeaderGenerator(uniqueId: Constants.sectionId.appending("header")),
115115
footer: EmptyTableFooterGenerator(uniqueId: Constants.sectionId.appending("footer"))
116-
).decorate(with: .space(model: .init(size: .height(16), color: .rddm)),
116+
).decorate(with: .space(model: .init(size: .height(32), color: .rddm)),
117117
at: .end,
118-
and: .each)
118+
and: .first)
119119
.erased()
120120
}
121121

Example/ReactiveDataDisplayManager/Table/StackCellExampleViewController/StackCellExampleViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class StackCellExampleViewController: UIViewController {
3434

3535
override func viewDidLoad() {
3636
super.viewDidLoad()
37-
title = "Stack cell example view controller"
37+
title = "Stack inside table"
3838
tableView.accessibilityIdentifier = "Stack_Cell_Example_View_Controller"
3939
fillAdapter()
4040
}

Example/ReactiveDataDisplayManager/Table/TwoDirectionPaginatableTableViewController/TwoDirectionPaginatableTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class TwoDirectionPaginatableTableViewController: UIViewController {
6464

6565
override func viewDidLoad() {
6666
super.viewDidLoad()
67-
title = "Table with two directions pagination"
67+
title = "two directional pagination"
6868

6969
configureActivityIndicatorIfNeeded()
7070
loadFirstPage()

0 commit comments

Comments
 (0)