Skip to content

Commit 38a4b3c

Browse files
committed
fix #118: Fix for NSTextAttachment
1 parent ec8dd4e commit 38a4b3c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SwiftRichString/Extensions/AttributedString+Attachments.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ public extension AttributedString {
105105
attachment.image = image.withRenderingMode(.alwaysOriginal)
106106
}
107107
} else {
108-
attachment = NSTextAttachment(data: image.pngData()!, ofType: "png")
108+
// It does not work on iOS12, return empty set.s
109+
// attachment = NSTextAttachment(data: image.pngData()!, ofType: "png")
110+
attachment = NSTextAttachment()
111+
attachment.image = image.withRenderingMode(.alwaysOriginal)
109112
}
110113
#endif
111114

0 commit comments

Comments
 (0)