Skip to content

Commit

Permalink
Add internal only UILayoutGuide extensions (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller authored Feb 22, 2024
1 parent 7eaa09a commit 4e8801d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Sources/Layout/UIKit/UIView+UILayoutGuide.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
26 changes: 26 additions & 0 deletions Tests/LayoutTests/UIKit/UIViewUILayoutGuideTests.swift
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 4e8801d

Please sign in to comment.