Skip to content

Commit 2e601ad

Browse files
committed
Remove SwiftUI naming conflicts
1 parent 33f1f67 commit 2e601ad

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if canImport(UIKit)
22
import UIKit
3-
public typealias LayoutGuide = UILayoutGuide
3+
public typealias LayoutAidGuide = UILayoutGuide
44
#elseif canImport(AppKit)
55
import AppKit
6-
public typealias LayoutGuide = NSLayoutGuide
6+
public typealias LayoutAidGuide = NSLayoutGuide
77
#endif

Sources/LayoutAid/LayoutItem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public protocol LayoutItem {
2727
var heightAnchor: NSLayoutDimension { get }
2828
}
2929

30-
extension View: LayoutItem {}
31-
extension LayoutGuide: LayoutItem {}
30+
extension LayoutAidView: LayoutItem {}
31+
extension LayoutAidGuide: LayoutItem {}
3232

3333
public extension LayoutItem {
3434

Sources/LayoutAid/View.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#if canImport(UIKit)
22
import UIKit
3-
public typealias View = UIView
3+
public typealias LayoutAidView = UIView
44
#elseif canImport(AppKit)
55
import AppKit
6-
public typealias View = NSView
6+
public typealias LayoutAidView = NSView
77
#endif
88

9-
public extension View {
10-
var ancestors: AnyIterator<View> {
9+
public extension LayoutAidView {
10+
var ancestors: AnyIterator<LayoutAidView> {
1111

1212
var current = self
1313

@@ -21,7 +21,7 @@ public extension View {
2121
}
2222
}
2323

24-
var decendants: AnyIterator<View> {
24+
var decendants: AnyIterator<LayoutAidView> {
2525
var foundSubviews = subviews
2626

2727
return AnyIterator {

Tests/LayoutAidTests/ConstraintsBuilderTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import XCTest
33

44
#if canImport(UIKit)
55
import UIKit
6-
typealias BaseView = View
6+
typealias BaseView = LayoutAidView
77
#elseif canImport(AppKit)
88
import AppKit
99

10-
class BaseView: View {
10+
class BaseView: LayoutAidView {
1111
override var isFlipped: Bool {
1212
true
1313
}
@@ -18,7 +18,7 @@ class BaseView: View {
1818
// swiftlint:disable type_body_length
1919
final class ConstraintsBuilderTests: XCTestCase {
2020

21-
var containerView: View!
21+
var containerView: LayoutAidView!
2222

2323
let containerSize = CGSize(width: 1_024, height: 1_024)
2424

@@ -33,7 +33,7 @@ final class ConstraintsBuilderTests: XCTestCase {
3333
containerView = nil
3434
}
3535

36-
private func layout(view: View) {
36+
private func layout(view: LayoutAidView) {
3737
#if canImport(UIKit)
3838
containerView.layoutIfNeeded()
3939
#elseif canImport(AppKit)
@@ -42,10 +42,10 @@ final class ConstraintsBuilderTests: XCTestCase {
4242
}
4343

4444
private func createLayoutedView(
45-
in superview: View,
45+
in superview: LayoutAidView,
4646
caller: StaticString = #function,
4747
@LayoutConstraintsGeneratorBuilder _ content: () -> [LayoutConstraintsGenerator]
48-
) -> View {
48+
) -> LayoutAidView {
4949

5050
let view = BaseView()
5151
view.translatesAutoresizingMaskIntoConstraints = false
@@ -261,7 +261,7 @@ final class ConstraintsBuilderTests: XCTestCase {
261261
func testPerformance() {
262262

263263
measure {
264-
let view = View()
264+
let view = BaseView()
265265
view.translatesAutoresizingMaskIntoConstraints = false
266266
containerView.addSubview(view)
267267

@@ -279,7 +279,7 @@ final class ConstraintsBuilderTests: XCTestCase {
279279
func testFallbackPerformance() {
280280

281281
measure {
282-
let view = View()
282+
let view = BaseView()
283283
view.translatesAutoresizingMaskIntoConstraints = false
284284
containerView.addSubview(view)
285285

0 commit comments

Comments
 (0)