Skip to content

Commit b80efb3

Browse files
committed
Expose public setter for typingAttributes; update protocol and AppKit/UIKit
#14 (reply in thread) - STTextViewProtocol: typingAttributes is now get/set - STTextView (AppKit/UIKit): change from public internal(set) to public var - Enables clients to set typing attributes directly (API-breaking)
1 parent f8b8ce5 commit b80efb3

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Sources/STTextViewAppKit/STTextView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ open class STTextView: NSView, NSTextInput, NSTextContent, STTextViewProtocol {
167167
/// This dictionary contains the attribute keys (and corresponding values) to apply to newly typed text.
168168
/// When the text view’s selection changes, the contents of the dictionary are reset automatically.
169169
@objc
170-
public internal(set) var typingAttributes: [NSAttributedString.Key: Any] {
170+
public var typingAttributes: [NSAttributedString.Key: Any] {
171171
get {
172172
_typingAttributes.merging(_defaultTypingAttributes) { (current, _) in current }
173173
}

Sources/STTextViewCommon/STTextViewProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package protocol STTextViewProtocol {
3838
var textColor: Color { get set }
3939
var defaultParagraphStyle: NSParagraphStyle { get set }
4040

41-
var typingAttributes: [NSAttributedString.Key: Any] { get }
41+
var typingAttributes: [NSAttributedString.Key: Any] { get set }
4242

4343
var text: String? { get set }
4444
var attributedText: NSAttributedString? { get set }

Sources/STTextViewUIKit/STTextView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ open class STTextView: UIScrollView, STTextViewProtocol {
389389
/// This dictionary contains the attribute keys (and corresponding values) to apply to newly typed text.
390390
/// When the text view’s selection changes, the contents of the dictionary are reset automatically.
391391
@objc
392-
public internal(set) var typingAttributes: [NSAttributedString.Key: Any] {
392+
public var typingAttributes: [NSAttributedString.Key: Any] {
393393
get {
394394
_typingAttributes.merging(_defaultTypingAttributes) { (current, _) in current }
395395
}

0 commit comments

Comments
 (0)