diff --git a/Sources/Layout/UIKit/UIView+UILayoutGuide.swift b/Sources/Layout/UIKit/UIView+UILayoutGuide.swift new file mode 100644 index 00000000..494a703b --- /dev/null +++ b/Sources/Layout/UIKit/UIView+UILayoutGuide.swift @@ -0,0 +1,21 @@ +// +// All Contributions by Match Group +// +// Copyright © 2024 Tinder (Match Group, LLC) +// +// Licensed under the Match Group Modified 3-Clause BSD License. +// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. +// + +import UIKit + +extension UIView { + + internal var margins: UILayoutGuide { + layoutMarginsGuide + } + + internal var safeArea: UILayoutGuide { + safeAreaLayoutGuide + } +} diff --git a/Tests/LayoutTests/UIKit/UIViewUILayoutGuideTests.swift b/Tests/LayoutTests/UIKit/UIViewUILayoutGuideTests.swift new file mode 100644 index 00000000..d96ccd11 --- /dev/null +++ b/Tests/LayoutTests/UIKit/UIViewUILayoutGuideTests.swift @@ -0,0 +1,26 @@ +// +// All Contributions by Match Group +// +// Copyright © 2024 Tinder (Match Group, LLC) +// +// Licensed under the Match Group Modified 3-Clause BSD License. +// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information. +// + +@testable import Layout +import Nimble +import XCTest + +@MainActor +final class UIViewUILayoutGuideTests: XCTestCase { + + func testMargins() { + let view: UIView = .init() + expect(view.margins) === view.layoutMarginsGuide + } + + func testSafeArea() { + let view: UIView = .init() + expect(view.safeArea) === view.safeAreaLayoutGuide + } +}