Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions LayoutKitTests/LabelLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ class LabelLayoutTests: XCTestCase {

XCTAssertEqual(arrangement.makeViews().frame.size, label.intrinsicContentSize)
}

func testAsyncAttributedLabel() {
DispatchQueue.global(qos: .userInitiated).async {
let attributedText = NSAttributedString(string: "Async", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)])
let arrangement = LabelLayout(attributedText: attributedText).arrangement()
DispatchQueue.main.async {
let label = UILabel(attributedText: attributedText, font: UIFont.helvetica(size: 42))
XCTAssertEqual(arrangement.makeViews().frame.size, label.intrinsicContentSize)
}
}
}

func testTwoLineLabel() {
let text = "Nick Snyder"
Expand Down
2 changes: 1 addition & 1 deletion Sources/Layouts/LabelLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ open class LabelLayout<Label: UILabel>: BaseLayout<Label>, ConfigurableLayout {

public class LabelLayoutDefaults {
public static let defaultNumberOfLines = 0
public static let defaultFont = UILabel().font ?? UIFont.systemFont(ofSize: 17)
public static let defaultFont = UIFont.systemFont(ofSize: 17)
public static let defaultAlignment = Alignment.topLeading
public static let defaultFlexibility = Flexibility.flexible
}
Expand Down