Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add EdgeInsets.zero
Browse files Browse the repository at this point in the history
olejnjak committed Nov 8, 2023
1 parent 2575d84 commit 20d92be
Showing 4 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions ACKategories-iOSTests/EdgeInsetsTests.swift
Original file line number Diff line number Diff line change
@@ -14,4 +14,16 @@ final class EdgeInsetsTests: XCTestCase {
)
)
}

func test_zero() {
XCTAssertEqual(
EdgeInsets.zero,
.init(
top: 0,
leading: 0,
bottom: 0,
trailing: 0
)
)
}
}
2 changes: 2 additions & 0 deletions ACKategoriesCore/EdgeInsetsExtensions.swift
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ import SwiftUI

@available(iOS 13.0, macOS 10.15, *)
public extension SwiftUI.EdgeInsets {
static var zero: Self { .init(0) }

Check warning on line 6 in ACKategoriesCore/EdgeInsetsExtensions.swift

GitHub Actions / Swiftlint

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
/// Initialize edge insets with the same padding for all edges
init(_ size: CGFloat) {
self.init(
12 changes: 12 additions & 0 deletions ACKategoriesCoreTests/EdegeInsetsTests.swift
Original file line number Diff line number Diff line change
@@ -14,4 +14,16 @@ final class EdgeInsetsTests: XCTestCase {
)
)
}

func test_zero() {
XCTAssertEqual(
EdgeInsets.zero,
.init(
top: 0,
leading: 0,
bottom: 0,
trailing: 0
)
)
}
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
```

## Next
- Add helper init for `SwiftUI.EdgeInsets` that creates insets with equal values for all edges ([#138](https://github.com/AckeeCZ/ACKategories/pull/138), kudos to @olejnjak)
- Add helpers for `SwiftUI.EdgeInsets` ([#138](https://github.com/AckeeCZ/ACKategories/pull/138), kudos to @olejnjak)
- Bump deployment target to iOS 12 ([#137](https://github.com/AckeeCZ/ACKategories/pull/137), kudos to @olejnjak)
- Add Font modifier for SwiftUI fonts ([#134](https://github.com/AckeeCZ/ACKategories/pull/134), kudos to @leinhauplk)

0 comments on commit 20d92be

Please sign in to comment.