diff --git a/AttributedString.podspec b/AttributedString.podspec index 385f303..ae03b6b 100644 --- a/AttributedString.podspec +++ b/AttributedString.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AttributedString" -s.version = "3.3.4" +s.version = "3.3.5" s.summary = "基于Swift字符串插值快速构建你想要的富文本, 支持点击按住等事件获取, 支持多种类型过滤" s.homepage = "https://github.com/lixiang1994/AttributedString" diff --git a/Sources/Extension/Extension.swift b/Sources/Extension/Extension.swift index ddce6ce..aaeca8f 100644 --- a/Sources/Extension/Extension.swift +++ b/Sources/Extension/Extension.swift @@ -138,7 +138,7 @@ extension ASAttributedString { /// - lhs: AttributedString to add to. /// - rhs: AttributedString.Attribute to add. public static func += (lhs: inout ASAttributedString, rhs: ASAttributedString.Attribute) { - lhs += (rhs, .init(location: 0, length: lhs.value.string.count)) + lhs += (rhs, .init(location: 0, length: lhs.value.length)) } /// Add a AttributedString.Attribute to another AttributedString. @@ -147,7 +147,7 @@ extension ASAttributedString { /// - lhs: AttributedString to add to. /// - rhs: AttributedString.Attribute to add. public static func += (lhs: inout ASAttributedString, rhs: [ASAttributedString.Attribute]) { - lhs += (rhs, .init(location: 0, length: lhs.value.string.count)) + lhs += (rhs, .init(location: 0, length: lhs.value.length)) } /// Add a AttributedString.Attribute to another AttributedString. @@ -175,7 +175,7 @@ extension ASAttributedString { /// - rhs: AttributedString.Attribute to add. /// - Returns: New instance with added AttributedString.Attribute. public static func + (lhs: ASAttributedString, rhs: ASAttributedString.Attribute) -> ASAttributedString { - return lhs + (rhs, .init(location: 0, length: lhs.value.string.count)) + return lhs + (rhs, .init(location: 0, length: lhs.value.length)) } /// Add a AttributedString.Attribute to another AttributedString and return a new AttributedString instance. diff --git a/Sources/Extension/UIKit/UILabel/UILabelExtension.swift b/Sources/Extension/UIKit/UILabel/UILabelExtension.swift index d38973c..8a7bbd0 100644 --- a/Sources/Extension/UIKit/UILabel/UILabelExtension.swift +++ b/Sources/Extension/UIKit/UILabel/UILabelExtension.swift @@ -416,7 +416,6 @@ extension UILabel { let scaledBaselineOffset: Double let scaledLineHeight: Double let scaledSize: CGSize - let targetSize: CGSize /// Keys @@ -427,7 +426,6 @@ extension UILabel { static let scaledBaselineOffsetName = "0V2cmZ2Tl5WasV2chJEZlxWYjN3X".reversedBase64Decoder() static let scaledLineHeightName = "=QHanlWZIVmbpxEZlxWYjN3X".reversedBase64Decoder() static let scaledSizeName = "=UmepNFZlxWYjN3X".reversedBase64Decoder() - static let targetSizeName = "=UmepNFdldmchR3X".reversedBase64Decoder() } private static let synthesizedAttributedTextName = "=QHelRFZlRXdilmc0RXQkVmepNXZoRnb5N3X".reversedBase64Decoder() @@ -456,8 +454,7 @@ extension UILabel { let scaledAttributedTextName = ScaledMetrics.scaledAttributedTextName, let scaledBaselineOffsetName = ScaledMetrics.scaledBaselineOffsetName, let scaledLineHeightName = ScaledMetrics.scaledLineHeightName, - let scaledSizeName = ScaledMetrics.scaledSizeName, - let targetSizeName = ScaledMetrics.targetSizeName else { + let scaledSizeName = ScaledMetrics.scaledSizeName else { return nil } guard @@ -467,8 +464,7 @@ extension UILabel { let scaledAttributedText = object.value(forKey: scaledAttributedTextName) as? NSAttributedString, let scaledBaselineOffset = object.value(forKey: scaledBaselineOffsetName) as? Double, let scaledLineHeight = object.value(forKey: scaledLineHeightName) as? Double, - let scaledSize = object.value(forKey: scaledSizeName) as? CGSize, - let targetSize = object.value(forKey: targetSizeName) as? CGSize else { + let scaledSize = object.value(forKey: scaledSizeName) as? CGSize else { return nil } @@ -479,8 +475,7 @@ extension UILabel { scaledAttributedText: scaledAttributedText, scaledBaselineOffset: scaledBaselineOffset, scaledLineHeight: scaledLineHeight, - scaledSize: scaledSize, - targetSize: targetSize + scaledSize: scaledSize ) }