2 |
3 | ### [中文介绍](README_CN.md)
4 |
5 | :smile: **OKKLineSwift** is written in Swift3 to draw the stock K-line library
6 |
7 | ## Screenshot
8 |
9 | iOS Screenshot
10 | [Support drag gestures, long press gestures (see details), knead gestures (zoom in)]
11 |
12 | 
13 |
14 | macOS Screenshot
15 | [Support drag events, crosshairs follow, mouse scrolling events (zoom in)]
16 |
17 | 
18 |
19 | Support
20 | ===
21 | Swift 3.0
22 |
23 | iOS 8+
24 |
25 | macOS 10.10+
26 |
27 | Installation
28 | ===
29 | #### Manually
30 |
31 | 1. Download the full file.
32 | 2. Drag the OKKLineSwift folder to your project.
33 |
34 | ## Source directory
35 |
36 | |Directory | Description|
37 | | ---------- | -----------|
38 | | Configuration | OKConfiguration.swift - This is a global control class that controls the global theme (e.g. color, font size, etc.) |
39 | | Views | OKKLineView - This class is the parent view of all views OKKLineDrawView.swift - This class is a parent view of all K-line views that handle gestures and data sources OKValueView.swift - Responsible for drawing prices 1、MainView: OKKLineMainView.swift - Responsible for drawing the main graph 2、VolumeView: OKKLineVolumeView.swift - Responsible for drawing the volume view 3、AccessoryView: OKKLineAccessoryView.swift - Responsible for drawing the index view 4、SegmentView: OKSegmentView.swift - Responsible for displaying timeline or indicator type |
40 | | Models | Data model directory, mainly K-line data and a variety of indicators model |
41 | | Tools | Tool class directory,for example: OKLineBrush.swift - Responsible for drawing lines OKMALineBrush.swift - Responsible for drawing the average class|
42 |
43 | ## TODO
44 | - [x] Support macOS system
45 | - [ ] Support for more metric types
46 |
47 | ## Licenses
48 | All the OK at the beginning of the project source code to comply with MIT license.
49 | Copyright (c) 2016 Herb. All rights reserved.
50 |
51 | ## Contributions
52 | Welcome to contribute to your ideas and code! You can pull requests and issues here! :clap:
53 |
54 |
55 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 |
OKKLineSwift
2 |
3 | ### [English Introduction](README.md)
4 |
5 | :smile: **OKKLineSwift** 是本人用Swift3编写的绘制股票K线库
6 |
7 | ## 样例展示
8 |
9 | iOS Screenshot
10 | [支持拖动手势, 长按手势(查看详情), 捏合手势(放大缩小)]
11 |
12 | 
13 |
14 | macOS Screenshot
15 | [支持拖动事件,十字线跟随,鼠标滚动事件(放大缩小)]
16 |
17 | 
18 |
19 | 支持环境
20 | ===
21 | Swift 3.0
22 |
23 | iOS 8+
24 |
25 | macOS 10.10+
26 |
27 | 集成方法
28 | ===
29 | #### 手动安装
30 |
31 | 1. 下载所有文件.
32 | 2. 将OKKLineSwift文件夹拖拽到你的工程中.
33 |
34 | ## 源码目录(所有源码均放在Source文件夹下)
35 |
36 | |目录 | 说明|
37 | | ---------- | -----------|
38 | | Configuration | OKConfiguration.swift - 这是一个全局控制类,控制全局主题(e.g. 颜色,字号等 |
39 | | Views | OKKLineView - 此类是所有视图的父视图 OKKLineDrawView.swift - 此类是所有涉及K线视图的父视图,负责处理手势和数据源 OKValueView.swift - 负责绘制价格 1、MainView: OKKLineMainView.swift - 负责主图的绘制 2、VolumeView: OKKLineVolumeView.swift - 负责成交量视图的绘制 3、AccessoryView: OKKLineAccessoryView.swift - 负责指标视图的绘制 4、SegmentView: OKSegmentView.swift - 负责显示时间线或者指标类型 |
40 | | Models | 数据模型目录,主要是K线数据以及各种指标模型 |
41 | | Tools | 工具类目录,例如: OKLineBrush.swift - 负责画线的类 OKMALineBrush.swift - 负责画均线的类|
42 |
43 | ## TODO
44 | - [x] 支持 macOS 系统
45 | - [ ] 支持更多指标类型
46 |
47 | ## Licenses
48 | 本项目所有OK开头的源码遵守MIT license.
49 | Copyright (c) 2016 Herb. All rights reserved.
50 |
51 | ## Contributions
52 | 欢迎各位贡献你们的思路和代码! 您可以在这里pull requests和issues我! :clap:
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Screenshot/OKKLineSwift-iOS.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/herbsun/OKKLineSwift/ff5e60c6c3dac94ea3b0ce10169da0ac7f61eab5/Screenshot/OKKLineSwift-iOS.gif
--------------------------------------------------------------------------------
/Screenshot/OKKLineSwift-macOS.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/herbsun/OKKLineSwift/ff5e60c6c3dac94ea3b0ce10169da0ac7f61eab5/Screenshot/OKKLineSwift-macOS.gif
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
27 | #else
28 | import AppKit
29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection
30 | #endif
31 |
32 |
33 | public struct ConstraintConfig {
34 |
35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintConstantTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintConstantTarget {
32 | }
33 |
34 | extension CGPoint: ConstraintConstantTarget {
35 | }
36 |
37 | extension CGSize: ConstraintConstantTarget {
38 | }
39 |
40 | extension ConstraintInsets: ConstraintConstantTarget {
41 | }
42 |
43 | extension ConstraintConstantTarget {
44 |
45 | internal func constraintConstantTargetValueFor(layoutAttribute: NSLayoutAttribute) -> CGFloat {
46 | if let value = self as? CGFloat {
47 | return value
48 | }
49 |
50 | if let value = self as? Float {
51 | return CGFloat(value)
52 | }
53 |
54 | if let value = self as? Double {
55 | return CGFloat(value)
56 | }
57 |
58 | if let value = self as? Int {
59 | return CGFloat(value)
60 | }
61 |
62 | if let value = self as? UInt {
63 | return CGFloat(value)
64 | }
65 |
66 | if let value = self as? CGSize {
67 | if layoutAttribute == .width {
68 | return value.width
69 | } else if layoutAttribute == .height {
70 | return value.height
71 | } else {
72 | return 0.0
73 | }
74 | }
75 |
76 | if let value = self as? CGPoint {
77 | #if os(iOS) || os(tvOS)
78 | switch layoutAttribute {
79 | case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:
80 | return value.x
81 | case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline:
82 | return value.y
83 | case .width, .height, .notAnAttribute:
84 | return 0.0
85 | }
86 | #else
87 | switch layoutAttribute {
88 | case .left, .right, .leading, .trailing, .centerX:
89 | return value.x
90 | case .top, .bottom, .centerY, .lastBaseline, .firstBaseline:
91 | return value.y
92 | case .width, .height, .notAnAttribute:
93 | return 0.0
94 | }
95 | #endif
96 | }
97 |
98 | if let value = self as? ConstraintInsets {
99 | #if os(iOS) || os(tvOS)
100 | switch layoutAttribute {
101 | case .left, .leftMargin, .centerX, .centerXWithinMargins:
102 | return value.left
103 | case .top, .topMargin, .centerY, .centerYWithinMargins, .lastBaseline, .firstBaseline:
104 | return value.top
105 | case .right, .rightMargin:
106 | return -value.right
107 | case .bottom, .bottomMargin:
108 | return -value.bottom
109 | case .leading, .leadingMargin:
110 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
111 | case .trailing, .trailingMargin:
112 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
113 | case .width:
114 | return -(value.left + value.right)
115 | case .height:
116 | return -(value.top + value.bottom)
117 | case .notAnAttribute:
118 | return 0.0
119 | }
120 | #else
121 | switch layoutAttribute {
122 | case .left, .centerX:
123 | return value.left
124 | case .top, .centerY, .lastBaseline, .firstBaseline:
125 | return value.top
126 | case .right:
127 | return -value.right
128 | case .bottom:
129 | return -value.bottom
130 | case .leading:
131 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
132 | case .trailing:
133 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
134 | case .width:
135 | return -(value.left + value.right)
136 | case .height:
137 | return -(value.top + value.bottom)
138 | case .notAnAttribute:
139 | return 0.0
140 | }
141 | #endif
142 | }
143 |
144 | return 0.0
145 | }
146 |
147 | }
148 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintDSL {
32 |
33 | var target: AnyObject? { get }
34 |
35 | func setLabel(_ value: String?)
36 | func label() -> String?
37 |
38 | }
39 | extension ConstraintDSL {
40 |
41 | public func setLabel(_ value: String?) {
42 | objc_setAssociatedObject(self.target, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC)
43 | }
44 | public func label() -> String? {
45 | return objc_getAssociatedObject(self.target, &labelKey) as? String
46 | }
47 |
48 | }
49 | private var labelKey: UInt8 = 0
50 |
51 |
52 | public protocol ConstraintBasicAttributesDSL : ConstraintDSL {
53 | }
54 | extension ConstraintBasicAttributesDSL {
55 |
56 | // MARK: Basics
57 |
58 | public var left: ConstraintItem {
59 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.left)
60 | }
61 |
62 | public var top: ConstraintItem {
63 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
64 | }
65 |
66 | public var right: ConstraintItem {
67 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.right)
68 | }
69 |
70 | public var bottom: ConstraintItem {
71 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
72 | }
73 |
74 | public var leading: ConstraintItem {
75 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leading)
76 | }
77 |
78 | public var trailing: ConstraintItem {
79 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailing)
80 | }
81 |
82 | public var width: ConstraintItem {
83 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.width)
84 | }
85 |
86 | public var height: ConstraintItem {
87 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
88 | }
89 |
90 | public var centerX: ConstraintItem {
91 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerX)
92 | }
93 |
94 | public var centerY: ConstraintItem {
95 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerY)
96 | }
97 |
98 | public var edges: ConstraintItem {
99 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges)
100 | }
101 |
102 | public var size: ConstraintItem {
103 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size)
104 | }
105 |
106 | public var center: ConstraintItem {
107 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center)
108 | }
109 |
110 | }
111 |
112 | public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL {
113 | }
114 | extension ConstraintAttributesDSL {
115 |
116 | // MARK: Baselines
117 |
118 | @available(*, deprecated:3.0, message:"Use .lastBaseline instead")
119 | public var baseline: ConstraintItem {
120 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
121 | }
122 |
123 | @available(iOS 8.0, OSX 10.11, *)
124 | public var lastBaseline: ConstraintItem {
125 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
126 | }
127 |
128 | @available(iOS 8.0, OSX 10.11, *)
129 | public var firstBaseline: ConstraintItem {
130 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline)
131 | }
132 |
133 | // MARK: Margins
134 |
135 | @available(iOS 8.0, *)
136 | public var leftMargin: ConstraintItem {
137 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin)
138 | }
139 |
140 | @available(iOS 8.0, *)
141 | public var topMargin: ConstraintItem {
142 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin)
143 | }
144 |
145 | @available(iOS 8.0, *)
146 | public var rightMargin: ConstraintItem {
147 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin)
148 | }
149 |
150 | @available(iOS 8.0, *)
151 | public var bottomMargin: ConstraintItem {
152 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin)
153 | }
154 |
155 | @available(iOS 8.0, *)
156 | public var leadingMargin: ConstraintItem {
157 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin)
158 | }
159 |
160 | @available(iOS 8.0, *)
161 | public var trailingMargin: ConstraintItem {
162 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin)
163 | }
164 |
165 | @available(iOS 8.0, *)
166 | public var centerXWithinMargins: ConstraintItem {
167 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins)
168 | }
169 |
170 | @available(iOS 8.0, *)
171 | public var centerYWithinMargins: ConstraintItem {
172 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins)
173 | }
174 |
175 | @available(iOS 8.0, *)
176 | public var margins: ConstraintItem {
177 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins)
178 | }
179 |
180 | @available(iOS 8.0, *)
181 | public var centerWithinMargins: ConstraintItem {
182 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins)
183 | }
184 |
185 | }
186 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintDescription.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintDescription {
32 |
33 | internal let item: LayoutConstraintItem
34 | internal var attributes: ConstraintAttributes
35 | internal var relation: ConstraintRelation? = nil
36 | internal var sourceLocation: (String, UInt)? = nil
37 | internal var label: String? = nil
38 | internal var related: ConstraintItem? = nil
39 | internal var multiplier: ConstraintMultiplierTarget = 1.0
40 | internal var constant: ConstraintConstantTarget = 0.0
41 | internal var priority: ConstraintPriorityTarget = 1000.0
42 | internal lazy var constraint: Constraint? = {
43 | guard let relation = self.relation,
44 | let related = self.related,
45 | let sourceLocation = self.sourceLocation else {
46 | return nil
47 | }
48 | let from = ConstraintItem(target: self.item as AnyObject, attributes: self.attributes)
49 |
50 | return Constraint(
51 | from: from,
52 | to: related,
53 | relation: relation,
54 | sourceLocation: sourceLocation,
55 | label: self.label,
56 | multiplier: self.multiplier,
57 | constant: self.constant,
58 | priority: self.priority
59 | )
60 | }()
61 |
62 | // MARK: Initialization
63 |
64 | internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) {
65 | self.item = item
66 | self.attributes = attributes
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintInsetTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | extension Int: ConstraintInsetTarget {
35 | }
36 |
37 | extension UInt: ConstraintInsetTarget {
38 | }
39 |
40 | extension Float: ConstraintInsetTarget {
41 | }
42 |
43 | extension Double: ConstraintInsetTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintInsetTarget {
47 | }
48 |
49 | extension ConstraintInsets: ConstraintInsetTarget {
50 | }
51 |
52 | extension ConstraintInsetTarget {
53 |
54 | internal var constraintInsetTargetValue: ConstraintInsets {
55 | if let amount = self as? ConstraintInsets {
56 | return amount
57 | } else if let amount = self as? Float {
58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
59 | } else if let amount = self as? Double {
60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
61 | } else if let amount = self as? CGFloat {
62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
63 | } else if let amount = self as? Int {
64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
65 | } else if let amount = self as? UInt {
66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
67 | } else {
68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
69 | }
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintInsets.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | public typealias ConstraintInsets = UIEdgeInsets
33 | #else
34 | public typealias ConstraintInsets = EdgeInsets
35 | #endif
36 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintItem : Equatable {
32 |
33 | internal weak var target: AnyObject?
34 | internal let attributes: ConstraintAttributes
35 |
36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) {
37 | self.target = target
38 | self.attributes = attributes
39 | }
40 |
41 | internal var layoutConstraintItem: LayoutConstraintItem? {
42 | return self.target as? LayoutConstraintItem
43 | }
44 |
45 | }
46 |
47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
48 | // pointer equality
49 | guard lhs !== rhs else {
50 | return true
51 | }
52 |
53 | // must both have valid targets and identical attributes
54 | guard let target1 = lhs.target,
55 | let target2 = rhs.target,
56 | target1 === target2 && lhs.attributes == rhs.attributes else {
57 | return false
58 | }
59 |
60 | return true
61 | }
62 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintLayoutGuide+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #endif
27 |
28 |
29 | @available(iOS 9.0, OSX 10.11, *)
30 | public extension ConstraintLayoutGuide {
31 |
32 | public var snp: ConstraintLayoutGuideDSL {
33 | return ConstraintLayoutGuideDSL(guide: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintLayoutGuide.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | @available(iOS 9.0, *)
33 | public typealias ConstraintLayoutGuide = UILayoutGuide
34 | #else
35 | @available(OSX 10.11, *)
36 | public typealias ConstraintLayoutGuide = NSLayoutGuide
37 | #endif
38 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintLayoutGuideDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | @available(iOS 9.0, OSX 10.11, *)
32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {
33 |
34 | @discardableResult
35 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
36 | return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure)
37 | }
38 |
39 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
40 | ConstraintMaker.makeConstraints(item: self.guide, closure: closure)
41 | }
42 |
43 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
44 | ConstraintMaker.remakeConstraints(item: self.guide, closure: closure)
45 | }
46 |
47 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
48 | ConstraintMaker.updateConstraints(item: self.guide, closure: closure)
49 | }
50 |
51 | public func removeConstraints() {
52 | ConstraintMaker.removeConstraints(item: self.guide)
53 | }
54 |
55 | public var target: AnyObject? {
56 | return self.guide
57 | }
58 |
59 | internal let guide: ConstraintLayoutGuide
60 |
61 | internal init(guide: ConstraintLayoutGuide) {
62 | self.guide = guide
63 |
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintLayoutSupport.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | @available(iOS 8.0, *)
33 | public typealias ConstraintLayoutSupport = UILayoutSupport
34 | #else
35 | public class ConstraintLayoutSupport {}
36 | #endif
37 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintLayoutSupportDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | @available(iOS 8.0, *)
32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL {
33 |
34 | public var target: AnyObject? {
35 | return self.support
36 | }
37 |
38 | internal let support: ConstraintLayoutSupport
39 |
40 | internal init(support: ConstraintLayoutSupport) {
41 | self.support = support
42 |
43 | }
44 |
45 | public var top: ConstraintItem {
46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
47 | }
48 |
49 | public var bottom: ConstraintItem {
50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
51 | }
52 |
53 | public var height: ConstraintItem {
54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMaker.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 | public class ConstraintMaker {
31 |
32 | public var left: ConstraintMakerExtendable {
33 | return self.makeExtendableWithAttributes(.left)
34 | }
35 |
36 | public var top: ConstraintMakerExtendable {
37 | return self.makeExtendableWithAttributes(.top)
38 | }
39 |
40 | public var bottom: ConstraintMakerExtendable {
41 | return self.makeExtendableWithAttributes(.bottom)
42 | }
43 |
44 | public var right: ConstraintMakerExtendable {
45 | return self.makeExtendableWithAttributes(.right)
46 | }
47 |
48 | public var leading: ConstraintMakerExtendable {
49 | return self.makeExtendableWithAttributes(.leading)
50 | }
51 |
52 | public var trailing: ConstraintMakerExtendable {
53 | return self.makeExtendableWithAttributes(.trailing)
54 | }
55 |
56 | public var width: ConstraintMakerExtendable {
57 | return self.makeExtendableWithAttributes(.width)
58 | }
59 |
60 | public var height: ConstraintMakerExtendable {
61 | return self.makeExtendableWithAttributes(.height)
62 | }
63 |
64 | public var centerX: ConstraintMakerExtendable {
65 | return self.makeExtendableWithAttributes(.centerX)
66 | }
67 |
68 | public var centerY: ConstraintMakerExtendable {
69 | return self.makeExtendableWithAttributes(.centerY)
70 | }
71 |
72 | @available(*, deprecated:3.0, message:"Use lastBaseline instead")
73 | public var baseline: ConstraintMakerExtendable {
74 | return self.makeExtendableWithAttributes(.lastBaseline)
75 | }
76 |
77 | public var lastBaseline: ConstraintMakerExtendable {
78 | return self.makeExtendableWithAttributes(.lastBaseline)
79 | }
80 |
81 | @available(iOS 8.0, OSX 10.11, *)
82 | public var firstBaseline: ConstraintMakerExtendable {
83 | return self.makeExtendableWithAttributes(.firstBaseline)
84 | }
85 |
86 | @available(iOS 8.0, *)
87 | public var leftMargin: ConstraintMakerExtendable {
88 | return self.makeExtendableWithAttributes(.leftMargin)
89 | }
90 |
91 | @available(iOS 8.0, *)
92 | public var rightMargin: ConstraintMakerExtendable {
93 | return self.makeExtendableWithAttributes(.rightMargin)
94 | }
95 |
96 | @available(iOS 8.0, *)
97 | public var topMargin: ConstraintMakerExtendable {
98 | return self.makeExtendableWithAttributes(.topMargin)
99 | }
100 |
101 | @available(iOS 8.0, *)
102 | public var bottomMargin: ConstraintMakerExtendable {
103 | return self.makeExtendableWithAttributes(.bottomMargin)
104 | }
105 |
106 | @available(iOS 8.0, *)
107 | public var leadingMargin: ConstraintMakerExtendable {
108 | return self.makeExtendableWithAttributes(.leadingMargin)
109 | }
110 |
111 | @available(iOS 8.0, *)
112 | public var trailingMargin: ConstraintMakerExtendable {
113 | return self.makeExtendableWithAttributes(.trailingMargin)
114 | }
115 |
116 | @available(iOS 8.0, *)
117 | public var centerXWithinMargins: ConstraintMakerExtendable {
118 | return self.makeExtendableWithAttributes(.centerXWithinMargins)
119 | }
120 |
121 | @available(iOS 8.0, *)
122 | public var centerYWithinMargins: ConstraintMakerExtendable {
123 | return self.makeExtendableWithAttributes(.centerYWithinMargins)
124 | }
125 |
126 | public var edges: ConstraintMakerExtendable {
127 | return self.makeExtendableWithAttributes(.edges)
128 | }
129 | public var size: ConstraintMakerExtendable {
130 | return self.makeExtendableWithAttributes(.size)
131 | }
132 | public var center: ConstraintMakerExtendable {
133 | return self.makeExtendableWithAttributes(.center)
134 | }
135 |
136 | @available(iOS 8.0, *)
137 | public var margins: ConstraintMakerExtendable {
138 | return self.makeExtendableWithAttributes(.margins)
139 | }
140 |
141 | @available(iOS 8.0, *)
142 | public var centerWithinMargins: ConstraintMakerExtendable {
143 | return self.makeExtendableWithAttributes(.centerWithinMargins)
144 | }
145 |
146 | private let item: LayoutConstraintItem
147 | private var descriptions = [ConstraintDescription]()
148 |
149 | internal init(item: LayoutConstraintItem) {
150 | self.item = item
151 | self.item.prepare()
152 | }
153 |
154 | internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable {
155 | let description = ConstraintDescription(item: self.item, attributes: attributes)
156 | self.descriptions.append(description)
157 | return ConstraintMakerExtendable(description)
158 | }
159 |
160 | internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
161 | let maker = ConstraintMaker(item: item)
162 | closure(maker)
163 | let constraints = maker.descriptions
164 | .map { $0.constraint }
165 | .filter { $0 != nil }
166 | .map { $0! }
167 | return constraints
168 | }
169 |
170 | internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
171 | let maker = ConstraintMaker(item: item)
172 | closure(maker)
173 | let constraints = maker.descriptions
174 | .map { $0.constraint }
175 | .filter { $0 != nil }
176 | .map { $0! }
177 | for constraint in constraints {
178 | constraint.activateIfNeeded(updatingExisting: false)
179 | }
180 | }
181 |
182 | internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
183 | self.removeConstraints(item: item)
184 | self.makeConstraints(item: item, closure: closure)
185 | }
186 |
187 | internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
188 | guard item.constraints.count > 0 else {
189 | self.makeConstraints(item: item, closure: closure)
190 | return
191 | }
192 |
193 | let maker = ConstraintMaker(item: item)
194 | closure(maker)
195 | let constraints = maker.descriptions
196 | .map { $0.constraint }
197 | .filter { $0 != nil }
198 | .map { $0! }
199 | for constraint in constraints {
200 | constraint.activateIfNeeded(updatingExisting: true)
201 | }
202 | }
203 |
204 | internal static func removeConstraints(item: LayoutConstraintItem) {
205 | let constraints = item.constraints
206 | for constraint in constraints {
207 | constraint.deactivateIfNeeded()
208 | }
209 | }
210 |
211 | }
212 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMakerEditable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable {
32 |
33 | @discardableResult
34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
35 | self.description.multiplier = amount
36 | return self
37 | }
38 |
39 | @discardableResult
40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
42 | }
43 |
44 | @discardableResult
45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
46 | self.description.constant = amount.constraintOffsetTargetValue
47 | return self
48 | }
49 |
50 | @discardableResult
51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
52 | self.description.constant = amount.constraintInsetTargetValue
53 | return self
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMakerExtendable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerExtendable: ConstraintMakerRelatable {
32 |
33 | public var left: ConstraintMakerExtendable {
34 | self.description.attributes += .left
35 | return self
36 | }
37 |
38 | public var top: ConstraintMakerExtendable {
39 | self.description.attributes += .top
40 | return self
41 | }
42 |
43 | public var bottom: ConstraintMakerExtendable {
44 | self.description.attributes += .bottom
45 | return self
46 | }
47 |
48 | public var right: ConstraintMakerExtendable {
49 | self.description.attributes += .right
50 | return self
51 | }
52 |
53 | public var leading: ConstraintMakerExtendable {
54 | self.description.attributes += .leading
55 | return self
56 | }
57 |
58 | public var trailing: ConstraintMakerExtendable {
59 | self.description.attributes += .trailing
60 | return self
61 | }
62 |
63 | public var width: ConstraintMakerExtendable {
64 | self.description.attributes += .width
65 | return self
66 | }
67 |
68 | public var height: ConstraintMakerExtendable {
69 | self.description.attributes += .height
70 | return self
71 | }
72 |
73 | public var centerX: ConstraintMakerExtendable {
74 | self.description.attributes += .centerX
75 | return self
76 | }
77 |
78 | public var centerY: ConstraintMakerExtendable {
79 | self.description.attributes += .centerY
80 | return self
81 | }
82 |
83 | @available(*, deprecated:3.0, message:"Use lastBaseline instead")
84 | public var baseline: ConstraintMakerExtendable {
85 | self.description.attributes += .lastBaseline
86 | return self
87 | }
88 |
89 | public var lastBaseline: ConstraintMakerExtendable {
90 | self.description.attributes += .lastBaseline
91 | return self
92 | }
93 |
94 | @available(iOS 8.0, OSX 10.11, *)
95 | public var firstBaseline: ConstraintMakerExtendable {
96 | self.description.attributes += .firstBaseline
97 | return self
98 | }
99 |
100 | @available(iOS 8.0, *)
101 | public var leftMargin: ConstraintMakerExtendable {
102 | self.description.attributes += .leftMargin
103 | return self
104 | }
105 |
106 | @available(iOS 8.0, *)
107 | public var rightMargin: ConstraintMakerExtendable {
108 | self.description.attributes += .rightMargin
109 | return self
110 | }
111 |
112 | @available(iOS 8.0, *)
113 | public var bottomMargin: ConstraintMakerExtendable {
114 | self.description.attributes += .bottomMargin
115 | return self
116 | }
117 |
118 | @available(iOS 8.0, *)
119 | public var leadingMargin: ConstraintMakerExtendable {
120 | self.description.attributes += .leadingMargin
121 | return self
122 | }
123 |
124 | @available(iOS 8.0, *)
125 | public var trailingMargin: ConstraintMakerExtendable {
126 | self.description.attributes += .trailingMargin
127 | return self
128 | }
129 |
130 | @available(iOS 8.0, *)
131 | public var centerXWithinMargins: ConstraintMakerExtendable {
132 | self.description.attributes += .centerXWithinMargins
133 | return self
134 | }
135 |
136 | @available(iOS 8.0, *)
137 | public var centerYWithinMargins: ConstraintMakerExtendable {
138 | self.description.attributes += .centerYWithinMargins
139 | return self
140 | }
141 |
142 | public var edges: ConstraintMakerExtendable {
143 | self.description.attributes += .edges
144 | return self
145 | }
146 | public var size: ConstraintMakerExtendable {
147 | self.description.attributes += .size
148 | return self
149 | }
150 |
151 | @available(iOS 8.0, *)
152 | public var margins: ConstraintMakerExtendable {
153 | self.description.attributes += .margins
154 | return self
155 | }
156 |
157 | @available(iOS 8.0, *)
158 | public var centerWithinMargins: ConstraintMakerExtendable {
159 | self.description.attributes += .centerWithinMargins
160 | return self
161 | }
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMakerFinalizable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerFinalizable {
32 |
33 | internal let description: ConstraintDescription
34 |
35 | internal init(_ description: ConstraintDescription) {
36 | self.description = description
37 | }
38 |
39 | @discardableResult
40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable {
41 | self.description.label = label
42 | return self
43 | }
44 |
45 | public var constraint: Constraint {
46 | return self.description.constraint!
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMakerPriortizable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
32 |
33 | @discardableResult
34 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
35 | self.description.priority = amount
36 | return self
37 | }
38 |
39 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.")
40 | @discardableResult
41 | public func priorityRequired() -> ConstraintMakerFinalizable {
42 | return self.priority(1000)
43 | }
44 |
45 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.")
46 | @discardableResult
47 | public func priorityHigh() -> ConstraintMakerFinalizable {
48 | return self.priority(750)
49 | }
50 |
51 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.")
52 | @discardableResult
53 | public func priorityMedium() -> ConstraintMakerFinalizable {
54 | #if os(iOS) || os(tvOS)
55 | return self.priority(500)
56 | #else
57 | return self.priority(501)
58 | #endif
59 | }
60 |
61 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.")
62 | @discardableResult
63 | public func priorityLow() -> ConstraintMakerFinalizable {
64 | return self.priority(250)
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMakerRelatable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class ConstraintMakerRelatable {
32 |
33 | internal let description: ConstraintDescription
34 |
35 | internal init(_ description: ConstraintDescription) {
36 | self.description = description
37 | }
38 |
39 | internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {
40 | let related: ConstraintItem
41 | let constant: ConstraintConstantTarget
42 |
43 | if let other = other as? ConstraintItem {
44 | guard other.attributes == ConstraintAttributes.none ||
45 | other.attributes.layoutAttributes.count <= 1 ||
46 | other.attributes.layoutAttributes == self.description.attributes.layoutAttributes ||
47 | other.attributes == .edges && self.description.attributes == .margins ||
48 | other.attributes == .margins && self.description.attributes == .edges else {
49 | fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
50 | }
51 |
52 | related = other
53 | constant = 0.0
54 | } else if let other = other as? ConstraintView {
55 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
56 | constant = 0.0
57 | } else if let other = other as? ConstraintConstantTarget {
58 | related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
59 | constant = other
60 | } else {
61 | fatalError("Invalid constraint. (\(file), \(line))")
62 | }
63 |
64 | let editable = ConstraintMakerEditable(self.description)
65 | editable.description.sourceLocation = (file, line)
66 | editable.description.relation = relation
67 | editable.description.related = related
68 | editable.description.constant = constant
69 | return editable
70 | }
71 |
72 | @discardableResult
73 | public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
74 | return self.relatedTo(other, relation: .equal, file: file, line: line)
75 | }
76 |
77 | @discardableResult
78 | public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
79 | guard let other = self.description.item.superview else {
80 | fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
81 | }
82 | return self.relatedTo(other, relation: .equal, file: file, line: line)
83 | }
84 |
85 | @discardableResult
86 | public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
87 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
88 | }
89 |
90 | @discardableResult
91 | public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
92 | guard let other = self.description.item.superview else {
93 | fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
94 | }
95 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
96 | }
97 |
98 | @discardableResult
99 | public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
100 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
101 | }
102 |
103 | @discardableResult
104 | public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
105 | guard let other = self.description.item.superview else {
106 | fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
107 | }
108 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintMultiplierTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintMultiplierTarget {
32 |
33 | var constraintMultiplierTargetValue: CGFloat { get }
34 |
35 | }
36 |
37 | extension Int: ConstraintMultiplierTarget {
38 |
39 | public var constraintMultiplierTargetValue: CGFloat {
40 | return CGFloat(self)
41 | }
42 |
43 | }
44 |
45 | extension UInt: ConstraintMultiplierTarget {
46 |
47 | public var constraintMultiplierTargetValue: CGFloat {
48 | return CGFloat(self)
49 | }
50 |
51 | }
52 |
53 | extension Float: ConstraintMultiplierTarget {
54 |
55 | public var constraintMultiplierTargetValue: CGFloat {
56 | return CGFloat(self)
57 | }
58 |
59 | }
60 |
61 | extension Double: ConstraintMultiplierTarget {
62 |
63 | public var constraintMultiplierTargetValue: CGFloat {
64 | return CGFloat(self)
65 | }
66 |
67 | }
68 |
69 | extension CGFloat: ConstraintMultiplierTarget {
70 |
71 | public var constraintMultiplierTargetValue: CGFloat {
72 | return self
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintOffsetTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | extension Int: ConstraintOffsetTarget {
35 | }
36 |
37 | extension UInt: ConstraintOffsetTarget {
38 | }
39 |
40 | extension Float: ConstraintOffsetTarget {
41 | }
42 |
43 | extension Double: ConstraintOffsetTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintOffsetTarget {
47 | }
48 |
49 | extension ConstraintOffsetTarget {
50 |
51 | internal var constraintOffsetTargetValue: CGFloat {
52 | let offset: CGFloat
53 | if let amount = self as? Float {
54 | offset = CGFloat(amount)
55 | } else if let amount = self as? Double {
56 | offset = CGFloat(amount)
57 | } else if let amount = self as? CGFloat {
58 | offset = CGFloat(amount)
59 | } else if let amount = self as? Int {
60 | offset = CGFloat(amount)
61 | } else if let amount = self as? UInt {
62 | offset = CGFloat(amount)
63 | } else {
64 | offset = 0.0
65 | }
66 | return offset
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintPriorityTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintPriorityTarget {
32 |
33 | var constraintPriorityTargetValue: Float { get }
34 |
35 | }
36 |
37 | extension Int: ConstraintPriorityTarget {
38 |
39 | public var constraintPriorityTargetValue: Float {
40 | return Float(self)
41 | }
42 |
43 | }
44 |
45 | extension UInt: ConstraintPriorityTarget {
46 |
47 | public var constraintPriorityTargetValue: Float {
48 | return Float(self)
49 | }
50 |
51 | }
52 |
53 | extension Float: ConstraintPriorityTarget {
54 |
55 | public var constraintPriorityTargetValue: Float {
56 | return self
57 | }
58 |
59 | }
60 |
61 | extension Double: ConstraintPriorityTarget {
62 |
63 | public var constraintPriorityTargetValue: Float {
64 | return Float(self)
65 | }
66 |
67 | }
68 |
69 | extension CGFloat: ConstraintPriorityTarget {
70 |
71 | public var constraintPriorityTargetValue: Float {
72 | return Float(self)
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintRelatableTarget.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol ConstraintRelatableTarget {
32 | }
33 |
34 | extension Int: ConstraintRelatableTarget {
35 | }
36 |
37 | extension UInt: ConstraintRelatableTarget {
38 | }
39 |
40 | extension Float: ConstraintRelatableTarget {
41 | }
42 |
43 | extension Double: ConstraintRelatableTarget {
44 | }
45 |
46 | extension CGFloat: ConstraintRelatableTarget {
47 | }
48 |
49 | extension CGSize: ConstraintRelatableTarget {
50 | }
51 |
52 | extension CGPoint: ConstraintRelatableTarget {
53 | }
54 |
55 | extension ConstraintInsets: ConstraintRelatableTarget {
56 | }
57 |
58 | extension ConstraintItem: ConstraintRelatableTarget {
59 | }
60 |
61 | extension ConstraintView: ConstraintRelatableTarget {
62 | }
63 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintRelation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | internal enum ConstraintRelation : Int {
32 | case equal = 1
33 | case lessThanOrEqual
34 | case greaterThanOrEqual
35 |
36 | internal var layoutRelation: NSLayoutRelation {
37 | get {
38 | switch(self) {
39 | case .equal:
40 | return .equal
41 | case .lessThanOrEqual:
42 | return .lessThanOrEqual
43 | case .greaterThanOrEqual:
44 | return .greaterThanOrEqual
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintView+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public extension ConstraintView {
32 |
33 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
34 | public var snp_left: ConstraintItem { return self.snp.left }
35 |
36 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
37 | public var snp_top: ConstraintItem { return self.snp.top }
38 |
39 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
40 | public var snp_right: ConstraintItem { return self.snp.right }
41 |
42 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
43 | public var snp_bottom: ConstraintItem { return self.snp.bottom }
44 |
45 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
46 | public var snp_leading: ConstraintItem { return self.snp.leading }
47 |
48 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
49 | public var snp_trailing: ConstraintItem { return self.snp.trailing }
50 |
51 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
52 | public var snp_width: ConstraintItem { return self.snp.width }
53 |
54 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
55 | public var snp_height: ConstraintItem { return self.snp.height }
56 |
57 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
58 | public var snp_centerX: ConstraintItem { return self.snp.centerX }
59 |
60 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
61 | public var snp_centerY: ConstraintItem { return self.snp.centerY }
62 |
63 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
64 | public var snp_baseline: ConstraintItem { return self.snp.baseline }
65 |
66 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
67 | @available(iOS 8.0, OSX 10.11, *)
68 | public var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
69 |
70 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
71 | @available(iOS 8.0, OSX 10.11, *)
72 | public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
73 |
74 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
75 | @available(iOS 8.0, *)
76 | public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
77 |
78 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
79 | @available(iOS 8.0, *)
80 | public var snp_topMargin: ConstraintItem { return self.snp.topMargin }
81 |
82 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
83 | @available(iOS 8.0, *)
84 | public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
85 |
86 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
87 | @available(iOS 8.0, *)
88 | public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
89 |
90 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
91 | @available(iOS 8.0, *)
92 | public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
93 |
94 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
95 | @available(iOS 8.0, *)
96 | public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
97 |
98 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
99 | @available(iOS 8.0, *)
100 | public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
101 |
102 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
103 | @available(iOS 8.0, *)
104 | public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
105 |
106 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
107 | public var snp_edges: ConstraintItem { return self.snp.edges }
108 |
109 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
110 | public var snp_size: ConstraintItem { return self.snp.size }
111 |
112 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
113 | public var snp_center: ConstraintItem { return self.snp.center }
114 |
115 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
116 | @available(iOS 8.0, *)
117 | public var snp_margins: ConstraintItem { return self.snp.margins }
118 |
119 | @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
120 | @available(iOS 8.0, *)
121 | public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
122 |
123 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
124 | public func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
125 | return self.snp.prepareConstraints(closure)
126 | }
127 |
128 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
129 | public func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
130 | self.snp.makeConstraints(closure)
131 | }
132 |
133 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
134 | public func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
135 | self.snp.remakeConstraints(closure)
136 | }
137 |
138 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
139 | public func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
140 | self.snp.updateConstraints(closure)
141 | }
142 |
143 | @available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
144 | public func snp_removeConstraints() {
145 | self.snp.removeConstraints()
146 | }
147 |
148 | public var snp: ConstraintViewDSL {
149 | return ConstraintViewDSL(view: self)
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | #if os(iOS) || os(tvOS)
32 | public typealias ConstraintView = UIView
33 | #else
34 | public typealias ConstraintView = NSView
35 | #endif
36 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/ConstraintViewDSL.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public struct ConstraintViewDSL: ConstraintAttributesDSL {
32 |
33 | @discardableResult
34 | public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
35 | return ConstraintMaker.prepareConstraints(item: self.view, closure: closure)
36 | }
37 |
38 | public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
39 | ConstraintMaker.makeConstraints(item: self.view, closure: closure)
40 | }
41 |
42 | public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
43 | ConstraintMaker.remakeConstraints(item: self.view, closure: closure)
44 | }
45 |
46 | public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
47 | ConstraintMaker.updateConstraints(item: self.view, closure: closure)
48 | }
49 |
50 | public func removeConstraints() {
51 | ConstraintMaker.removeConstraints(item: self.view)
52 | }
53 |
54 | public var contentHuggingHorizontalPriority: Float {
55 | get {
56 | return self.view.contentHuggingPriority(for: .horizontal)
57 | }
58 | set {
59 | self.view.setContentHuggingPriority(newValue, for: .horizontal)
60 | }
61 | }
62 |
63 | public var contentHuggingVerticalPriority: Float {
64 | get {
65 | return self.view.contentHuggingPriority(for: .vertical)
66 | }
67 | set {
68 | self.view.setContentHuggingPriority(newValue, for: .vertical)
69 | }
70 | }
71 |
72 | public var contentCompressionResistanceHorizontalPriority: Float {
73 | get {
74 | return self.view.contentCompressionResistancePriority(for: .horizontal)
75 | }
76 | set {
77 | self.view.setContentHuggingPriority(newValue, for: .horizontal)
78 | }
79 | }
80 |
81 | public var contentCompressionResistanceVerticalPriority: Float {
82 | get {
83 | return self.view.contentCompressionResistancePriority(for: .vertical)
84 | }
85 | set {
86 | self.view.setContentCompressionResistancePriority(newValue, for: .vertical)
87 | }
88 | }
89 |
90 | public var target: AnyObject? {
91 | return self.view
92 | }
93 |
94 | internal let view: ConstraintView
95 |
96 | internal init(view: ConstraintView) {
97 | self.view = view
98 |
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/Debugging.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 | public extension LayoutConstraint {
31 |
32 | override public var description: String {
33 | var description = "<"
34 |
35 | description += descriptionForObject(self)
36 |
37 | if let firstItem = conditionalOptional(from: self.firstItem) {
38 | description += " \(descriptionForObject(firstItem))"
39 | }
40 |
41 | if self.firstAttribute != .notAnAttribute {
42 | description += ".\(descriptionForAttribute(self.firstAttribute))"
43 | }
44 |
45 | description += " \(descriptionForRelation(self.relation))"
46 |
47 | if let secondItem = self.secondItem {
48 | description += " \(descriptionForObject(secondItem))"
49 | }
50 |
51 | if self.secondAttribute != .notAnAttribute {
52 | description += ".\(descriptionForAttribute(self.secondAttribute))"
53 | }
54 |
55 | if self.multiplier != 1.0 {
56 | description += " * \(self.multiplier)"
57 | }
58 |
59 | if self.secondAttribute == .notAnAttribute {
60 | description += " \(self.constant)"
61 | } else {
62 | if self.constant > 0.0 {
63 | description += " + \(self.constant)"
64 | } else if self.constant < 0.0 {
65 | description += " - \(abs(self.constant))"
66 | }
67 | }
68 |
69 | if self.priority != 1000.0 {
70 | description += " ^\(self.priority)"
71 | }
72 |
73 | description += ">"
74 |
75 | return description
76 | }
77 |
78 | }
79 |
80 | private func descriptionForRelation(_ relation: NSLayoutRelation) -> String {
81 | switch relation {
82 | case .equal: return "=="
83 | case .greaterThanOrEqual: return ">="
84 | case .lessThanOrEqual: return "<="
85 | }
86 | }
87 |
88 | private func descriptionForAttribute(_ attribute: NSLayoutAttribute) -> String {
89 | #if os(iOS) || os(tvOS)
90 | switch attribute {
91 | case .notAnAttribute: return "notAnAttribute"
92 | case .top: return "top"
93 | case .left: return "left"
94 | case .bottom: return "bottom"
95 | case .right: return "right"
96 | case .leading: return "leading"
97 | case .trailing: return "trailing"
98 | case .width: return "width"
99 | case .height: return "height"
100 | case .centerX: return "centerX"
101 | case .centerY: return "centerY"
102 | case .lastBaseline: return "lastBaseline"
103 | case .firstBaseline: return "firstBaseline"
104 | case .topMargin: return "topMargin"
105 | case .leftMargin: return "leftMargin"
106 | case .bottomMargin: return "bottomMargin"
107 | case .rightMargin: return "rightMargin"
108 | case .leadingMargin: return "leadingMargin"
109 | case .trailingMargin: return "trailingMargin"
110 | case .centerXWithinMargins: return "centerXWithinMargins"
111 | case .centerYWithinMargins: return "centerYWithinMargins"
112 | }
113 | #else
114 | switch attribute {
115 | case .notAnAttribute: return "notAnAttribute"
116 | case .top: return "top"
117 | case .left: return "left"
118 | case .bottom: return "bottom"
119 | case .right: return "right"
120 | case .leading: return "leading"
121 | case .trailing: return "trailing"
122 | case .width: return "width"
123 | case .height: return "height"
124 | case .centerX: return "centerX"
125 | case .centerY: return "centerY"
126 | case .lastBaseline: return "lastBaseline"
127 | case .firstBaseline: return "firstBaseline"
128 | }
129 | #endif
130 | }
131 |
132 | private func conditionalOptional(from object: Optional) -> Optional {
133 | return object
134 | }
135 |
136 | private func conditionalOptional(from object: T) -> Optional {
137 | return Optional.some(object)
138 | }
139 |
140 | private func descriptionForObject(_ object: AnyObject) -> String {
141 | let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object)))
142 | var desc = ""
143 |
144 | desc += type(of: object).description()
145 |
146 | if let object = object as? ConstraintView {
147 | desc += ":\(object.snp.label() ?? pointerDescription)"
148 | } else if let object = object as? LayoutConstraint {
149 | desc += ":\(object.label ?? pointerDescription)"
150 | } else {
151 | desc += ":\(pointerDescription)"
152 | }
153 |
154 | if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {
155 | desc += "@\((file as NSString).lastPathComponent)#\(line)"
156 | }
157 |
158 | desc += ""
159 | return desc
160 | }
161 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/LayoutConstraint.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public class LayoutConstraint : NSLayoutConstraint {
32 |
33 | public var label: String? {
34 | get {
35 | return self.identifier
36 | }
37 | set {
38 | self.identifier = newValue
39 | }
40 | }
41 |
42 | internal weak var constraint: Constraint? = nil
43 |
44 | }
45 |
46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
47 | guard lhs.firstItem === rhs.firstItem &&
48 | lhs.secondItem === rhs.secondItem &&
49 | lhs.firstAttribute == rhs.firstAttribute &&
50 | lhs.secondAttribute == rhs.secondAttribute &&
51 | lhs.relation == rhs.relation &&
52 | lhs.priority == rhs.priority &&
53 | lhs.multiplier == rhs.multiplier else {
54 | return false
55 | }
56 | return true
57 | }
58 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/LayoutConstraintItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #else
27 | import AppKit
28 | #endif
29 |
30 |
31 | public protocol LayoutConstraintItem: class {
32 | }
33 |
34 | @available(iOS 9.0, OSX 10.11, *)
35 | extension ConstraintLayoutGuide : LayoutConstraintItem {
36 | }
37 |
38 | extension ConstraintView : LayoutConstraintItem {
39 | }
40 |
41 |
42 | extension LayoutConstraintItem {
43 |
44 | internal func prepare() {
45 | if let view = self as? ConstraintView {
46 | view.translatesAutoresizingMaskIntoConstraints = false
47 | }
48 | }
49 |
50 | internal var superview: ConstraintView? {
51 | if let view = self as? ConstraintView {
52 | return view.superview
53 | }
54 |
55 | if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {
56 | return guide.owningView
57 | }
58 |
59 | return nil
60 | }
61 | internal var constraints: [Constraint] {
62 | return self.constraintsHashTable.allObjects
63 | }
64 |
65 | internal func add(constraints: [Constraint]) {
66 | let hashTable = self.constraintsHashTable
67 | for constraint in constraints {
68 | hashTable.add(constraint)
69 | }
70 | }
71 |
72 | internal func remove(constraints: [Constraint]) {
73 | let hashTable = self.constraintsHashTable
74 | for constraint in constraints {
75 | hashTable.remove(constraint)
76 | }
77 | }
78 |
79 | private var constraintsHashTable: NSHashTable {
80 | let constraints: NSHashTable
81 |
82 | if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSHashTable {
83 | constraints = existing
84 | } else {
85 | constraints = NSHashTable()
86 | objc_setAssociatedObject(self, &constraintsKey, constraints, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
87 | }
88 | return constraints
89 |
90 | }
91 |
92 | }
93 | private var constraintsKey: UInt8 = 0
94 |
--------------------------------------------------------------------------------
/Vendors/SnapKit/SnapKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #import
25 |
26 | FOUNDATION_EXPORT double SnapKitVersionNumber;
27 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
--------------------------------------------------------------------------------
/Vendors/SnapKit/UILayoutSupport+Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SnapKit
3 | //
4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | // copies of the Software, and to permit persons to whom the Software is
11 | // furnished to do so, subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in
14 | // all copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | // THE SOFTWARE.
23 |
24 | #if os(iOS) || os(tvOS)
25 | import UIKit
26 | #endif
27 |
28 |
29 | @available(iOS 8.0, *)
30 | public extension ConstraintLayoutSupport {
31 |
32 | public var snp: ConstraintLayoutSupportDSL {
33 | return ConstraintLayoutSupportDSL(support: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------