Skip to content

Commit f4c2b53

Browse files
committed
Fix placeholder image on demo.
1 parent dc3253b commit f4c2b53

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

Example/Example/EditorDemoController.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ extension EditorDemoController: TextViewAttachmentDelegate {
10871087

10881088
func placeholderImage(for attachment: NSTextAttachment) -> UIImage {
10891089
let imageSize = CGSize(width:64, height:64)
1090-
let placeholderImage: UIImage
1090+
var placeholderImage: UIImage
10911091
switch attachment {
10921092
case _ as ImageAttachment:
10931093
placeholderImage = Gridicon.iconOfType(.image, withSize: imageSize)
@@ -1096,7 +1096,9 @@ extension EditorDemoController: TextViewAttachmentDelegate {
10961096
default:
10971097
placeholderImage = Gridicon.iconOfType(.attachment, withSize: imageSize)
10981098
}
1099-
1099+
if #available(iOS 13.0, *) {
1100+
placeholderImage = placeholderImage.withTintColor(.label)
1101+
}
11001102
return placeholderImage
11011103
}
11021104

@@ -1501,10 +1503,19 @@ private extension EditorDemoController
15011503

15021504
extension EditorDemoController {
15031505

1506+
static var tintedMissingImage: UIImage = {
1507+
if #available(iOS 13.0, *) {
1508+
return Gridicon.iconOfType(.image).withTintColor(.label)
1509+
} else {
1510+
// Fallback on earlier versions
1511+
return Gridicon.iconOfType(.image)
1512+
}
1513+
}()
1514+
15041515
struct Constants {
15051516
static let defaultContentFont = UIFont.systemFont(ofSize: 14)
15061517
static let defaultHtmlFont = UIFont.systemFont(ofSize: 24)
1507-
static let defaultMissingImage = Gridicon.iconOfType(.image)
1518+
static let defaultMissingImage = tintedMissingImage
15081519
static let formatBarIconSize = CGSize(width: 20.0, height: 20.0)
15091520
static let headers = [Header.HeaderType.none, .h1, .h2, .h3, .h4, .h5, .h6]
15101521
static let lists = [TextList.Style.unordered, .ordered]

0 commit comments

Comments
 (0)