Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode11 build issue fix #314

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cartography/Constrain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
///
/// - parameter clear: The `ConstraintGroup` whose constraints should be removed.
///
public func constrain(clear group: ConstraintGroup) {
public func cg_constrain(clear group: ConstraintGroup) {
group.replaceConstraints([])
}

Expand All @@ -23,7 +23,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem>(_ item: A, replace group: ConstraintGroup = .init(), block: (A.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem>(_ item: A, replace group: ConstraintGroup = .init(), block: (A.ProxyType) -> Void) -> ConstraintGroup {
let proxy = item.asProxy()

block(proxy)
Expand All @@ -41,7 +41,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem>(_ item1: A, _ item2: B, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem>(_ item1: A, _ item2: B, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand All @@ -63,7 +63,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand All @@ -87,7 +87,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand All @@ -113,7 +113,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -141,7 +141,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -171,7 +171,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -203,7 +203,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -237,7 +237,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem, I: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, _ item9: I, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType, I.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem, I: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, _ item9: I, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType, I.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -273,7 +273,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `item`.
///
@discardableResult public func constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem, I: LayoutItem, J: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, _ item9: I, _ item10: J, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType, I.ProxyType, J.ProxyType) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<A: LayoutItem, B: LayoutItem, C: LayoutItem, D: LayoutItem, E: LayoutItem, F: LayoutItem, G: LayoutItem, H: LayoutItem, I: LayoutItem, J: LayoutItem>(_ item1: A, _ item2: B, _ item3: C, _ item4: D, _ item5: E, _ item6: F, _ item7: G, _ item8: H, _ item9: I, _ item10: J, replace group: ConstraintGroup = .init(), block: (A.ProxyType, B.ProxyType, C.ProxyType, D.ProxyType, E.ProxyType, F.ProxyType, G.ProxyType, H.ProxyType, I.ProxyType, J.ProxyType) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy1 = item1.asProxy(context: ctx)
Expand Down Expand Up @@ -301,7 +301,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `items`.
///
@discardableResult public func constrain<T: LayoutItem>(_ items: [T], replace group: ConstraintGroup = .init(), block: ([T.ProxyType]) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<T: LayoutItem>(_ items: [T], replace group: ConstraintGroup = .init(), block: ([T.ProxyType]) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy = items.map { $0.asProxy(context: ctx) }
Expand All @@ -319,7 +319,7 @@ public func constrain(clear group: ConstraintGroup) {
/// replaced.
/// - parameter block: A block that declares the layout for `items`.
///
@discardableResult public func constrain<T, U: LayoutItem>(_ items: [T: U], replace group: ConstraintGroup = .init(), block: ([T: U.ProxyType]) -> Void) -> ConstraintGroup {
@discardableResult public func cg_constrain<T, U: LayoutItem>(_ items: [T: U], replace group: ConstraintGroup = .init(), block: ([T: U.ProxyType]) -> Void) -> ConstraintGroup {
let ctx = Context()

let proxy: [T: U.ProxyType] = items.mapValues { $0.asProxy(context: ctx) }
Expand Down
8 changes: 4 additions & 4 deletions CartographyTests/AlignSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AlignSpec: QuickSpec {
viewC = TestView(frame: CGRect.zero)
window.addSubview(viewC)

constrain(viewA) { view in
cg_constrain(viewA) { view in
view.height == 200
view.width == 200

Expand All @@ -33,7 +33,7 @@ class AlignSpec: QuickSpec {

describe("for edges") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
align(top: viewA, viewB, viewC)
align(right: viewA, viewB, viewC)
align(bottom: viewA, viewB, viewC)
Expand All @@ -55,7 +55,7 @@ class AlignSpec: QuickSpec {

describe("for horizontal and vertical centers") {
beforeEach {
constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
cg_constrain(viewA, viewB, viewC) { viewA, viewB, viewC in
viewA.size == viewB.size
viewB.size == viewC.size

Expand All @@ -78,7 +78,7 @@ class AlignSpec: QuickSpec {

describe("no constraints") {
it("should have no constraints for a single view alignment") {
constrain(viewA) { viewA in
cg_constrain(viewA) { viewA in
let constraints = align(top: [viewA])

expect(constraints.count).to(equal(0))
Expand Down
10 changes: 5 additions & 5 deletions CartographyTests/ConstraintGroupSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class ConstraintGroupSpec: QuickSpec {
var b: ConstraintGroup!

beforeEach {
a = constrain(view1) { view in
a = cg_constrain(view1) { view in
view.width == 100
view.height == 100
}

a.active = false

b = constrain(view1) { view in
b = cg_constrain(view1) { view in
view.width == 200
view.height == 200
}
Expand Down Expand Up @@ -60,7 +60,7 @@ class ConstraintGroupSpec: QuickSpec {
view2 = TestView(frame: CGRect.zero)
window.addSubview(view2)

constrain(view1, view2) { view1, view2 in
cg_constrain(view1, view2) { view1, view2 in
view1.top == view1.superview!.top + 10
view1.left == view1.superview!.left + 10
view1.right == view1.superview!.right - 10
Expand All @@ -75,15 +75,15 @@ class ConstraintGroupSpec: QuickSpec {
}

it("should update the view") {
let group = constrain(view2) { view2 in
let group = cg_constrain(view2) { view2 in
view2.height == 100
}

window.layoutIfNeeded()

expect(view2.frame.height).to(equal(100))

constrain(view2, replace: group) { view2 in
cg_constrain(view2, replace: group) { view2 in
view2.bottom >= view2.superview!.bottom
}

Expand Down
32 changes: 16 additions & 16 deletions CartographyTests/DimensionSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DimensionSpec: QuickSpec {

describe("LayoutProxy.width") {
it("should support relative equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width
}

Expand All @@ -27,7 +27,7 @@ class DimensionSpec: QuickSpec {
}

it("should support relative inequalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width <= view.superview!.width
view.width >= view.superview!.width
}
Expand All @@ -38,7 +38,7 @@ class DimensionSpec: QuickSpec {
}

it("should support addition") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width + 100
}

Expand All @@ -48,7 +48,7 @@ class DimensionSpec: QuickSpec {
}

it("should support subtraction") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width - 100
}

Expand All @@ -58,7 +58,7 @@ class DimensionSpec: QuickSpec {
}

it("should support multiplication") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width * 2
}

Expand All @@ -68,7 +68,7 @@ class DimensionSpec: QuickSpec {
}

it("should support division") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width / 2
}

Expand All @@ -78,7 +78,7 @@ class DimensionSpec: QuickSpec {
}

it("should support complex expressions") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == view.superview!.width / 2 + 100
}

Expand All @@ -88,7 +88,7 @@ class DimensionSpec: QuickSpec {
}

it("should support numerical equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.width == 200
}

Expand All @@ -100,7 +100,7 @@ class DimensionSpec: QuickSpec {

describe("LayoutProxy.height") {
it("should support relative equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height
}

Expand All @@ -110,7 +110,7 @@ class DimensionSpec: QuickSpec {
}

it("should support relative inequalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height <= view.superview!.height
view.height >= view.superview!.height
}
Expand All @@ -121,7 +121,7 @@ class DimensionSpec: QuickSpec {
}

it("should support addition") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height + 100
}

Expand All @@ -131,7 +131,7 @@ class DimensionSpec: QuickSpec {
}

it("should support subtraction") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height - 100
}

Expand All @@ -141,7 +141,7 @@ class DimensionSpec: QuickSpec {
}

it("should support multiplication") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height * 2
}

Expand All @@ -151,7 +151,7 @@ class DimensionSpec: QuickSpec {
}

it("should support division") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height / 2
}

Expand All @@ -161,7 +161,7 @@ class DimensionSpec: QuickSpec {
}

it("should support complex expressions") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == view.superview!.height / 2 + 100
}

Expand All @@ -171,7 +171,7 @@ class DimensionSpec: QuickSpec {
}

it("should support numerical equalities") {
constrain(view) { view in
cg_constrain(view) { view in
view.height == 200
}

Expand Down
Loading