diff --git a/ACKategories-iOSTests/EdgeInsetsTests.swift b/ACKategories-iOSTests/EdgeInsetsTests.swift index 9962281c..9516013b 100644 --- a/ACKategories-iOSTests/EdgeInsetsTests.swift +++ b/ACKategories-iOSTests/EdgeInsetsTests.swift @@ -14,4 +14,16 @@ final class EdgeInsetsTests: XCTestCase { ) ) } + + func test_zero() { + XCTAssertEqual( + EdgeInsets.zero, + .init( + top: 0, + leading: 0, + bottom: 0, + trailing: 0 + ) + ) + } } diff --git a/ACKategoriesCore/EdgeInsetsExtensions.swift b/ACKategoriesCore/EdgeInsetsExtensions.swift index f708eb23..2cc2171a 100644 --- a/ACKategoriesCore/EdgeInsetsExtensions.swift +++ b/ACKategoriesCore/EdgeInsetsExtensions.swift @@ -2,6 +2,8 @@ import SwiftUI @available(iOS 13.0, macOS 10.15, *) public extension SwiftUI.EdgeInsets { + static var zero: Self { .init(0) } + /// Initialize edge insets with the same padding for all edges init(_ size: CGFloat) { self.init( diff --git a/ACKategoriesCoreTests/EdegeInsetsTests.swift b/ACKategoriesCoreTests/EdegeInsetsTests.swift index e3762b17..8fdc8f25 100644 --- a/ACKategoriesCoreTests/EdegeInsetsTests.swift +++ b/ACKategoriesCoreTests/EdegeInsetsTests.swift @@ -14,4 +14,16 @@ final class EdgeInsetsTests: XCTestCase { ) ) } + + func test_zero() { + XCTAssertEqual( + EdgeInsets.zero, + .init( + top: 0, + leading: 0, + bottom: 0, + trailing: 0 + ) + ) + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c1009a1..10c7ed0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)