Skip to content

Commit 8912977

Browse files
authored
(136518115) Remove unused AttributedString initializers (#948)
Signed-off-by: Jeremy Schonfeld <[email protected]>
1 parent 4784ffb commit 8912977

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

Sources/FoundationEssentials/AttributedString/Conversion.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,6 @@ extension Dictionary where Key == NSAttributedString.Key, Value == Any {
140140
try self.init(container, attributeTable: S.attributeKeyTypes())
141141
}
142142

143-
// These includingOnly SPI initializers were provided originally when conversion boxed attributes outside of the given scope as an AnyObject
144-
// After rdar://80201634, these SPI initializers have the same behavior as the API initializers
145-
@_spi(AttributedString)
146-
public init<S: AttributeScope>(_ container: AttributeContainer, includingOnly scope: KeyPath<AttributeScopes, S.Type>) throws {
147-
try self.init(container, including: S.self)
148-
}
149-
150-
@_spi(AttributedString)
151-
public init<S: AttributeScope>(_ container: AttributeContainer, includingOnly scope: S.Type) throws {
152-
try self.init(container, including: S.self)
153-
}
154-
155143
fileprivate init(_ container: AttributeContainer, attributeTable: [String : any AttributedStringKey.Type], options: _AttributeConversionOptions = []) throws {
156144
self.init()
157145
for key in container.storage.keys {
@@ -186,16 +174,6 @@ extension NSAttributedString {
186174
try self.init(attrStr, attributeTable: scope.attributeKeyTypes())
187175
}
188176

189-
@_spi(AttributedString)
190-
public convenience init<S: AttributeScope>(_ attrStr: AttributedString, includingOnly scope: KeyPath<AttributeScopes, S.Type>) throws {
191-
try self.init(attrStr, including: S.self)
192-
}
193-
194-
@_spi(AttributedString)
195-
public convenience init<S: AttributeScope>(_ attrStr: AttributedString, includingOnly scope: S.Type) throws {
196-
try self.init(attrStr, including: scope)
197-
}
198-
199177
internal convenience init(
200178
_ attrStr: AttributedString,
201179
attributeTable: [String : any AttributedStringKey.Type],

Tests/FoundationEssentialsTests/AttributedString/AttributedStringTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,12 +1774,6 @@ E {
17741774
#endif
17751775
}
17761776

1777-
func testConversionIncludingOnly() throws {
1778-
let str = AttributedString("Hello, world", attributes: .init().testInt(2).link(URL(string: "http://apple.com")!))
1779-
let nsStr = try NSAttributedString(str, includingOnly: \.test)
1780-
XCTAssertEqual(nsStr, NSAttributedString(string: "Hello, world", attributes: [.testInt: 2]))
1781-
}
1782-
17831777
func testConversionCoalescing() throws {
17841778
let nsStr = NSMutableAttributedString("Hello, world")
17851779
nsStr.setAttributes([.link : NSURL(string: "http://apple.com")!, .testInt : NSNumber(integerLiteral: 2)], range: NSRange(location: 0, length: 6))

0 commit comments

Comments
 (0)