Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianoPAlmeida committed Jul 7, 2021
2 parents f83cbcb + 71e59e5 commit 32e8717
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The changelog for **SwifterSwift**. Also see the [releases](https://github.com/S
- Remove `last(where:)` and move `last(where:equals:)` to `BidirectionalCollection`, since it only makes semantic sense for ordered sequences. [#912](https://github.com/SwifterSwift/SwifterSwift/pull/912) by [guykogus](https://github.com/guykogus)
- **UIView**
- Rename `shadowColor`, `shadowOffset`, `shadowOpacity` and `shadowRadius` to `layerShadowColor`, `layerShadowOffset`, `layerShadowOpacity` and `layerShadowRadius` to avoid naming collisions with subclasses properties defined in other modules e.g. UIKit. [#897](https://github.com/SwifterSwift/SwifterSwift/pull/897) by [LucianoPAlmeida](https://github.com/LucianoPAlmeida)
- Rename `borderColor`, `borderWidth` and `cornerRadius` to `layerBorderColor`, `layerBorderWidth`, and `layerCornerRadius` to avoid naming collisions with subclasses properties defined in other modules e.g. UIKit. [#972](https://github.com/SwifterSwift/SwifterSwift/pull/972) by [Jayxiang](https://github.com/Jayxiang)

### Added
- **SCN3Vector**
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwifterSwift/Foundation/DateExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public extension Date {
/// SwifterSwift: Date by changing value of calendar component.
///
/// let date = Date() // "Jan 12, 2017, 7:07 PM"
/// let date2 = date.changing(.minute, value: 10) // "Jan 12, 2017, 6:10 PM"
/// let date2 = date.changing(.minute, value: 10) // "Jan 12, 2017, 7:10 PM"
/// let date3 = date.changing(.day, value: 4) // "Jan 4, 2017, 7:07 PM"
/// let date4 = date.changing(.month, value: 2) // "Feb 12, 2017, 7:07 PM"
/// let date5 = date.changing(.year, value: 2000) // "Jan 12, 2000, 7:07 PM"
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwifterSwift/UIKit/UIViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public extension UIView {

public extension UIView {
/// SwifterSwift: Border color of view; also inspectable from Storyboard.
@IBInspectable var borderColor: UIColor? {
@IBInspectable var layerBorderColor: UIColor? {
get {
guard let color = layer.borderColor else { return nil }
return UIColor(cgColor: color)
Expand All @@ -72,7 +72,7 @@ public extension UIView {
}

/// SwifterSwift: Border width of view; also inspectable from Storyboard.
@IBInspectable var borderWidth: CGFloat {
@IBInspectable var layerBorderWidth: CGFloat {
get {
return layer.borderWidth
}
Expand All @@ -82,7 +82,7 @@ public extension UIView {
}

/// SwifterSwift: Corner radius of view; also inspectable from Storyboard.
@IBInspectable var cornerRadius: CGFloat {
@IBInspectable var layerCornerRadius: CGFloat {
get {
return layer.cornerRadius
}
Expand Down
18 changes: 9 additions & 9 deletions Tests/UIKitTests/UIViewExtensionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ final class UIViewExtensionsTests: XCTestCase {
func testBorderColor() {
let frame = CGRect(x: 0, y: 0, width: 100, height: 100)
let view = UIView(frame: frame)
view.borderColor = nil
XCTAssertNil(view.borderColor)
view.borderColor = UIColor.red
view.layerBorderColor = nil
XCTAssertNil(view.layerBorderColor)
view.layerBorderColor = UIColor.red
XCTAssertNotNil(view.layer.borderColor)
XCTAssertEqual(view.borderColor!, UIColor.red)
XCTAssertEqual(view.layerBorderColor!, UIColor.red)
XCTAssertEqual(view.layer.borderColor!.uiColor, UIColor.red)
}

func testBorderWidth() {
let frame = CGRect(x: 0, y: 0, width: 100, height: 100)
let view = UIView(frame: frame)
view.borderWidth = 0
view.layerBorderWidth = 0
XCTAssertEqual(view.layer.borderWidth, 0)

view.borderWidth = 5
XCTAssertEqual(view.borderWidth, 5)
view.layerBorderWidth = 5
XCTAssertEqual(view.layerBorderWidth, 5)
}

func testCornerRadius() {
let frame = CGRect(x: 0, y: 0, width: 100, height: 100)
let view = UIView(frame: frame)
XCTAssertEqual(view.layer.cornerRadius, 0)

view.cornerRadius = 50
XCTAssertEqual(view.cornerRadius, 50)
view.layerCornerRadius = 50
XCTAssertEqual(view.layerCornerRadius, 50)
}

func testFirstResponder() {
Expand Down

0 comments on commit 32e8717

Please sign in to comment.