This commit is contained in:
Robert Payne 2015-11-08 21:18:01 +13:00
parent fdcc715085
commit 2dcf3bddfa
5 changed files with 59 additions and 64 deletions

View File

@ -7,8 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
779230441BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; settings = {ASSET_TAGS = (); }; }; 779230441BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; };
779230451BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; settings = {ASSET_TAGS = (); }; }; 779230451BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; };
EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; }; EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; };
EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; }; EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; };
EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; }; EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; };

View File

@ -27,14 +27,10 @@ import UIKit
import AppKit import AppKit
#endif #endif
// Type of object that can be a target of relation constraint.
// Doesn't cover system protocols which can't be extended with additional conformances.
public protocol RelationTarget { public protocol RelationTarget {
var constraintItem: ConstraintItem { get } var constraintItem: ConstraintItem { get }
} }
// Type of things that can be converted to floats. Used to provide a catch all for
// different numeric types.
public protocol FloatConvertible: RelationTarget { public protocol FloatConvertible: RelationTarget {
var floatValue: Float { get } var floatValue: Float { get }
} }
@ -196,7 +192,6 @@ public class ConstraintDescriptionRelatable {
self.backing = backing self.backing = backing
} }
public func equalTo(other: RelationTarget, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable { public func equalTo(other: RelationTarget, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
let location = SourceLocation(file: file, line: line) let location = SourceLocation(file: file, line: line)
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .Equal, location: location)) return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .Equal, location: location))
@ -307,7 +302,7 @@ public class ConstraintDescriptionExtendable: ConstraintDescriptionRelatable {
*/ */
internal class ConstraintDescription { internal class ConstraintDescription {
private var location : SourceLocation? private var location: SourceLocation? = nil
private var left: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Left) } private var left: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Left) }
private var top: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Top) } private var top: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Top) }