From c55c5f6dbe4f368d1bf09a0d3d04a6b0008a7f11 Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Tue, 20 Aug 2019 17:56:42 +0200 Subject: [PATCH 1/6] Fix typo renaming `thinestLineWidth` to `thinnestLineWidth` --- Form/SeparatorStyle.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Form/SeparatorStyle.swift b/Form/SeparatorStyle.swift index a3719cb..6e6de50 100644 --- a/Form/SeparatorStyle.swift +++ b/Form/SeparatorStyle.swift @@ -57,16 +57,16 @@ 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 thinnestLineWidth: CGFloat { return 1.0 / scale } } 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. - var thinestLineWidth: CGFloat { - return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.thinestLineWidth + /// Returns the thinnest line representable on the current used trait's screen, or the main screen in `self`'s displayScale is not defined. + var thinnestLineWidth: CGFloat { + return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.thinnestLineWidth } /// Returns true if userInterfaceIdiom is pad @@ -77,8 +77,8 @@ public extension UITraitCollection { } public extension CGFloat { - /// Returns the thinest line representable by the main screen - static var thinestLineWidth: CGFloat { - return UIScreen.main.thinestLineWidth + /// Returns the thinnest line representable by the main screen + static var thinnestLineWidth: CGFloat { + return UIScreen.main.thinnestLineWidth } } From 34b3c1fb83990a0ca171709fbba9dfe6c23a2e81 Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Tue, 20 Aug 2019 17:57:07 +0200 Subject: [PATCH 2/6] Update callers --- Form/SectionBackgroundStyle.swift | 4 ++-- Form/UIImage+Styling.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Form/SectionBackgroundStyle.swift b/Form/SectionBackgroundStyle.swift index d6b11e7..ecb379a 100644 --- a/Form/SectionBackgroundStyle.swift +++ b/Form/SectionBackgroundStyle.swift @@ -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.thinnestLineWidth, 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.thinnestLineWidth, color: .systemSeparator), insets: prototypeGroupedTableView.separatorInset)) static var systemSelected = SectionBackgroundStyle.system.restyled { $0.color = .systemSelection diff --git a/Form/UIImage+Styling.swift b/Form/UIImage+Styling.swift index 9518d7e..be79268 100644 --- a/Form/UIImage+Styling.swift +++ b/Form/UIImage+Styling.swift @@ -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 * .thinnestLineWidth + ceiledBorderWidths.right + max(bottomSeparatorInsets.left, topSeparatorInsets.left) + max(bottomSeparatorInsets.right, topSeparatorInsets.right) + let rectHeight = cornerRadius * 2 + ceiledBorderWidths.top + 2 * .thinnestLineWidth + ceiledBorderWidths.bottom + ceiledSeparatorHeight + ceiledTopSeparatorHeight let rect = CGRect(x: 0, y: 0, width: max(1, rectWidth), height: max(1, rectHeight)) let isOpaque: Bool From 902916fd62394fe2c79048f61cdf753ee05506a9 Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Wed, 21 Aug 2019 09:12:08 +0200 Subject: [PATCH 3/6] Keep old API, marked as deprecated --- Form/SeparatorStyle.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Form/SeparatorStyle.swift b/Form/SeparatorStyle.swift index 6e6de50..2665726 100644 --- a/Form/SeparatorStyle.swift +++ b/Form/SeparatorStyle.swift @@ -61,6 +61,11 @@ public extension UIScreen { var thinnestLineWidth: CGFloat { return 1.0 / scale } + + @available(*, deprecated, renamed: "thinnestLineWidth") + var thinestLineWidth: CGFloat { + return thinnestLineWidth + } } public extension UITraitCollection { @@ -69,6 +74,11 @@ public extension UITraitCollection { return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.thinnestLineWidth } + @available(*, deprecated, renamed: "thinnestLineWidth") + var thinestLineWidth: CGFloat { + return thinnestLineWidth + } + /// Returns true if userInterfaceIdiom is pad var isPad: Bool { return userInterfaceIdiom == .pad } @@ -81,4 +91,9 @@ public extension CGFloat { static var thinnestLineWidth: CGFloat { return UIScreen.main.thinnestLineWidth } + + @available(*, deprecated, renamed: "thinnestLineWidth") + static var thinestLineWidth: CGFloat { + return thinnestLineWidth + } } From 9835fcc9ed039a0052692b4439565634632a6375 Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Wed, 21 Aug 2019 10:40:13 +0200 Subject: [PATCH 4/6] Rename `thinnestLineWidth` to `hairlineWidth` --- Form/SeparatorStyle.swift | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Form/SeparatorStyle.swift b/Form/SeparatorStyle.swift index 2665726..2024d2d 100644 --- a/Form/SeparatorStyle.swift +++ b/Form/SeparatorStyle.swift @@ -57,26 +57,26 @@ public extension Sequence where Iterator.Element == UIView { } public extension UIScreen { - /// Returns the thinnest line representable on `self` - var thinnestLineWidth: CGFloat { + /// Returns the thinnest line representable on `self`. + var hairlineWidth: CGFloat { return 1.0 / scale } - @available(*, deprecated, renamed: "thinnestLineWidth") + @available(*, deprecated, renamed: "hairlineWidth") var thinestLineWidth: CGFloat { - return thinnestLineWidth + return hairlineWidth } } public extension UITraitCollection { /// Returns the thinnest line representable on the current used trait's screen, or the main screen in `self`'s displayScale is not defined. - var thinnestLineWidth: CGFloat { - return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.thinnestLineWidth + var hairlineWidth: CGFloat { + return displayScale > 0 ? 1.0 / displayScale : UIScreen.main.hairlineWidth } - @available(*, deprecated, renamed: "thinnestLineWidth") + @available(*, deprecated, renamed: "hairlineWidth") var thinestLineWidth: CGFloat { - return thinnestLineWidth + return hairlineWidth } /// Returns true if userInterfaceIdiom is pad @@ -87,13 +87,13 @@ public extension UITraitCollection { } public extension CGFloat { - /// Returns the thinnest line representable by the main screen - static var thinnestLineWidth: CGFloat { - return UIScreen.main.thinnestLineWidth + /// Returns the thinnest line representable by the main screen. + static var hairlineWidth: CGFloat { + return UIScreen.main.hairlineWidth } - @available(*, deprecated, renamed: "thinnestLineWidth") + @available(*, deprecated, renamed: "hairlineWidth") static var thinestLineWidth: CGFloat { - return thinnestLineWidth + return hairlineWidth } } From c40b71d3f58ec76476988d6ebcaa2d6dc92456cd Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Wed, 21 Aug 2019 10:40:25 +0200 Subject: [PATCH 5/6] Update callers --- Form/SectionBackgroundStyle.swift | 4 ++-- Form/UIImage+Styling.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Form/SectionBackgroundStyle.swift b/Form/SectionBackgroundStyle.swift index ecb379a..2a1cbc1 100644 --- a/Form/SectionBackgroundStyle.swift +++ b/Form/SectionBackgroundStyle.swift @@ -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.thinnestLineWidth, 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.thinnestLineWidth, 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 diff --git a/Form/UIImage+Styling.swift b/Form/UIImage+Styling.swift index be79268..2c8df2f 100644 --- a/Form/UIImage+Styling.swift +++ b/Form/UIImage+Styling.swift @@ -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 * .thinnestLineWidth + ceiledBorderWidths.right + max(bottomSeparatorInsets.left, topSeparatorInsets.left) + max(bottomSeparatorInsets.right, topSeparatorInsets.right) - let rectHeight = cornerRadius * 2 + ceiledBorderWidths.top + 2 * .thinnestLineWidth + 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 From 5503cc5be26c23a3bf6132ad9074880b94826c71 Mon Sep 17 00:00:00 2001 From: Carl Ekman Date: Wed, 21 Aug 2019 10:43:41 +0200 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc9ec01..0e902d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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