Skip to content

Commit 73735ca

Browse files
committed
Release v3.2.0 for Swift 3.x
1 parent 76c692e commit 73735ca

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

GTChatKit.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'GTChatKit'
11-
s.version = '3.1.0'
11+
s.version = '3.2.0'
1212
s.summary = 'iOS ChatKit built on Texture(AsyncDisplayKit) and written in Swift'
1313

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

GTChatKit/Classes/Views/GTChatMessageBoxNode.swift

+24-24
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public class GTChatMessageBoxNode: ASDisplayNode {
1515

1616
@objc lazy open var messageNode = GTChatMessageInputBoxNode()
1717
open var messageBoxInsets: UIEdgeInsets = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0)
18-
private var leftButtonGroups: [GTChatMessageButtonNode] = []
19-
private var leftButtonGroupSpacing: CGFloat = 10.0
18+
fileprivate var leftButtonGroups: [GTChatMessageButtonNode] = []
19+
fileprivate var leftButtonGroupSpacing: CGFloat = 10.0
2020

21-
private var rightButtonGroups: [GTChatMessageButtonNode] = []
22-
private var rightButtonGroupSpacing: CGFloat = 10.0
21+
fileprivate var rightButtonGroups: [GTChatMessageButtonNode] = []
22+
fileprivate var rightButtonGroupSpacing: CGFloat = 10.0
2323

