Skip to content

Commit da3ed1d

Browse files
authored
Adds line padding for the UILabel (#12)
Adds 0.3.0 to podspecs
1 parent d5c2774 commit da3ed1d

File tree

11 files changed

+7
-2
lines changed

11 files changed

+7
-2
lines changed

DemoApp/LCLabelUITests/LCLabelHitTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import XCTest
77

8+
// Screenshots taken on an iPhone 13
89
final class LCLabelHitTests: XCTestCase {
910

1011
private var app: XCUIApplication!
@@ -77,7 +78,7 @@ final class LCLabelHitTests: XCTestCase {
7778
XCTAssertEqual(main.staticTexts["translator"].label, "")
7879
app.tapCoordinate(at: CGPoint(x: 10, y: 400))
7980
XCTAssertEqual(main.staticTexts["translator"].label, "")
80-
app.tapCoordinate(at: CGPoint(x: 40, y: 430))
81+
app.tapCoordinate(at: CGPoint(x: 30, y: 430))
8182
XCTAssertEqual(main.staticTexts["translator"].label, "tel://909001")
8283
app.tapCoordinate(at: CGPoint(x: 200, y: 430))
8384
XCTAssertEqual(main.staticTexts["translator"].label, "tel://909001")

LCLabel.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'LCLabel'
3-
s.version = '0.2.0'
3+
s.version = '0.3.0'
44
s.summary = 'LCLabel is a TextKit 2 based UIView'
55
s.description = "LCLabel is a TextKit 2 based UIView that mimics a the behaviour of UILabel & UITextView"
66
s.homepage = 'https://github.com/mustiikhalil/LCLabel'
-44 Bytes
Loading
39 Bytes
Loading
-18 Bytes
Loading
-22 Bytes
Loading
168 Bytes
Loading
-21 Bytes
Loading
-31 Bytes
Loading

Sources/LCLabel/LCLabel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ final public class LCLabel: UIView {
8282
public var linkStyleValidation: LinksStyleValidation = .skip
8383
/// Line breaking mode the label uses, default is `.byTruncatingTail`
8484
public var lineBreakMode: NSLineBreakMode = .byTruncatingTail
85+
/// Line padding at the beginning of the view
86+
public var lineFragmentPadding: CGFloat = 0
8587
/// Number of lines allowed
8688
public var numberOfLines = 1
8789
/// Text to be displayed
@@ -155,6 +157,7 @@ final public class LCLabel: UIView {
155157
let container = NSTextContainer(size: bounds.size)
156158
container.maximumNumberOfLines = numberOfLines
157159
container.lineBreakMode = lineBreakMode
160+
container.lineFragmentPadding = lineFragmentPadding
158161
layoutManager.addTextContainer(container)
159162
storage.addLayoutManager(layoutManager)
160163
let range = layoutManager.glyphRange(for: container)

0 commit comments

Comments
 (0)