Skip to content

Commit

Permalink
Adds line padding for the UILabel (#12)
Browse files Browse the repository at this point in the history
Adds 0.3.0 to podspecs
  • Loading branch information
mustiikhalil authored Apr 8, 2022
1 parent d5c2774 commit da3ed1d
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DemoApp/LCLabelUITests/LCLabelHitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import XCTest

// Screenshots taken on an iPhone 13
final class LCLabelHitTests: XCTestCase {

private var app: XCUIApplication!
Expand Down Expand Up @@ -77,7 +78,7 @@ final class LCLabelHitTests: XCTestCase {
XCTAssertEqual(main.staticTexts["translator"].label, "")
app.tapCoordinate(at: CGPoint(x: 10, y: 400))
XCTAssertEqual(main.staticTexts["translator"].label, "")
app.tapCoordinate(at: CGPoint(x: 40, y: 430))
app.tapCoordinate(at: CGPoint(x: 30, y: 430))
XCTAssertEqual(main.staticTexts["translator"].label, "tel://909001")
app.tapCoordinate(at: CGPoint(x: 200, y: 430))
XCTAssertEqual(main.staticTexts["translator"].label, "tel://909001")
Expand Down
2 changes: 1 addition & 1 deletion LCLabel.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'LCLabel'
s.version = '0.2.0'
s.version = '0.3.0'
s.summary = 'LCLabel is a TextKit 2 based UIView'
s.description = "LCLabel is a TextKit 2 based UIView that mimics a the behaviour of UILabel & UITextView"
s.homepage = 'https://github.com/mustiikhalil/LCLabel'
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Sources/LCLabel/LCLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ final public class LCLabel: UIView {
public var linkStyleValidation: LinksStyleValidation = .skip
/// Line breaking mode the label uses, default is `.byTruncatingTail`
public var lineBreakMode: NSLineBreakMode = .byTruncatingTail
/// Line padding at the beginning of the view
public var lineFragmentPadding: CGFloat = 0
/// Number of lines allowed
public var numberOfLines = 1
/// Text to be displayed
Expand Down Expand Up @@ -155,6 +157,7 @@ final public class LCLabel: UIView {
let container = NSTextContainer(size: bounds.size)
container.maximumNumberOfLines = numberOfLines
container.lineBreakMode = lineBreakMode
container.lineFragmentPadding = lineFragmentPadding
layoutManager.addTextContainer(container)
storage.addLayoutManager(layoutManager)
let range = layoutManager.glyphRange(for: container)
Expand Down
1 change: 1 addition & 0 deletions Tests/LCLabelTests/LCLabelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import LCLabel
import SnapshotTesting
import XCTest

// Screenshots taken on an iPhone 13
final class LCLabelTests: XCTestCase {

func testTextCenterAlignment() {
Expand Down

0 comments on commit da3ed1d

Please sign in to comment.