Skip to content

Commit

Permalink
Merge branch 'main' into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller authored Dec 13, 2023
2 parents c1b9ed0 + b35c649 commit 3515590
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 32 deletions.
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0
2 changes: 1 addition & 1 deletion .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3
- name: Build
run: bazelisk build --apple_platform_type=ios --cpu=ios_x86_64 //:Layout
run: bazelisk build --noenable_bzlmod //:all
12 changes: 10 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_build_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

ios_build_test(
name = "Layout-iOS",
minimum_os_version = "13.0",
targets = [":Layout"],
)

swift_library(
name = "Layout",
module_name = "Layout",
srcs = glob(["Sources/Layout/**/*.swift"], allow_empty = False),
srcs = glob(["Sources/Layout/**/*.swift"]),
copts = ["-strict-concurrency=complete"],
visibility = ["//visibility:public"],
tags = ["manual"],
)
23 changes: 15 additions & 8 deletions Sources/Layout/Layout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public final class Layout { // swiftlint:disable:this type_body_length
public func constrain(
_ view1: UIView,
to view2: UIView,
insets: CanonicalInsets = .zero
insets: CanonicalInsets
) -> Layout {
self
.constrain(view1.left, to: view2.left, constant: insets.left)
Expand All @@ -248,7 +248,7 @@ public final class Layout { // swiftlint:disable:this type_body_length
public func constrain(
_ view1: UIView,
to view2: UIView,
inset: CGFloat
inset: CGFloat = 0
) -> Layout {
constrain(view1,
to: view2,
Expand Down Expand Up @@ -407,12 +407,6 @@ public final class Layout { // swiftlint:disable:this type_body_length
return self
}

@discardableResult
public func withPriority(_ priority: UILayoutPriority) -> Layout {
constraints.prioritize(priority)
return self
}

@discardableResult
public func activate() -> Layout {
constraints.activate()
Expand All @@ -425,6 +419,19 @@ public final class Layout { // swiftlint:disable:this type_body_length
return self
}

public func require() -> Layout {
withPriority(.required)
}

public func withPriority(_ priority: UILayoutPriority) -> Layout {
constraints.prioritize(priority)
return self
}

public func prioritize(_ priority: UILayoutPriority) {
constraints.forEach { $0.prioritize(priority) }
}

public func update() {
view?.setNeedsUpdateConstraints()
view?.updateConstraintsIfNeeded()
Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/Attributes/CanonicalEdgeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/Attributes/DirectionalEdgeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/Builders/ConstraintsBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/Builders/LayoutBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/LayoutItemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/Swift/ArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/NSLayoutConstraintTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/NSLayoutDimensionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/NSLayoutXAxisAnchorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/NSLayoutYAxisAnchorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UILayoutGuideTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UILayoutPriorityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UILayoutSupportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UIView+AutoLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import UIKit
import XCTest
Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UIView+FramesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UIView+LayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import UIKit
import XCTest
Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UIView-AutoresizingMaskTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/LayoutTests/UIKit/UIViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.
//

@testable import Layout
import Layout
import Nimble
import XCTest

Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "8ac4c7997d863f3c4347ba996e831b5ec8f7af885ee8d4fe36f1c3c8f0092b2c",
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.5.0/rules_apple.2.5.0.tar.gz",
sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz",
)

load(
Expand Down

0 comments on commit 3515590

Please sign in to comment.