Skip to content

Commit

Permalink
Merge pull request #120 from iZettle/fix-typo
Browse files Browse the repository at this point in the history
Fix typo "thinest" to "thinnest"
  • Loading branch information
mansbernhardt authored Aug 23, 2019
2 parents b6ed7cc + 5503cc5 commit 1ba0b98
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 1.10.4
- Bugfix: Fix issue with ui refresh deadlock
- Change: Deprecated `thinestLineWidth`, which has been renamed to `hairlineWidth`.

## 1.10.3
- Bugfix: Fix table section header/footer height calculation on iOS 10
Expand Down
4 changes: 2 additions & 2 deletions Form/SectionBackgroundStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public extension SectionBackgroundStyle {

public extension SectionBackgroundStyle {
static let none = SectionBackgroundStyle(background: .none, topSeparator: .none, bottomSeparator: .none)
static let system = SectionBackgroundStyle(background: BackgroundStyle(color: .white, border: BorderStyle(width: UIScreen.main.thinestLineWidth, color: .systemSeparator, cornerRadius: 0)),
static let system = SectionBackgroundStyle(background: BackgroundStyle(color: .white, border: BorderStyle(width: UIScreen.main.hairlineWidth, color: .systemSeparator, cornerRadius: 0)),
topSeparator: .none,
bottomSeparator: InsettedStyle(style: SeparatorStyle(width: UIScreen.main.thinestLineWidth, color: .systemSeparator), insets: prototypeGroupedTableView.separatorInset))
bottomSeparator: InsettedStyle(style: SeparatorStyle(width: UIScreen.main.hairlineWidth, color: .systemSeparator), insets: prototypeGroupedTableView.separatorInset))

static var systemSelected = SectionBackgroundStyle.system.restyled {
$0.color = .systemSelection
Expand Down
27 changes: 21 additions & 6 deletions Form/SeparatorStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,26 @@ public extension Sequence where Iterator.Element == UIView {
}

public extension UIScreen {
/// Returns the thinest line representable on `self`
var thinestLineWidth: CGFloat {
/// Returns the thinnest line representable on `self`.
var hairlineWidth: CGFloat {
return 1.0 / scale
}

@available(*, deprecated, renamed: "hairlineWidth")
var thinestLineWidth: CGFloat {
return hairlineWidth
}
}

public extension UITraitCollection {
/// Returns the thinest line representable on the current used trait's screen, or the main screen in `self`'s displayScale is not defined.
/// Returns the thinnest line representable on the current used trait's screen, or the main screen in `self`'s displayScale is not defined.
var hairlineWidth: CGFloat {
return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.hairlineWidth
}

@available(*, deprecated, renamed: "hairlineWidth")
var thinestLineWidth: CGFloat {
return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.thinestLineWidth
return hairlineWidth
}

/// Returns true if userInterfaceIdiom is pad
Expand All @@ -77,8 +87,13 @@ public extension UITraitCollection {
}

public extension CGFloat {
/// Returns the thinest line representable by the main screen
/// Returns the thinnest line representable by the main screen.
static var hairlineWidth: CGFloat {
return UIScreen.main.hairlineWidth
}

@available(*, deprecated, renamed: "hairlineWidth")
static var thinestLineWidth: CGFloat {
return UIScreen.main.thinestLineWidth
return hairlineWidth
}
}
4 changes: 2 additions & 2 deletions Form/UIImage+Styling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ extension UIImage {
let ceiledTopSeparatorHeight = ceil(topSeparatorHeight)

// Computing the smallest rect possible to draw this image - note that it should be slightly bigger than the border widths so that it draws a stretchable non-solid area too
let rectWidth = cornerRadius * 2 + ceiledBorderWidths.left + 2 * .thinestLineWidth + ceiledBorderWidths.right + max(bottomSeparatorInsets.left, topSeparatorInsets.left) + max(bottomSeparatorInsets.right, topSeparatorInsets.right)
let rectHeight = cornerRadius * 2 + ceiledBorderWidths.top + 2 * .thinestLineWidth + ceiledBorderWidths.bottom + ceiledSeparatorHeight + ceiledTopSeparatorHeight
let rectWidth = cornerRadius * 2 + ceiledBorderWidths.left + 2 * .hairlineWidth + ceiledBorderWidths.right + max(bottomSeparatorInsets.left, topSeparatorInsets.left) + max(bottomSeparatorInsets.right, topSeparatorInsets.right)
let rectHeight = cornerRadius * 2 + ceiledBorderWidths.top + 2 * .hairlineWidth + ceiledBorderWidths.bottom + ceiledSeparatorHeight + ceiledTopSeparatorHeight
let rect = CGRect(x: 0, y: 0, width: max(1, rectWidth), height: max(1, rectHeight))

let isOpaque: Bool
Expand Down

0 comments on commit 1ba0b98

Please sign in to comment.