Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
a944d77d
Unverified
Commit
a944d77d
authored
May 24, 2019
by
Daniel Jonathan
Committed by
GitHub
May 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1236 from OrkhanAlikhanov/layout-relation
Added Layout relations
parents
091e1086
7f374791
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Sources/iOS/Layout/Layout.swift
+0
-0
Sources/iOS/Layout/LayoutConstraint.swift
+13
-4
No files found.
Sources/iOS/Layout/Layout.swift
View file @
a944d77d
This diff is collapsed.
Click to expand it.
Sources/iOS/Layout/LayoutConstraint.swift
View file @
a944d77d
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
import
UIKit
import
UIKit
/// A typealias for NSLayoutConstraint.Relation
public
typealias
LayoutRelation
=
NSLayoutConstraint
.
Relation
internal
struct
LayoutConstraint
{
internal
struct
LayoutConstraint
{
/// `From` anchor for the constraint.
/// `From` anchor for the constraint.
private
let
fromAnchor
:
LayoutAnchor
private
let
fromAnchor
:
LayoutAnchor
...
@@ -33,17 +36,23 @@ internal struct LayoutConstraint {
...
@@ -33,17 +36,23 @@ internal struct LayoutConstraint {
private
let
toAnchor
:
LayoutAnchor
private
let
toAnchor
:
LayoutAnchor
/// An array of constants for the constraint.
/// An array of constants for the constraint.
private
var
constants
:
[
CGFloat
]
private
let
constants
:
[
CGFloat
]
/// A LayoutRelation between anchors.
private
let
relation
:
LayoutRelation
/**
/**
An initializer taking `from` and `to` anchors and constants for the constraint.
An initializer taking `from` and `to` anchors
, their `relation`
and constants for the constraint.
- Parameter fromAnchor: A LayoutAnchor.
- Parameter fromAnchor: A LayoutAnchor.
- Parameter toAnchor: A LayoutAnchor.
- Parameter toAnchor: A LayoutAnchor.
- Parameter relation: A LayoutRelation between anchors.
- Parameter constants: An array of CGFloat.
- Parameter constants: An array of CGFloat.
*/
*/
init
(
fromAnchor
:
LayoutAnchor
,
toAnchor
:
LayoutAnchor
,
constants
:
[
CGFloat
])
{
init
(
fromAnchor
:
LayoutAnchor
,
toAnchor
:
LayoutAnchor
,
relation
:
LayoutRelation
,
constants
:
[
CGFloat
])
{
self
.
fromAnchor
=
fromAnchor
self
.
fromAnchor
=
fromAnchor
self
.
toAnchor
=
toAnchor
self
.
toAnchor
=
toAnchor
self
.
relation
=
relation
self
.
constants
=
constants
self
.
constants
=
constants
}
}
}
}
...
@@ -64,7 +73,7 @@ internal extension LayoutConstraint {
...
@@ -64,7 +73,7 @@ internal extension LayoutConstraint {
zip
(
zip
(
fromAnchor
.
attributes
,
toAnchor
.
attributes
),
constants
)
.
forEach
{
zip
(
zip
(
fromAnchor
.
attributes
,
toAnchor
.
attributes
),
constants
)
.
forEach
{
v
.
append
(
NSLayoutConstraint
(
item
:
fromAnchor
.
constraintable
as
Any
,
v
.
append
(
NSLayoutConstraint
(
item
:
fromAnchor
.
constraintable
as
Any
,
attribute
:
$0
.
0
,
attribute
:
$0
.
0
,
relatedBy
:
.
equal
,
relatedBy
:
relation
,
toItem
:
toAnchor
.
constraintable
,
toItem
:
toAnchor
.
constraintable
,
attribute
:
$0
.
1
,
attribute
:
$0
.
1
,
multiplier
:
1
,
multiplier
:
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment