22 lines
653 B
Swift
22 lines
653 B
Swift
//
|
|
// InlineTextAttachment.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 9/3/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class InlineTextAttachment: NSTextAttachment {
|
|
|
|
var fontDescender: CGFloat!
|
|
|
|
override func attachmentBounds(for textContainer: NSTextContainer?, proposedLineFragment lineFrag: CGRect, glyphPosition position: CGPoint, characterIndex charIndex: Int) -> CGRect {
|
|
var rect = super.attachmentBounds(for: textContainer, proposedLineFragment: lineFrag, glyphPosition: position, characterIndex: charIndex)
|
|
rect.origin.y = fontDescender
|
|
return rect
|
|
}
|
|
|
|
}
|