Skip to content

Commit 1536901

Browse files
committed
remove unneeded alias
1 parent ab2bf62 commit 1536901

File tree

3 files changed

+58
-62
lines changed

3 files changed

+58
-62
lines changed

Components/Sources/Common/Views/LabelView.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import UIKit
99
import ReactiveDataDisplayManager
1010

11-
public typealias LabelProperty = LabelView.Model.Property
12-
1311
/// Base view to implement label within cell
1412
public class LabelView: UIView {
1513

@@ -115,8 +113,8 @@ extension LabelView: ConfigurableItem {
115113

116114
// MARK: - Builder
117115

118-
public static func build(@EditorBuilder<Property> content: () -> [Property]) -> Self {
119-
return content().reduce(.init(), { model, editor in
116+
public static func build(@EditorBuilder<Property> content: (Property.Type) -> [Property]) -> Self {
117+
return content(Property.self).reduce(.init(), { model, editor in
120118
editor.edit(model)
121119
})
122120
}

Components/Sources/Common/Views/MessageView.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import UIKit
99
import ReactiveDataDisplayManager
1010

11-
public typealias MessageProperty = MessageView.Model.Property
12-
1311
/// Base view to implement label within cell
1412
public class MessageView: UIView {
1513

@@ -154,8 +152,8 @@ extension MessageView: ConfigurableItem {
154152

155153
// MARK: - Builder
156154

157-
public static func build(@EditorBuilder<Property> content: () -> [Property]) -> Self {
158-
return content().reduce(.init(), { model, editor in
155+
public static func build(@EditorBuilder<Property> content: (Property.Type) -> [Property]) -> Self {
156+
return content(Property.self).reduce(.init(), { model, editor in
159157
editor.edit(model)
160158
})
161159
}

Example/ReactiveDataDisplayManager/Table/ComponentsOverviewTableViewController/ComponentsOverviewTableViewController.swift

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -33,47 +33,47 @@ final class ComponentsOverviewTableViewController: UIViewController {
3333
// Recieved message time
3434
private let recievedMessageTimeStyle = TextStyle(color: .gray, font: .systemFont(ofSize: 12, weight: .light))
3535
private let recievedMessageTimeLayout = TextLayout(lineBreakMode: .byWordWrapping, numberOfLines: 0)
36-
private lazy var recievedMessageTimeModel: LabelView.Model = .build {
37-
LabelProperty.text(.string("17:05"))
38-
LabelProperty.style(recievedMessageTimeStyle)
39-
LabelProperty.layout(recievedMessageTimeLayout)
40-
LabelProperty.textAlignment(.left)
41-
LabelProperty.alignment(.leading(UIEdgeInsets(top: 12,
42-
left: 16,
43-
bottom: 12,
44-
right: 0)))
36+
private lazy var recievedMessageTimeModel: LabelView.Model = .build { property in
37+
property.text(.string("17:05"))
38+
property.style(recievedMessageTimeStyle)
39+
property.layout(recievedMessageTimeLayout)
40+
property.textAlignment(.left)
41+
property.alignment(.leading(UIEdgeInsets(top: 12,
42+
left: 16,
43+
bottom: 12,
44+
right: 0)))
4545
}
4646

4747
private lazy var recievedMessageTimeGenerator = LabelView.rddm.tableGenerator(with: recievedMessageTimeModel, and: .class)
4848

4949
// Sent message time
5050
private let sentTimeMessageStyle = TextStyle(color: .gray, font: .systemFont(ofSize: 12, weight: .light))
5151
private let sentTimeMessageLayout = TextLayout(lineBreakMode: .byWordWrapping, numberOfLines: 0)
52-
private lazy var sentTimeMessageModel: LabelView.Model = .build {
53-
LabelProperty.text(.string("17:32"))
54-
LabelProperty.style(sentTimeMessageStyle)
55-
LabelProperty.layout(sentTimeMessageLayout)
56-
LabelProperty.textAlignment(.right)
57-
LabelProperty.alignment(.trailing(UIEdgeInsets(top: 12,
58-
left: 0,
59-
bottom: 12,
60-
right: 16)))
52+
private lazy var sentTimeMessageModel: LabelView.Model = .build { property in
53+
property.text(.string("17:32"))
54+
property.style(sentTimeMessageStyle)
55+
property.layout(sentTimeMessageLayout)
56+
property.textAlignment(.right)
57+
property.alignment(.trailing(UIEdgeInsets(top: 12,
58+
left: 0,
59+
bottom: 12,
60+
right: 16)))
6161
}
6262

6363
private lazy var sentMessageTimeGenerator = LabelView.rddm.tableGenerator(with: sentTimeMessageModel, and: .class)
6464

6565
// Date
6666
private let dateStyle = TextStyle(color: .black, font: .systemFont(ofSize: 12, weight: .light))
6767
private let dateLayout = TextLayout(lineBreakMode: .byWordWrapping, numberOfLines: 0)
68-
private lazy var dateModel: LabelView.Model = .build {
69-
LabelProperty.text(.string("24 мая 2023"))
70-
LabelProperty.style(dateStyle)
71-
LabelProperty.layout(dateLayout)
72-
LabelProperty.textAlignment(.center)
73-
LabelProperty.alignment(.all(UIEdgeInsets(top: 0,
74-
left: 0,
75-
bottom: 12,
76-
right: 0)))
68+
private lazy var dateModel: LabelView.Model = .build { property in
69+
property.text(.string("24 мая 2023"))
70+
property.style(dateStyle)
71+
property.layout(dateLayout)
72+
property.textAlignment(.center)
73+
property.alignment(.all(UIEdgeInsets(top: 0,
74+
left: 0,
75+
bottom: 12,
76+
right: 0)))
7777
}
7878

7979
private lazy var dateGenerator = LabelView.rddm.tableGenerator(with: dateModel, and: .class)
@@ -83,25 +83,25 @@ final class ComponentsOverviewTableViewController: UIViewController {
8383
font: .systemFont(ofSize: 16, weight: .regular))
8484
private let sentMessageBorderStyle = BorderStyle(cornerRadius: 9,
8585
maskedCorners: [.layerMinXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMinYCorner])
86-
private lazy var sentMessageModel: MessageView.Model = .build {
86+
private lazy var sentMessageModel: MessageView.Model = .build { property in
8787
if Bool.random() {
88-
MessageProperty.background(.solid(.systemBlue))
88+
property.background(.solid(.systemBlue))
8989
} else {
90-
MessageProperty.background(.solid(.rddm))
90+
property.background(.solid(.rddm))
9191
}
92-
MessageProperty.border(sentMessageBorderStyle)
93-
MessageProperty.style(sentMessageStyle)
94-
MessageProperty.textAlignment(.right)
95-
MessageProperty.alignment(.trailing(UIEdgeInsets(top: 12,
96-
left: UIScreen.main.bounds.width / 2,
97-
bottom: 12,
98-
right: 16)
92+
property.border(sentMessageBorderStyle)
93+
property.style(sentMessageStyle)
94+
property.textAlignment(.right)
95+
property.alignment(.trailing(UIEdgeInsets(top: 12,
96+
left: UIScreen.main.bounds.width / 2,
97+
bottom: 12,
98+
right: 16)
9999
))
100-
MessageProperty.insets(UIEdgeInsets(top: 3,
101-
left: 5,
102-
bottom: 3,
103-
right: 5))
104-
MessageProperty.text(.string("Lorem"))
100+
property.insets(UIEdgeInsets(top: 3,
101+
left: 5,
102+
bottom: 3,
103+
right: 5))
104+
property.text(.string("Lorem"))
105105
}
106106

107107
private lazy var sentMessageGenerator = MessageView.rddm.tableGenerator(with: sentMessageModel, and: .class)
@@ -116,18 +116,18 @@ final class ComponentsOverviewTableViewController: UIViewController {
116116
],
117117
borderWidth: 1,
118118
borderColor: UIColor.black.cgColor)
119-
private lazy var recievedMessageModel: MessageView.Model = .build {
120-
MessageProperty.border(recievedMessageBorderStyle)
121-
MessageProperty.style(recievedMessageStyle)
122-
MessageProperty.alignment(.leading(UIEdgeInsets(top: 12,
123-
left: 16,
124-
bottom: 12,
125-
right: UIScreen.main.bounds.width / 2)))
126-
MessageProperty.insets(UIEdgeInsets(top: 3,
127-
left: 5,
128-
bottom: 3,
129-
right: 5))
130-
MessageProperty.text(.string("Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet"))
119+
private lazy var recievedMessageModel: MessageView.Model = .build { property in
120+
property.border(recievedMessageBorderStyle)
121+
property.style(recievedMessageStyle)
122+
property.alignment(.leading(UIEdgeInsets(top: 12,
123+
left: 16,
124+
bottom: 12,
125+
right: UIScreen.main.bounds.width / 2)))
126+
property.insets(UIEdgeInsets(top: 3,
127+
left: 5,
128+
bottom: 3,
129+
right: 5))
130+
property.text(.string("Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet"))
131131
}
132132

133133
private lazy var recievedMessageGenerator = MessageView.rddm.tableGenerator(with: recievedMessageModel, and: .class)

0 commit comments

Comments
 (0)