Skip to content

Commit e6d78e8

Browse files
committed
Add extension to NSTextLayoutFragment for isExtraLineFragment property
This commit introduces a new extension to NSTextLayoutFragment, adding a computed property that checks if any of its text line fragments are considered extra line fragments. This functionality enhances text layout manipulation by providing an easy way to identify extra lines.
1 parent 67cdd50 commit e6d78e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Created by Marcin Krzyzanowski
2+
// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md
3+
4+
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
5+
import AppKit
6+
#endif
7+
#if canImport(UIKit)
8+
import UIKit
9+
#endif
10+
11+
extension NSTextLayoutFragment {
12+
package var isExtraLineFragment: Bool {
13+
textLineFragments.contains(where: \.isExtraLineFragment)
14+
}
15+
}

0 commit comments

Comments
 (0)