2424
fileprivate var minimumMessageBoxHeight: CGFloat = 50.0
2525
fileprivate var maximumVisibleMessageNumberOfLines: Int = 6
@@ -37,26 +37,26 @@ public class GTChatMessageBoxNode: ASDisplayNode {
3737

3838
@discardableResult public func setupDefaultMessageBox() -> Node {
3939
let cameraButton = GTChatMessageButtonNode()
40-
.setButtonSize(.init(width: 24.0, height: 24.0))
41-
.setButtonImage(#imageLiteral(resourceName: "photo"), color: .white, for: .normal)
42-
.setButtonImage(#imageLiteral(resourceName: "photo"), color: UIColor.white.withAlphaComponent(0.5), for: .disabled)
40+
.setChatButtonSize(.init(width: 24.0, height: 24.0))
41+
.setChatButtonImage(#imageLiteral(resourceName: "photo"), color: .white, for: .normal)
42+
.setChatButtonImage(#imageLiteral(resourceName: "photo"), color: UIColor.white.withAlphaComponent(0.5), for: .disabled)
4343

4444
let sendButton = GTChatMessageButtonNode()
45-
.setButtonSize(.init(width: 24.0, height: 24.0))
46-
.setButtonImage(#imageLiteral(resourceName: "send"), color: .white, for: .normal)
47-
.setButtonImage(#imageLiteral(resourceName: "send"), color: UIColor.white.withAlphaComponent(0.5), for: .disabled)
45+
.setChatButtonSize(.init(width: 24.0, height: 24.0))
46+
.setChatButtonImage(#imageLiteral(resourceName: "send"), color: .white, for: .normal)
47+
.setChatButtonImage(#imageLiteral(resourceName: "send"), color: UIColor.white.withAlphaComponent(0.5), for: .disabled)
4848

49-
self.messageNode.setMessageContainerInsets(UIEdgeInsetsMake(5.0, 10.0, 5.0, 10.0))
49+
self.messageNode.setChatMessageContainerInsets(UIEdgeInsetsMake(5.0, 10.0, 5.0, 10.0))
5050

51-
self.setLeftButtons([cameraButton], spacing: 10.0)
52-
.setRightButtons([sendButton], spacing: 10.0)
53-
.setMessageBoxHeight(50.0, maxiumNumberOfLine: 6, isRounded: true)
51+
self.setChatLeftButtons([cameraButton], spacing: 10.0)
52+
.setChatRightButtons([sendButton], spacing: 10.0)
53+
.setChatMessageBoxHeight(50.0, maxiumNumberOfLine: 6, isRounded: true)
5454
return self
5555
}
5656

57-
@discardableResult public func setMessageBoxHeight(_ minimumHeight: CGFloat,
58-
maxiumNumberOfLine: Int,
59-
isRounded: Bool) -> Node {
57+
@discardableResult public func setChatMessageBoxHeight(_ minimumHeight: CGFloat,
58+
maxiumNumberOfLine: Int,
59+
isRounded: Bool) -> Node {
6060
self.style.height = .init(unit: .points, value: minimumHeight)
6161
self.minimumMessageBoxHeight = minimumHeight
6262
self.maximumVisibleMessageNumberOfLines = maxiumNumberOfLine
@@ -68,15 +68,15 @@ public class GTChatMessageBoxNode: ASDisplayNode {
6868
return self
6969
}
7070

71-
@discardableResult public func setLeftButtons(_ buttons: [GTChatMessageButtonNode],
72-
spacing: CGFloat) -> Node {
71+
@discardableResult public func setChatLeftButtons(_ buttons: [GTChatMessageButtonNode],
72+
spacing: CGFloat) -> Node {
7373
self.leftButtonGroupSpacing = spacing
7474
self.leftButtonGroups = buttons
7575
return self
7676
}
7777

78-
@discardableResult public func setRightButtons(_ buttons: [GTChatMessageButtonNode],
79-
spacing: CGFloat) -> Node {
78+
@discardableResult public func setChatRightButtons(_ buttons: [GTChatMessageButtonNode],
79+
spacing: CGFloat) -> Node {
8080
self.rightButtonGroupSpacing = spacing
8181
self.rightButtonGroups = buttons
8282
return self
@@ -103,9 +103,9 @@ public class GTChatMessageBoxNode: ASDisplayNode {
103103

104104
if let rightButtonGroupLayout = self.rightButtonGroupLayoutSpec() {
105105
let rightButtonRelativeLayout = ASRelativeLayoutSpec(horizontalPosition: .end,
106-
verticalPosition: .end,
107-
sizingOption: [],
108-
child: rightButtonGroupLayout)
106+
verticalPosition: .end,
107+
sizingOption: [],
108+
child: rightButtonGroupLayout)
109109
rightButtonRelativeLayout.style.spacingBefore = rightButtonGroupSpacing
110110
messageBoxElements.append(rightButtonRelativeLayout)
111111
}

GTChatKit/Classes/Views/GTChatMessageButtonNode.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ public class GTChatMessageButtonNode: ASButtonNode {
2828
self.style.preferredSize = self.buttonSize
2929
}
3030

31-
@discardableResult open func setButtonImage(_ image: UIImage,
32-
color: UIColor,
33-
for status: UIControlState) -> Node {
31+
@discardableResult open func setChatButtonImage(_ image: UIImage,
32+
color: UIColor,
33+
for status: UIControlState) -> Node {
3434
self.setImage(image.applyButtonColor(with: color), for: status)
3535
return self
3636
}
3737

38-
@discardableResult open func setButtonSize(_ size: CGSize) -> Node {
38+
@discardableResult open func setChatButtonSize(_ size: CGSize) -> Node {
3939
self.buttonSize = size
4040
self.style.preferredSize = size
4141
return self
4242
}
4343

44-
@discardableResult open func setButtonTintColor(_ color: UIColor) -> Node {
44+
@discardableResult @objc open func setChatButtonTintColor(_ color: UIColor) -> Node {
4545
self.buttonTintColor = color
4646
self.tintColor = color
4747
return self
4848
}
4949

50-
@discardableResult open func setButtonText(_ title: NSAttributedString,
51-
for state: UIControlState) -> Node {
50+
@discardableResult open func setChatButtonText(_ title: NSAttributedString,
51+
for state: UIControlState) -> Node {
5252
self.setAttributedTitle(title, for: state)
5353
return self
5454
}

GTChatKit/Classes/Views/GTChatMessageInputBoxNode.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public class GTChatMessageInputBoxNode: ASEditableTextNode {
2020

2121
self.backgroundColor = .white
2222
self.placeholderEnabled = true
23-
self.setPlaceholder("Type Message",
23+
self.setChatPlaceholder("Type Message",
2424
attribute: Node.defaultPlaceholdereAttributes)
25-
self.setTypingAttributes(Node.defaultTypingAttributes)
25+
self.setChatTypingAttributes(Node.defaultTypingAttributes)
2626

2727
self.cursorColor(.chatKitDefaultColor)
2828
self.style.flexGrow = 1.0
@@ -33,19 +33,19 @@ public class GTChatMessageInputBoxNode: ASEditableTextNode {
3333
self.delegate = nil
3434
}
3535

36-
@discardableResult func setPlaceholder(_ text: String,
37-
attribute: [NSAttributedStringKey: Any]) -> Node {
36+
@discardableResult func setChatPlaceholder(_ text: String,
37+
attribute: [String: Any]) -> Node {
3838
self.attributedPlaceholderText = .init(string: text,
3939
attributes: attribute)
4040
return self
4141
}
4242

43-
@discardableResult func setTypingAttributes(_ attribute: [String: Any]) -> Node {
43+
@discardableResult @objc func setChatTypingAttributes(_ attribute: [String: Any]) -> Node {
4444
self.typingAttributes = attribute
4545
return self
4646
}
4747

48-
@discardableResult func setMessageContainerInsets(_ insets: UIEdgeInsets) -> Node {
48+
@discardableResult func setChatMessageContainerInsets(_ insets: UIEdgeInsets) -> Node {
4949
self.textContainerInset = insets
5050
return self
5151
}
@@ -63,13 +63,13 @@ public class GTChatMessageInputBoxNode: ASEditableTextNode {
6363
}
6464

6565
extension GTChatMessageInputBoxNode {
66-
static var defaultPlaceholdereAttributes: [NSAttributedStringKey: Any] {
67-
return [NSAttributedStringKey.foregroundColor: UIColor.lightGray,
68-
NSAttributedStringKey.font: UIFont.systemFont(ofSize: 15.0)]
66+
static var defaultPlaceholdereAttributes: [String: Any] {
67+
return [NSForegroundColorAttributeName: UIColor.lightGray,
68+
NSFontAttributeName: UIFont.systemFont(ofSize: 15.0)]
6969
}
7070

7171
static var defaultTypingAttributes: [String: Any] {
72-
return [NSAttributedStringKey.foregroundColor.rawValue: UIColor.darkGray,
73-
NSAttributedStringKey.font.rawValue: UIFont.systemFont(ofSize: 15.0)]
72+
return [NSForegroundColorAttributeName: UIColor.darkGray,
73+
NSFontAttributeName: UIFont.systemFont(ofSize: 15.0)]
7474
}
7575
}

0 commit comments

Comments
 (0)