Skip to content

Commit

Permalink
Deprecate NSUITextStorageEditActions
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Mar 30, 2024
1 parent f6f9660 commit 1390ba9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ NSUIResponder
NSUIStackView
NSUIStoryboard
NSUITapGestureRecognizer
NSUITextStorageEditActions
NSUITextField
NSUITextFieldDelegate
NSUITextView
Expand Down
10 changes: 6 additions & 4 deletions Sources/NSUI/TextView.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
import AppKit

public extension NSTextStorage {
typealias EditActions = NSTextStorageEditActions
extension NSTextStorage {
public typealias EditActions = NSTextStorageEditActions
}

@available(*, deprecated, renamed: "NSTextStorage.EditActions")
public typealias NSUITextStorageEditActions = NSTextStorageEditActions

public extension NSTextView {
var text: String {
extension NSTextView {
public var text: String {
get { return string }
set { string = newValue }
}
Expand All @@ -17,6 +18,7 @@ public extension NSTextView {
#elseif canImport(UIKit)
import UIKit

@available(*, deprecated, renamed: "NSTextStorage.EditActions")
public typealias NSUITextStorageEditActions = NSTextStorage.EditActions

#endif
13 changes: 11 additions & 2 deletions Tests/NSUITests/TextViewTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import XCTest
@testable import NSUI
import NSUI

final class StorageDelegate: NSObject, NSTextStorageDelegate {
func textStorage(_ textStorage: NSTextStorage, willProcessEditing editedMask: NSTextStorage.EditActions, range editedRange: NSRange, changeInLength delta: Int) {

}

func textStorage(_ textStorage: NSTextStorage, didProcessEditing editedMask: NSTextStorage.EditActions, range editedRange: NSRange, changeInLength delta: Int) {
}
}

final class TextViewTests: XCTestCase {
@MainActor
Expand All @@ -13,7 +22,7 @@ final class TextViewTests: XCTestCase {

@MainActor
func testEditActions() throws {
let edit = NSUITextStorageEditActions.editedAttributes
let edit = NSTextStorage.EditActions.editedAttributes

XCTAssertTrue(edit.contains(.editedAttributes))
}
Expand Down

0 comments on commit 1390ba9

Please sign in to comment.