Skip to content

Commit

Permalink
Add extension to NSTextLayoutFragment for isExtraLineFragment property
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
krzyzanowskim committed Sep 28, 2024
1 parent 67cdd50 commit e6d78e8
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Created by Marcin Krzyzanowski
// https://github.com/krzyzanowskim/STTextView/blob/main/LICENSE.md

#if canImport(AppKit) && !targetEnvironment(macCatalyst)
import AppKit
#endif
#if canImport(UIKit)
import UIKit
#endif

extension NSTextLayoutFragment {
package var isExtraLineFragment: Bool {
textLineFragments.contains(where: \.isExtraLineFragment)
}
}

0 comments on commit e6d78e8

Please sign in to comment.