├── .gitignore
├── .travis.yml
├── Example
├── FSEmptyDataSet.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── FSEmptyDataSet-Example.xcscheme
├── FSEmptyDataSet.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── FSEmptyDataSet
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ └── ViewController.swift
├── Podfile
├── Podfile.lock
└── Pods
│ ├── Local Podspecs
│ └── FSEmptyDataSet.podspec.json
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── FSEmptyDataSet.xcscheme
│ ├── SnapKit
│ ├── LICENSE
│ ├── README.md
│ └── Sources
│ │ ├── Constraint.swift
│ │ ├── ConstraintAttributes.swift
│ │ ├── ConstraintConfig.swift
│ │ ├── ConstraintConstantTarget.swift
│ │ ├── ConstraintDSL.swift
│ │ ├── ConstraintDescription.swift
│ │ ├── ConstraintDirectionalInsetTarget.swift
│ │ ├── ConstraintDirectionalInsets.swift
│ │ ├── ConstraintInsetTarget.swift
│ │ ├── ConstraintInsets.swift
│ │ ├── ConstraintItem.swift
│ │ ├── ConstraintLayoutGuide+Extensions.swift
│ │ ├── ConstraintLayoutGuide.swift
│ │ ├── ConstraintLayoutGuideDSL.swift
│ │ ├── ConstraintLayoutSupport.swift
│ │ ├── ConstraintLayoutSupportDSL.swift
│ │ ├── ConstraintMaker.swift
│ │ ├── ConstraintMakerEditable.swift
│ │ ├── ConstraintMakerExtendable.swift
│ │ ├── ConstraintMakerFinalizable.swift
│ │ ├── ConstraintMakerPrioritizable.swift
│ │ ├── ConstraintMakerRelatable+Extensions.swift
│ │ ├── ConstraintMakerRelatable.swift
│ │ ├── ConstraintMultiplierTarget.swift
│ │ ├── ConstraintOffsetTarget.swift
│ │ ├── ConstraintPriority.swift
│ │ ├── ConstraintPriorityTarget.swift
│ │ ├── ConstraintRelatableTarget.swift
│ │ ├── ConstraintRelation.swift
│ │ ├── ConstraintView+Extensions.swift
│ │ ├── ConstraintView.swift
│ │ ├── ConstraintViewDSL.swift
│ │ ├── Debugging.swift
│ │ ├── LayoutConstraint.swift
│ │ ├── LayoutConstraintItem.swift
│ │ ├── Typealiases.swift
│ │ └── UILayoutSupport+Extensions.swift
│ └── Target Support Files
│ ├── FSEmptyDataSet
│ ├── FSEmptyDataSet-Info.plist
│ ├── FSEmptyDataSet-dummy.m
│ ├── FSEmptyDataSet-prefix.pch
│ ├── FSEmptyDataSet-umbrella.h
│ ├── FSEmptyDataSet.debug.xcconfig
│ ├── FSEmptyDataSet.modulemap
│ └── FSEmptyDataSet.release.xcconfig
│ ├── Pods-FSEmptyDataSet_Example
│ ├── Pods-FSEmptyDataSet_Example-Info.plist
│ ├── Pods-FSEmptyDataSet_Example-acknowledgements.markdown
│ ├── Pods-FSEmptyDataSet_Example-acknowledgements.plist
│ ├── Pods-FSEmptyDataSet_Example-dummy.m
│ ├── Pods-FSEmptyDataSet_Example-frameworks.sh
│ ├── Pods-FSEmptyDataSet_Example-umbrella.h
│ ├── Pods-FSEmptyDataSet_Example.debug.xcconfig
│ ├── Pods-FSEmptyDataSet_Example.modulemap
│ └── Pods-FSEmptyDataSet_Example.release.xcconfig
│ └── SnapKit
│ ├── SnapKit-Info.plist
│ ├── SnapKit-dummy.m
│ ├── SnapKit-prefix.pch
│ ├── SnapKit-umbrella.h
│ ├── SnapKit.debug.xcconfig
│ ├── SnapKit.modulemap
│ └── SnapKit.release.xcconfig
├── FSEmptyDataSet.podspec
├── LICENSE
├── README.md
├── Sources
└── Classes
│ ├── FSEmptyContent.swift
│ ├── FSEmptyContentProxy.swift
│ ├── FSEmptyView.swift
│ ├── FSEmptyViewDataSource.swift
│ └── FSEmptyViewDelegate.swift
└── _Pods.xcodeproj
/.gitignore:
--------------------------------------------------------------------------------
1 | # macOS
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata/
15 | *.xccheckout
16 | *.moved-aside
17 | DerivedData
18 | *.hmap
19 | *.ipa
20 |
21 | # Bundler
22 | .bundle
23 |
24 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
25 | # Carthage/Checkouts
26 |
27 | Carthage/Build
28 |
29 | # We recommend against adding the Pods directory to your .gitignore. However
30 | # you should judge for yourself, the pros and cons are mentioned at:
31 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
32 | #
33 | # Note: if you ignore the Pods directory, make sure to uncomment
34 | # `pod install` in .travis.yml
35 | #
36 | # Pods/
37 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # references:
2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/
3 | # * https://github.com/supermarin/xcpretty#usage
4 |
5 | osx_image: xcode7.3
6 | language: objective-c
7 | # cache: cocoapods
8 | # podfile: Example/Podfile
9 | # before_install:
10 | # - gem install cocoapods # Since Travis is not always on latest version
11 | # - pod install --project-directory=Example
12 | script:
13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/FSEmptyDataSet.xcworkspace -scheme FSEmptyDataSet-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
14 | - pod lib lint
15 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet.xcodeproj/xcshareddata/xcschemes/FSEmptyDataSet-Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
51 |
52 |
53 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
76 |
78 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 12/25/2023.
6 | // Copyright (c) 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
17 | return true
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen.xib
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UIStatusBarHidden
34 |
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationPortrait
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationPortrait
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Example/FSEmptyDataSet/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 12/25/2023.
6 | // Copyright (c) 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SnapKit
11 | import FSEmptyDataSet
12 |
13 | class ViewController: UIViewController {
14 |
15 | private let emptyView = FSEmptyView()
16 |
17 | override func viewDidLoad() {
18 | super.viewDidLoad()
19 | view.addSubview(emptyView)
20 | emptyView.snp.makeConstraints { make in
21 | make.width.lessThanOrEqualToSuperview().offset(-30.0)
22 | make.center.equalToSuperview()
23 | }
24 | startLoading()
25 | }
26 |
27 | private func startLoading() {
28 | emptyView.content = FSEmptyContent(type: .loading(title: "Loading...", tintColor: .darkGray))
29 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
30 | let content = FSEmptyContent(type: .reload(title: "Reload", tintColor: .red))
31 | self.emptyView.content = content
32 | content.onDidPressButton = { [unowned self] _ in
33 | self.startLoading()
34 | }
35 | }
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 |
2 | use_frameworks!
3 | platform :ios, '11.0'
4 |
5 | target 'FSEmptyDataSet_Example' do
6 | pod 'FSEmptyDataSet', :path => '../'
7 | pod 'SnapKit'
8 | end
9 |
10 | post_install do |installer|
11 | installer.pods_project.root_object.attributes["ORGANIZATIONNAME"] = "Sheng"
12 | # disable bitcode.
13 | installer.pods_project.targets.each do |target|
14 | target.build_configurations.each do |config|
15 | config.build_settings['ENABLE_BITCODE'] = 'NO'
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FSEmptyDataSet (2.0.0)
3 | - SnapKit (5.6.0)
4 |
5 | DEPENDENCIES:
6 | - FSEmptyDataSet (from `../`)
7 | - SnapKit
8 |
9 | SPEC REPOS:
10 | trunk:
11 | - SnapKit
12 |
13 | EXTERNAL SOURCES:
14 | FSEmptyDataSet:
15 | :path: "../"
16 |
17 | SPEC CHECKSUMS:
18 | FSEmptyDataSet: 253639bb55591f603cc9c7a39c3865e7071cd666
19 | SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
20 |
21 | PODFILE CHECKSUM: 6545e0b2084460052859c6207d4b5d8109f1ff74
22 |
23 | COCOAPODS: 1.15.2
24 |
--------------------------------------------------------------------------------
/Example/Pods/Local Podspecs/FSEmptyDataSet.podspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "FSEmptyDataSet",
3 | "version": "2.0.0",
4 | "summary": "An easy-to-use empty placeholder library for iOS written in Swift.",
5 | "homepage": "https://github.com/lifution/FSEmptyDataSet",
6 | "license": {
7 | "type": "MIT",
8 | "file": "LICENSE"
9 | },
10 | "authors": "Sheng",
11 | "source": {
12 | "git": "https://github.com/lifution/FSEmptyDataSet.git",
13 | "tag": "2.0.0"
14 | },
15 | "requires_arc": true,
16 | "swift_versions": "5",
17 | "platforms": {
18 | "ios": "11.0"
19 | },
20 | "frameworks": [
21 | "UIKit",
22 | "Foundation"
23 | ],
24 | "source_files": "Sources/Classes/**/*",
25 | "swift_version": "5"
26 | }
27 |
--------------------------------------------------------------------------------
/Example/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FSEmptyDataSet (2.0.0)
3 | - SnapKit (5.6.0)
4 |
5 | DEPENDENCIES:
6 | - FSEmptyDataSet (from `../`)
7 | - SnapKit
8 |
9 | SPEC REPOS:
10 | trunk:
11 | - SnapKit
12 |
13 | EXTERNAL SOURCES:
14 | FSEmptyDataSet:
15 | :path: "../"
16 |
17 | SPEC CHECKSUMS:
18 | FSEmptyDataSet: 253639bb55591f603cc9c7a39c3865e7071cd666
19 | SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
20 |
21 | PODFILE CHECKSUM: 6545e0b2084460052859c6207d4b5d8109f1ff74
22 |
23 | COCOAPODS: 1.15.2
24 |
--------------------------------------------------------------------------------
/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/FSEmptyDataSet.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
4 |
5 | [](https://travis-ci.org/SnapKit/SnapKit)
6 | [](https://github.com/SnapKit/SnapKit)
7 | [](https://cocoapods.org/pods/SnapKit)
8 | [](https://github.com/Carthage/Carthage)
9 |
10 | #### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️
11 | #### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️
12 |
13 | ## Contents
14 |
15 | - [Requirements](#requirements)
16 | - [Migration Guides](#migration-guides)
17 | - [Communication](#communication)
18 | - [Installation](#installation)
19 | - [Usage](#usage)
20 | - [Credits](#credits)
21 | - [License](#license)
22 |
23 | ## Requirements
24 |
25 | - iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+
26 | - Xcode 10.0+
27 | - Swift 4.0+
28 |
29 | ## Migration Guides
30 |
31 | - [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)
32 |
33 | ## Communication
34 |
35 | - If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')
36 | - If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).
37 | - If you **found a bug**, open an issue.
38 | - If you **have a feature request**, open an issue.
39 | - If you **want to contribute**, submit a pull request.
40 |
41 |
42 | ## Installation
43 |
44 | ### CocoaPods
45 |
46 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
47 |
48 | ```bash
49 | $ gem install cocoapods
50 | ```
51 |
52 | > CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
53 |
54 | To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
55 |
56 | ```ruby
57 | source 'https://github.com/CocoaPods/Specs.git'
58 | platform :ios, '10.0'
59 | use_frameworks!
60 |
61 | target '' do
62 | pod 'SnapKit', '~> 5.6.0'
63 | end
64 | ```
65 |
66 | Then, run the following command:
67 |
68 | ```bash
69 | $ pod install
70 | ```
71 |
72 | ### Carthage
73 |
74 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
75 |
76 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
77 |
78 | ```bash
79 | $ brew update
80 | $ brew install carthage
81 | ```
82 |
83 | To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
84 |
85 | ```ogdl
86 | github "SnapKit/SnapKit" ~> 5.0.0
87 | ```
88 |
89 | Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
90 |
91 | ### Swift Package Manager
92 |
93 | [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
94 |
95 | > Xcode 11+ is required to build SnapKit using Swift Package Manager.
96 |
97 | To integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:
98 |
99 | ```swift
100 | dependencies: [
101 | .package(url: "https://github.com/SnapKit/SnapKit.git", .upToNextMajor(from: "5.0.1"))
102 | ]
103 | ```
104 |
105 | ### Manually
106 |
107 | If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
108 |
109 | ---
110 |
111 | ## Usage
112 |
113 | ### Quick Start
114 |
115 | ```swift
116 | import SnapKit
117 |
118 | class MyViewController: UIViewController {
119 |
120 | lazy var box = UIView()
121 |
122 | override func viewDidLoad() {
123 | super.viewDidLoad()
124 |
125 | self.view.addSubview(box)
126 | box.backgroundColor = .green
127 | box.snp.makeConstraints { (make) -> Void in
128 | make.width.height.equalTo(50)
129 | make.center.equalTo(self.view)
130 | }
131 | }
132 |
133 | }
134 | ```
135 |
136 | ### Playground
137 | You can try SnapKit in Playground.
138 |
139 | **Note:**
140 |
141 | > To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
142 |
143 | ### Resources
144 |
145 | - [Documentation](https://snapkit.github.io/SnapKit/docs/)
146 | - [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)
147 |
148 | ## Credits
149 |
150 | - Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
151 | - Many other contributors
152 |
153 | ## License
154 |
155 | SnapKit is released under the MIT license. See LICENSE for details.
156 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/Constraint.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 final class Constraint {
31 |
32 | internal let sourceLocation: (String, UInt)
33 | internal let label: String?
34 |
35 | private let from: ConstraintItem
36 | private let to: ConstraintItem
37 | private let relation: ConstraintRelation
38 | private let multiplier: ConstraintMultiplierTarget
39 | private var constant: ConstraintConstantTarget {
40 | didSet {
41 | self.updateConstantAndPriorityIfNeeded()
42 | }
43 | }
44 | private var priority: ConstraintPriorityTarget {
45 | didSet {
46 | self.updateConstantAndPriorityIfNeeded()
47 | }
48 | }
49 | public var layoutConstraints: [LayoutConstraint]
50 |
51 | public var isActive: Bool {
52 | set {
53 | if newValue {
54 | activate()
55 | }
56 | else {
57 | deactivate()
58 | }
59 | }
60 |
61 | get {
62 | for layoutConstraint in self.layoutConstraints {
63 | if layoutConstraint.isActive {
64 | return true
65 | }
66 | }
67 | return false
68 | }
69 | }
70 |
71 | // MARK: Initialization
72 |
73 | internal init(from: ConstraintItem,
74 | to: ConstraintItem,
75 | relation: ConstraintRelation,
76 | sourceLocation: (String, UInt),
77 | label: String?,
78 | multiplier: ConstraintMultiplierTarget,
79 | constant: ConstraintConstantTarget,
80 | priority: ConstraintPriorityTarget) {
81 | self.from = from
82 | self.to = to
83 | self.relation = relation
84 | self.sourceLocation = sourceLocation
85 | self.label = label
86 | self.multiplier = multiplier
87 | self.constant = constant
88 | self.priority = priority
89 | self.layoutConstraints = []
90 |
91 | // get attributes
92 | let layoutFromAttributes = self.from.attributes.layoutAttributes
93 | let layoutToAttributes = self.to.attributes.layoutAttributes
94 |
95 | // get layout from
96 | let layoutFrom = self.from.layoutConstraintItem!
97 |
98 | // get relation
99 | let layoutRelation = self.relation.layoutRelation
100 |
101 | for layoutFromAttribute in layoutFromAttributes {
102 | // get layout to attribute
103 | let layoutToAttribute: LayoutAttribute
104 | #if os(iOS) || os(tvOS)
105 | if layoutToAttributes.count > 0 {
106 | if self.from.attributes == .edges && self.to.attributes == .margins {
107 | switch layoutFromAttribute {
108 | case .left:
109 | layoutToAttribute = .leftMargin
110 | case .right:
111 | layoutToAttribute = .rightMargin
112 | case .top:
113 | layoutToAttribute = .topMargin
114 | case .bottom:
115 | layoutToAttribute = .bottomMargin
116 | default:
117 | fatalError()
118 | }
119 | } else if self.from.attributes == .margins && self.to.attributes == .edges {
120 | switch layoutFromAttribute {
121 | case .leftMargin:
122 | layoutToAttribute = .left
123 | case .rightMargin:
124 | layoutToAttribute = .right
125 | case .topMargin:
126 | layoutToAttribute = .top
127 | case .bottomMargin:
128 | layoutToAttribute = .bottom
129 | default:
130 | fatalError()
131 | }
132 | } else if self.from.attributes == .directionalEdges && self.to.attributes == .directionalMargins {
133 | switch layoutFromAttribute {
134 | case .leading:
135 | layoutToAttribute = .leadingMargin
136 | case .trailing:
137 | layoutToAttribute = .trailingMargin
138 | case .top:
139 | layoutToAttribute = .topMargin
140 | case .bottom:
141 | layoutToAttribute = .bottomMargin
142 | default:
143 | fatalError()
144 | }
145 | } else if self.from.attributes == .directionalMargins && self.to.attributes == .directionalEdges {
146 | switch layoutFromAttribute {
147 | case .leadingMargin:
148 | layoutToAttribute = .leading
149 | case .trailingMargin:
150 | layoutToAttribute = .trailing
151 | case .topMargin:
152 | layoutToAttribute = .top
153 | case .bottomMargin:
154 | layoutToAttribute = .bottom
155 | default:
156 | fatalError()
157 | }
158 | } else if self.from.attributes == self.to.attributes {
159 | layoutToAttribute = layoutFromAttribute
160 | } else {
161 | layoutToAttribute = layoutToAttributes[0]
162 | }
163 | } else {
164 | if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) {
165 | layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top
166 | } else {
167 | layoutToAttribute = layoutFromAttribute
168 | }
169 | }
170 | #else
171 | if self.from.attributes == self.to.attributes {
172 | layoutToAttribute = layoutFromAttribute
173 | } else if layoutToAttributes.count > 0 {
174 | layoutToAttribute = layoutToAttributes[0]
175 | } else {
176 | layoutToAttribute = layoutFromAttribute
177 | }
178 | #endif
179 |
180 | // get layout constant
181 | let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)
182 |
183 | // get layout to
184 | var layoutTo: AnyObject? = self.to.target
185 |
186 | // use superview if possible
187 | if layoutTo == nil && layoutToAttribute != .width && layoutToAttribute != .height {
188 | layoutTo = layoutFrom.superview
189 | }
190 |
191 | // create layout constraint
192 | let layoutConstraint = LayoutConstraint(
193 | item: layoutFrom,
194 | attribute: layoutFromAttribute,
195 | relatedBy: layoutRelation,
196 | toItem: layoutTo,
197 | attribute: layoutToAttribute,
198 | multiplier: self.multiplier.constraintMultiplierTargetValue,
199 | constant: layoutConstant
200 | )
201 |
202 | // set label
203 | layoutConstraint.label = self.label
204 |
205 | // set priority
206 | layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
207 |
208 | // set constraint
209 | layoutConstraint.constraint = self
210 |
211 | // append
212 | self.layoutConstraints.append(layoutConstraint)
213 | }
214 | }
215 |
216 | // MARK: Public
217 |
218 | @available(*, deprecated, renamed:"activate()")
219 | public func install() {
220 | self.activate()
221 | }
222 |
223 | @available(*, deprecated, renamed:"deactivate()")
224 | public func uninstall() {
225 | self.deactivate()
226 | }
227 |
228 | public func activate() {
229 | self.activateIfNeeded()
230 | }
231 |
232 | public func deactivate() {
233 | self.deactivateIfNeeded()
234 | }
235 |
236 | @discardableResult
237 | public func update(offset: ConstraintOffsetTarget) -> Constraint {
238 | self.constant = offset.constraintOffsetTargetValue
239 | return self
240 | }
241 |
242 | @discardableResult
243 | public func update(inset: ConstraintInsetTarget) -> Constraint {
244 | self.constant = inset.constraintInsetTargetValue
245 | return self
246 | }
247 |
248 | #if os(iOS) || os(tvOS)
249 | @discardableResult
250 | @available(iOS 11.0, tvOS 11.0, *)
251 | public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint {
252 | self.constant = inset.constraintDirectionalInsetTargetValue
253 | return self
254 | }
255 | #endif
256 |
257 | @discardableResult
258 | public func update(priority: ConstraintPriorityTarget) -> Constraint {
259 | self.priority = priority.constraintPriorityTargetValue
260 | return self
261 | }
262 |
263 | @discardableResult
264 | public func update(priority: ConstraintPriority) -> Constraint {
265 | self.priority = priority.value
266 | return self
267 | }
268 |
269 | @available(*, deprecated, renamed:"update(offset:)")
270 | public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) }
271 |
272 | @available(*, deprecated, renamed:"update(inset:)")
273 | public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) }
274 |
275 | @available(*, deprecated, renamed:"update(priority:)")
276 | public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) }
277 |
278 | @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
279 | public func updatePriorityRequired() -> Void {}
280 |
281 | @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
282 | public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") }
283 |
284 | @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
285 | public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") }
286 |
287 | @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
288 | public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") }
289 |
290 | // MARK: Internal
291 |
292 | internal func updateConstantAndPriorityIfNeeded() {
293 | for layoutConstraint in self.layoutConstraints {
294 | let attribute = (layoutConstraint.secondAttribute == .notAnAttribute) ? layoutConstraint.firstAttribute : layoutConstraint.secondAttribute
295 | layoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: attribute)
296 |
297 | let requiredPriority = ConstraintPriority.required.value
298 | if (layoutConstraint.priority.rawValue < requiredPriority), (self.priority.constraintPriorityTargetValue != requiredPriority) {
299 | layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
300 | }
301 | }
302 | }
303 |
304 | internal func activateIfNeeded(updatingExisting: Bool = false) {
305 | guard let item = self.from.layoutConstraintItem else {
306 | print("WARNING: SnapKit failed to get from item from constraint. Activate will be a no-op.")
307 | return
308 | }
309 | let layoutConstraints = self.layoutConstraints
310 |
311 | if updatingExisting {
312 | var existingLayoutConstraints: [LayoutConstraint] = []
313 | for constraint in item.constraints {
314 | existingLayoutConstraints += constraint.layoutConstraints
315 | }
316 |
317 | for layoutConstraint in layoutConstraints {
318 | let existingLayoutConstraint = existingLayoutConstraints.first { $0 == layoutConstraint }
319 | guard let updateLayoutConstraint = existingLayoutConstraint else {
320 | fatalError("Updated constraint could not find existing matching constraint to update: \(layoutConstraint)")
321 | }
322 |
323 | let updateLayoutAttribute = (updateLayoutConstraint.secondAttribute == .notAnAttribute) ? updateLayoutConstraint.firstAttribute : updateLayoutConstraint.secondAttribute
324 | updateLayoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: updateLayoutAttribute)
325 | }
326 | } else {
327 | NSLayoutConstraint.activate(layoutConstraints)
328 | item.add(constraints: [self])
329 | }
330 | }
331 |
332 | internal func deactivateIfNeeded() {
333 | guard let item = self.from.layoutConstraintItem else {
334 | print("WARNING: SnapKit failed to get from item from constraint. Deactivate will be a no-op.")
335 | return
336 | }
337 | let layoutConstraints = self.layoutConstraints
338 | NSLayoutConstraint.deactivate(layoutConstraints)
339 | item.remove(constraints: [self])
340 | }
341 | }
342 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintAttributes.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 struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {
32 |
33 | typealias IntegerLiteralType = UInt
34 |
35 | internal init(rawValue: UInt) {
36 | self.rawValue = rawValue
37 | }
38 | internal init(_ rawValue: UInt) {
39 | self.init(rawValue: rawValue)
40 | }
41 | internal init(nilLiteral: ()) {
42 | self.rawValue = 0
43 | }
44 | internal init(integerLiteral rawValue: IntegerLiteralType) {
45 | self.init(rawValue: rawValue)
46 | }
47 |
48 | internal private(set) var rawValue: UInt
49 | internal static var allZeros: ConstraintAttributes { return 0 }
50 | internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 }
51 | internal var boolValue: Bool { return self.rawValue != 0 }
52 |
53 | internal func toRaw() -> UInt { return self.rawValue }
54 | internal static func fromRaw(_ raw: UInt) -> ConstraintAttributes? { return self.init(raw) }
55 | internal static func fromMask(_ raw: UInt) -> ConstraintAttributes { return self.init(raw) }
56 |
57 | // normal
58 |
59 | internal static let none: ConstraintAttributes = 0
60 | internal static let left: ConstraintAttributes = ConstraintAttributes(UInt(1) << 0)
61 | internal static let top: ConstraintAttributes = ConstraintAttributes(UInt(1) << 1)
62 | internal static let right: ConstraintAttributes = ConstraintAttributes(UInt(1) << 2)
63 | internal static let bottom: ConstraintAttributes = ConstraintAttributes(UInt(1) << 3)
64 | internal static let leading: ConstraintAttributes = ConstraintAttributes(UInt(1) << 4)
65 | internal static let trailing: ConstraintAttributes = ConstraintAttributes(UInt(1) << 5)
66 | internal static let width: ConstraintAttributes = ConstraintAttributes(UInt(1) << 6)
67 | internal static let height: ConstraintAttributes = ConstraintAttributes(UInt(1) << 7)
68 | internal static let centerX: ConstraintAttributes = ConstraintAttributes(UInt(1) << 8)
69 | internal static let centerY: ConstraintAttributes = ConstraintAttributes(UInt(1) << 9)
70 | internal static let lastBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 10)
71 |
72 | @available(iOS 8.0, OSX 10.11, *)
73 | internal static let firstBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 11)
74 |
75 | @available(iOS 8.0, *)
76 | internal static let leftMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 12)
77 |
78 | @available(iOS 8.0, *)
79 | internal static let rightMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 13)
80 |
81 | @available(iOS 8.0, *)
82 | internal static let topMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 14)
83 |
84 | @available(iOS 8.0, *)
85 | internal static let bottomMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 15)
86 |
87 | @available(iOS 8.0, *)
88 | internal static let leadingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 16)
89 |
90 | @available(iOS 8.0, *)
91 | internal static let trailingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 17)
92 |
93 | @available(iOS 8.0, *)
94 | internal static let centerXWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 18)
95 |
96 | @available(iOS 8.0, *)
97 | internal static let centerYWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 19)
98 |
99 | // aggregates
100 |
101 | internal static let edges: ConstraintAttributes = [.horizontalEdges, .verticalEdges]
102 | internal static let horizontalEdges: ConstraintAttributes = [.left, .right]
103 | internal static let verticalEdges: ConstraintAttributes = [.top, .bottom]
104 | internal static let directionalEdges: ConstraintAttributes = [.directionalHorizontalEdges, .directionalVerticalEdges]
105 | internal static let directionalHorizontalEdges: ConstraintAttributes = [.leading, .trailing]
106 | internal static let directionalVerticalEdges: ConstraintAttributes = [.top, .bottom]
107 | internal static let size: ConstraintAttributes = [.width, .height]
108 | internal static let center: ConstraintAttributes = [.centerX, .centerY]
109 |
110 | @available(iOS 8.0, *)
111 | internal static let margins: ConstraintAttributes = [.leftMargin, .topMargin, .rightMargin, .bottomMargin]
112 |
113 | @available(iOS 8.0, *)
114 | internal static let directionalMargins: ConstraintAttributes = [.leadingMargin, .topMargin, .trailingMargin, .bottomMargin]
115 |
116 | @available(iOS 8.0, *)
117 | internal static let centerWithinMargins: ConstraintAttributes = [.centerXWithinMargins, .centerYWithinMargins]
118 |
119 | internal var layoutAttributes:[LayoutAttribute] {
120 | var attrs = [LayoutAttribute]()
121 | if (self.contains(ConstraintAttributes.left)) {
122 | attrs.append(.left)
123 | }
124 | if (self.contains(ConstraintAttributes.top)) {
125 | attrs.append(.top)
126 | }
127 | if (self.contains(ConstraintAttributes.right)) {
128 | attrs.append(.right)
129 | }
130 | if (self.contains(ConstraintAttributes.bottom)) {
131 | attrs.append(.bottom)
132 | }
133 | if (self.contains(ConstraintAttributes.leading)) {
134 | attrs.append(.leading)
135 | }
136 | if (self.contains(ConstraintAttributes.trailing)) {
137 | attrs.append(.trailing)
138 | }
139 | if (self.contains(ConstraintAttributes.width)) {
140 | attrs.append(.width)
141 | }
142 | if (self.contains(ConstraintAttributes.height)) {
143 | attrs.append(.height)
144 | }
145 | if (self.contains(ConstraintAttributes.centerX)) {
146 | attrs.append(.centerX)
147 | }
148 | if (self.contains(ConstraintAttributes.centerY)) {
149 | attrs.append(.centerY)
150 | }
151 | if (self.contains(ConstraintAttributes.lastBaseline)) {
152 | attrs.append(.lastBaseline)
153 | }
154 |
155 | #if os(iOS) || os(tvOS)
156 | if (self.contains(ConstraintAttributes.firstBaseline)) {
157 | attrs.append(.firstBaseline)
158 | }
159 | if (self.contains(ConstraintAttributes.leftMargin)) {
160 | attrs.append(.leftMargin)
161 | }
162 | if (self.contains(ConstraintAttributes.rightMargin)) {
163 | attrs.append(.rightMargin)
164 | }
165 | if (self.contains(ConstraintAttributes.topMargin)) {
166 | attrs.append(.topMargin)
167 | }
168 | if (self.contains(ConstraintAttributes.bottomMargin)) {
169 | attrs.append(.bottomMargin)
170 | }
171 | if (self.contains(ConstraintAttributes.leadingMargin)) {
172 | attrs.append(.leadingMargin)
173 | }
174 | if (self.contains(ConstraintAttributes.trailingMargin)) {
175 | attrs.append(.trailingMargin)
176 | }
177 | if (self.contains(ConstraintAttributes.centerXWithinMargins)) {
178 | attrs.append(.centerXWithinMargins)
179 | }
180 | if (self.contains(ConstraintAttributes.centerYWithinMargins)) {
181 | attrs.append(.centerYWithinMargins)
182 | }
183 | #endif
184 |
185 | return attrs
186 | }
187 | }
188 |
189 | internal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes {
190 | return left.union(right)
191 | }
192 |
193 | internal func +=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
194 | left.formUnion(right)
195 | }
196 |
197 | internal func -=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
198 | left.subtract(right)
199 | }
200 |
201 | internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {
202 | return left.rawValue == right.rawValue
203 | }
204 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 | #if os(iOS) || os(tvOS)
44 | @available(iOS 11.0, tvOS 11.0, *)
45 | extension ConstraintDirectionalInsets: ConstraintConstantTarget {
46 | }
47 | #endif
48 |
49 | extension ConstraintConstantTarget {
50 |
51 | internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat {
52 | if let value = self as? CGFloat {
53 | return value
54 | }
55 |
56 | if let value = self as? Float {
57 | return CGFloat(value)
58 | }
59 |
60 | if let value = self as? Double {
61 | return CGFloat(value)
62 | }
63 |
64 | if let value = self as? Int {
65 | return CGFloat(value)
66 | }
67 |
68 | if let value = self as? UInt {
69 | return CGFloat(value)
70 | }
71 |
72 | if let value = self as? CGSize {
73 | if layoutAttribute == .width {
74 | return value.width
75 | } else if layoutAttribute == .height {
76 | return value.height
77 | } else {
78 | return 0.0
79 | }
80 | }
81 |
82 | if let value = self as? CGPoint {
83 | #if os(iOS) || os(tvOS)
84 | switch layoutAttribute {
85 | case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:
86 | return value.x
87 | case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline:
88 | return value.y
89 | case .width, .height, .notAnAttribute:
90 | return 0.0
91 | #if swift(>=5.0)
92 | @unknown default:
93 | return 0.0
94 | #endif
95 | }
96 | #else
97 | switch layoutAttribute {
98 | case .left, .right, .leading, .trailing, .centerX:
99 | return value.x
100 | case .top, .bottom, .centerY, .lastBaseline, .firstBaseline:
101 | return value.y
102 | case .width, .height, .notAnAttribute:
103 | return 0.0
104 | #if swift(>=5.0)
105 | @unknown default:
106 | return 0.0
107 | #endif
108 | }
109 | #endif
110 | }
111 |
112 | if let value = self as? ConstraintInsets {
113 | #if os(iOS) || os(tvOS)
114 | switch layoutAttribute {
115 | case .left, .leftMargin:
116 | return value.left
117 | case .top, .topMargin, .firstBaseline:
118 | return value.top
119 | case .right, .rightMargin:
120 | return -value.right
121 | case .bottom, .bottomMargin, .lastBaseline:
122 | return -value.bottom
123 | case .leading, .leadingMargin:
124 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
125 | case .trailing, .trailingMargin:
126 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
127 | case .centerX, .centerXWithinMargins:
128 | return (value.left - value.right) / 2
129 | case .centerY, .centerYWithinMargins:
130 | return (value.top - value.bottom) / 2
131 | case .width:
132 | return -(value.left + value.right)
133 | case .height:
134 | return -(value.top + value.bottom)
135 | case .notAnAttribute:
136 | return 0.0
137 | #if swift(>=5.0)
138 | @unknown default:
139 | return 0.0
140 | #endif
141 | }
142 | #else
143 | switch layoutAttribute {
144 | case .left:
145 | return value.left
146 | case .top, .firstBaseline:
147 | return value.top
148 | case .right:
149 | return -value.right
150 | case .bottom, .lastBaseline:
151 | return -value.bottom
152 | case .leading:
153 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
154 | case .trailing:
155 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
156 | case .centerX:
157 | return (value.left - value.right) / 2
158 | case .centerY:
159 | return (value.top - value.bottom) / 2
160 | case .width:
161 | return -(value.left + value.right)
162 | case .height:
163 | return -(value.top + value.bottom)
164 | case .notAnAttribute:
165 | return 0.0
166 | #if swift(>=5.0)
167 | @unknown default:
168 | return 0.0
169 | #endif
170 | }
171 | #endif
172 | }
173 |
174 | #if os(iOS) || os(tvOS)
175 | if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets {
176 | switch layoutAttribute {
177 | case .left, .leftMargin:
178 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.leading : value.trailing
179 | case .top, .topMargin, .firstBaseline:
180 | return value.top
181 | case .right, .rightMargin:
182 | return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.trailing : -value.leading
183 | case .bottom, .bottomMargin, .lastBaseline:
184 | return -value.bottom
185 | case .leading, .leadingMargin:
186 | return value.leading
187 | case .trailing, .trailingMargin:
188 | return -value.trailing
189 | case .centerX, .centerXWithinMargins:
190 | return (value.leading - value.trailing) / 2
191 | case .centerY, .centerYWithinMargins:
192 | return (value.top - value.bottom) / 2
193 | case .width:
194 | return -(value.leading + value.trailing)
195 | case .height:
196 | return -(value.top + value.bottom)
197 | case .notAnAttribute:
198 | return 0.0
199 | #if swift(>=5.0)
200 | @unknown default:
201 | return 0.0
202 | #else
203 | default:
204 | return 0.0
205 | #endif
206 | }
207 | }
208 | #endif
209 |
210 | return 0.0
211 | }
212 |
213 | }
214 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 as Any, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC)
43 | }
44 | public func label() -> String? {
45 | return objc_getAssociatedObject(self.target as Any, &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 directionalEdges: ConstraintItem {
103 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalEdges)
104 | }
105 |
106 | public var horizontalEdges: ConstraintItem {
107 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.horizontalEdges)
108 | }
109 |
110 | public var verticalEdges: ConstraintItem {
111 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.verticalEdges)
112 | }
113 |
114 | public var directionalHorizontalEdges: ConstraintItem {
115 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalHorizontalEdges)
116 | }
117 |
118 | public var directionalVerticalEdges: ConstraintItem {
119 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalVerticalEdges)
120 | }
121 |
122 | public var size: ConstraintItem {
123 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size)
124 | }
125 |
126 | public var center: ConstraintItem {
127 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center)
128 | }
129 |
130 | }
131 |
132 | public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL {
133 | }
134 | extension ConstraintAttributesDSL {
135 |
136 | // MARK: Baselines
137 | @available(*, deprecated, renamed:"lastBaseline")
138 | public var baseline: ConstraintItem {
139 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
140 | }
141 |
142 | @available(iOS 8.0, OSX 10.11, *)
143 | public var lastBaseline: ConstraintItem {
144 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
145 | }
146 |
147 | @available(iOS 8.0, OSX 10.11, *)
148 | public var firstBaseline: ConstraintItem {
149 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline)
150 | }
151 |
152 | // MARK: Margins
153 |
154 | @available(iOS 8.0, *)
155 | public var leftMargin: ConstraintItem {
156 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin)
157 | }
158 |
159 | @available(iOS 8.0, *)
160 | public var topMargin: ConstraintItem {
161 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin)
162 | }
163 |
164 | @available(iOS 8.0, *)
165 | public var rightMargin: ConstraintItem {
166 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin)
167 | }
168 |
169 | @available(iOS 8.0, *)
170 | public var bottomMargin: ConstraintItem {
171 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin)
172 | }
173 |
174 | @available(iOS 8.0, *)
175 | public var leadingMargin: ConstraintItem {
176 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin)
177 | }
178 |
179 | @available(iOS 8.0, *)
180 | public var trailingMargin: ConstraintItem {
181 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin)
182 | }
183 |
184 | @available(iOS 8.0, *)
185 | public var centerXWithinMargins: ConstraintItem {
186 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins)
187 | }
188 |
189 | @available(iOS 8.0, *)
190 | public var centerYWithinMargins: ConstraintItem {
191 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins)
192 | }
193 |
194 | @available(iOS 8.0, *)
195 | public var margins: ConstraintItem {
196 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins)
197 | }
198 |
199 | @available(iOS 8.0, *)
200 | public var directionalMargins: ConstraintItem {
201 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalMargins)
202 | }
203 |
204 | @available(iOS 8.0, *)
205 | public var centerWithinMargins: ConstraintItem {
206 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins)
207 | }
208 |
209 | }
210 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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, 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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintDirectionalInsetTarget.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 | #if os(iOS) || os(tvOS)
31 | public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {
32 | }
33 |
34 | @available(iOS 11.0, tvOS 11.0, *)
35 | extension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget {
36 | }
37 |
38 | extension ConstraintDirectionalInsetTarget {
39 |
40 | @available(iOS 11.0, tvOS 11.0, *)
41 | internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets {
42 | if let amount = self as? ConstraintDirectionalInsets {
43 | return amount
44 | } else {
45 | return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
46 | }
47 | }
48 | }
49 | #endif
50 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintDirectionalInsets.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 11.0, tvOS 11.0, *)
33 | public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets
34 | #endif
35 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 = NSEdgeInsets
35 | #endif
36 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 final class ConstraintItem {
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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 | var snp: ConstraintLayoutGuideDSL {
33 | return ConstraintLayoutGuideDSL(guide: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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, renamed:"lastBaseline")
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 horizontalEdges: ConstraintMakerExtendable {
130 | return self.makeExtendableWithAttributes(.horizontalEdges)
131 | }
132 | public var verticalEdges: ConstraintMakerExtendable {
133 | return self.makeExtendableWithAttributes(.verticalEdges)
134 | }
135 | public var directionalEdges: ConstraintMakerExtendable {
136 | return self.makeExtendableWithAttributes(.directionalEdges)
137 | }
138 | public var directionalHorizontalEdges: ConstraintMakerExtendable {
139 | return self.makeExtendableWithAttributes(.directionalHorizontalEdges)
140 | }
141 | public var directionalVerticalEdges: ConstraintMakerExtendable {
142 | return self.makeExtendableWithAttributes(.directionalVerticalEdges)
143 | }
144 | public var size: ConstraintMakerExtendable {
145 | return self.makeExtendableWithAttributes(.size)
146 | }
147 | public var center: ConstraintMakerExtendable {
148 | return self.makeExtendableWithAttributes(.center)
149 | }
150 |
151 | @available(iOS 8.0, *)
152 | public var margins: ConstraintMakerExtendable {
153 | return self.makeExtendableWithAttributes(.margins)
154 | }
155 |
156 | @available(iOS 8.0, *)
157 | public var directionalMargins: ConstraintMakerExtendable {
158 | return self.makeExtendableWithAttributes(.directionalMargins)
159 | }
160 |
161 | @available(iOS 8.0, *)
162 | public var centerWithinMargins: ConstraintMakerExtendable {
163 | return self.makeExtendableWithAttributes(.centerWithinMargins)
164 | }
165 |
166 | public let item: LayoutConstraintItem
167 | private var descriptions = [ConstraintDescription]()
168 |
169 | internal init(item: LayoutConstraintItem) {
170 | self.item = item
171 | self.item.prepare()
172 | }
173 |
174 | internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable {
175 | let description = ConstraintDescription(item: self.item, attributes: attributes)
176 | self.descriptions.append(description)
177 | return ConstraintMakerExtendable(description)
178 | }
179 |
180 | internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
181 | let maker = ConstraintMaker(item: item)
182 | closure(maker)
183 | var constraints: [Constraint] = []
184 | for description in maker.descriptions {
185 | guard let constraint = description.constraint else {
186 | continue
187 | }
188 | constraints.append(constraint)
189 | }
190 | return constraints
191 | }
192 |
193 | internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
194 | let constraints = prepareConstraints(item: item, closure: closure)
195 | for constraint in constraints {
196 | constraint.activateIfNeeded(updatingExisting: false)
197 | }
198 | }
199 |
200 | internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
201 | self.removeConstraints(item: item)
202 | self.makeConstraints(item: item, closure: closure)
203 | }
204 |
205 | internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
206 | guard item.constraints.count > 0 else {
207 | self.makeConstraints(item: item, closure: closure)
208 | return
209 | }
210 |
211 | let constraints = prepareConstraints(item: item, closure: closure)
212 | for constraint in constraints {
213 | constraint.activateIfNeeded(updatingExisting: true)
214 | }
215 | }
216 |
217 | internal static func removeConstraints(item: LayoutConstraintItem) {
218 | let constraints = item.constraints
219 | for constraint in constraints {
220 | constraint.deactivateIfNeeded()
221 | }
222 | }
223 |
224 | }
225 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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: ConstraintMakerPrioritizable {
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 | #if os(iOS) || os(tvOS)
57 | @discardableResult
58 | @available(iOS 11.0, tvOS 11.0, *)
59 | public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {
60 | self.description.constant = amount.constraintDirectionalInsetTargetValue
61 | return self
62 | }
63 | #endif
64 | }
65 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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, renamed:"lastBaseline")
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 topMargin: ConstraintMakerExtendable {
114 | self.description.attributes += .topMargin
115 | return self
116 | }
117 |
118 | @available(iOS 8.0, *)
119 | public var bottomMargin: ConstraintMakerExtendable {
120 | self.description.attributes += .bottomMargin
121 | return self
122 | }
123 |
124 | @available(iOS 8.0, *)
125 | public var leadingMargin: ConstraintMakerExtendable {
126 | self.description.attributes += .leadingMargin
127 | return self
128 | }
129 |
130 | @available(iOS 8.0, *)
131 | public var trailingMargin: ConstraintMakerExtendable {
132 | self.description.attributes += .trailingMargin
133 | return self
134 | }
135 |
136 | @available(iOS 8.0, *)
137 | public var centerXWithinMargins: ConstraintMakerExtendable {
138 | self.description.attributes += .centerXWithinMargins
139 | return self
140 | }
141 |
142 | @available(iOS 8.0, *)
143 | public var centerYWithinMargins: ConstraintMakerExtendable {
144 | self.description.attributes += .centerYWithinMargins
145 | return self
146 | }
147 |
148 | public var edges: ConstraintMakerExtendable {
149 | self.description.attributes += .edges
150 | return self
151 | }
152 | public var horizontalEdges: ConstraintMakerExtendable {
153 | self.description.attributes += .horizontalEdges
154 | return self
155 | }
156 | public var verticalEdges: ConstraintMakerExtendable {
157 | self.description.attributes += .verticalEdges
158 | return self
159 | }
160 | public var directionalEdges: ConstraintMakerExtendable {
161 | self.description.attributes += .directionalEdges
162 | return self
163 | }
164 | public var directionalHorizontalEdges: ConstraintMakerExtendable {
165 | self.description.attributes += .directionalHorizontalEdges
166 | return self
167 | }
168 | public var directionalVerticalEdges: ConstraintMakerExtendable {
169 | self.description.attributes += .directionalVerticalEdges
170 | return self
171 | }
172 | public var size: ConstraintMakerExtendable {
173 | self.description.attributes += .size
174 | return self
175 | }
176 |
177 | @available(iOS 8.0, *)
178 | public var margins: ConstraintMakerExtendable {
179 | self.description.attributes += .margins
180 | return self
181 | }
182 |
183 | @available(iOS 8.0, *)
184 | public var directionalMargins: ConstraintMakerExtendable {
185 | self.description.attributes += .directionalMargins
186 | return self
187 | }
188 |
189 | @available(iOS 8.0, *)
190 | public var centerWithinMargins: ConstraintMakerExtendable {
191 | self.description.attributes += .centerWithinMargins
192 | return self
193 | }
194 |
195 | }
196 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintMakerPrioritizable.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 | @available(*, deprecated, message:"Use ConstraintMakerPrioritizable instead.")
31 | public typealias ConstraintMakerPriortizable = ConstraintMakerPrioritizable
32 |
33 | public class ConstraintMakerPrioritizable: ConstraintMakerFinalizable {
34 |
35 | @discardableResult
36 | public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {
37 | self.description.priority = amount.value
38 | return self
39 | }
40 |
41 | @discardableResult
42 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
43 | self.description.priority = amount
44 | return self
45 | }
46 |
47 | @available(*, deprecated, message:"Use priority(.required) instead.")
48 | @discardableResult
49 | public func priorityRequired() -> ConstraintMakerFinalizable {
50 | return self.priority(.required)
51 | }
52 |
53 | @available(*, deprecated, message:"Use priority(.high) instead.")
54 | @discardableResult
55 | public func priorityHigh() -> ConstraintMakerFinalizable {
56 | return self.priority(.high)
57 | }
58 |
59 | @available(*, deprecated, message:"Use priority(.medium) instead.")
60 | @discardableResult
61 | public func priorityMedium() -> ConstraintMakerFinalizable {
62 | return self.priority(.medium)
63 | }
64 |
65 | @available(*, deprecated, message:"Use priority(.low) instead.")
66 | @discardableResult
67 | public func priorityLow() -> ConstraintMakerFinalizable {
68 | return self.priority(.low)
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintMakerRelatable+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 | extension ConstraintMakerRelatable {
32 |
33 | @discardableResult
34 | public func equalToSuperview(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
35 | guard let other = self.description.item.superview else {
36 | fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
37 | }
38 | return self.relatedTo(closure(other), relation: .equal, file: file, line: line)
39 | }
40 |
41 | @discardableResult
42 | public func lessThanOrEqualToSuperview(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
43 | guard let other = self.description.item.superview else {
44 | fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
45 | }
46 | return self.relatedTo(closure(other), relation: .lessThanOrEqual, file: file, line: line)
47 | }
48 |
49 | @discardableResult
50 | public func greaterThanOrEqualTo(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
51 | guard let other = self.description.item.superview else {
52 | fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
53 | }
54 | return self.relatedTo(closure(other), relation: .greaterThanOrEqual, file: file, line: line)
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 ||
49 | other.attributes == .directionalEdges && self.description.attributes == .directionalMargins ||
50 | other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else {
51 | fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
52 | }
53 |
54 | related = other
55 | constant = 0.0
56 | } else if let other = other as? ConstraintView {
57 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
58 | constant = 0.0
59 | } else if let other = other as? ConstraintConstantTarget {
60 | related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
61 | constant = other
62 | } else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {
63 | related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
64 | constant = 0.0
65 | } else {
66 | fatalError("Invalid constraint. (\(file), \(line))")
67 | }
68 |
69 | let editable = ConstraintMakerEditable(self.description)
70 | editable.description.sourceLocation = (file, line)
71 | editable.description.relation = relation
72 | editable.description.related = related
73 | editable.description.constant = constant
74 | return editable
75 | }
76 |
77 | @discardableResult
78 | public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
79 | return self.relatedTo(other, relation: .equal, file: file, line: line)
80 | }
81 |
82 | @discardableResult
83 | public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
84 | guard let other = self.description.item.superview else {
85 | fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
86 | }
87 | return self.relatedTo(other, relation: .equal, file: file, line: line)
88 | }
89 |
90 | @discardableResult
91 | public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
92 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
93 | }
94 |
95 | @discardableResult
96 | public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
97 | guard let other = self.description.item.superview else {
98 | fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
99 | }
100 | return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
101 | }
102 |
103 | @discardableResult
104 | public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
105 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
106 | }
107 |
108 | @discardableResult
109 | public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
110 | guard let other = self.description.item.superview else {
111 | fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
112 | }
113 | return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/ConstraintPriority.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 struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable {
31 | public typealias FloatLiteralType = Float
32 |
33 | public let value: Float
34 |
35 | public init(floatLiteral value: Float) {
36 | self.value = value
37 | }
38 |
39 | public init(_ value: Float) {
40 | self.value = value
41 | }
42 |
43 | public static var required: ConstraintPriority {
44 | return 1000.0
45 | }
46 |
47 | public static var high: ConstraintPriority {
48 | return 750.0
49 | }
50 |
51 | public static var medium: ConstraintPriority {
52 | #if os(OSX)
53 | return 501.0
54 | #else
55 | return 500.0
56 | #endif
57 |
58 | }
59 |
60 | public static var low: ConstraintPriority {
61 | return 250.0
62 | }
63 |
64 | public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {
65 | return lhs.value == rhs.value
66 | }
67 |
68 | // MARK: Strideable
69 |
70 | public func advanced(by n: FloatLiteralType) -> ConstraintPriority {
71 | return ConstraintPriority(floatLiteral: value + n)
72 | }
73 |
74 | public func distance(to other: ConstraintPriority) -> FloatLiteralType {
75 | return other.value - value
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
77 | #if os(iOS) || os(tvOS)
78 | extension UILayoutPriority: ConstraintPriorityTarget {
79 |
80 | public var constraintPriorityTargetValue: Float {
81 | return self.rawValue
82 | }
83 |
84 | }
85 | #endif
86 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 | #if os(iOS) || os(tvOS)
59 | @available(iOS 11.0, tvOS 11.0, *)
60 | extension ConstraintDirectionalInsets: ConstraintRelatableTarget {
61 | }
62 | #endif
63 |
64 | extension ConstraintItem: ConstraintRelatableTarget {
65 | }
66 |
67 | extension ConstraintView: ConstraintRelatableTarget {
68 | }
69 |
70 | @available(iOS 9.0, OSX 10.11, *)
71 | extension ConstraintLayoutGuide: ConstraintRelatableTarget {
72 | }
73 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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: LayoutRelation {
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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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, renamed:"snp.left")
34 | var snp_left: ConstraintItem { return self.snp.left }
35 |
36 | @available(*, deprecated, renamed:"snp.top")
37 | var snp_top: ConstraintItem { return self.snp.top }
38 |
39 | @available(*, deprecated, renamed:"snp.right")
40 | var snp_right: ConstraintItem { return self.snp.right }
41 |
42 | @available(*, deprecated, renamed:"snp.bottom")
43 | var snp_bottom: ConstraintItem { return self.snp.bottom }
44 |
45 | @available(*, deprecated, renamed:"snp.leading")
46 | var snp_leading: ConstraintItem { return self.snp.leading }
47 |
48 | @available(*, deprecated, renamed:"snp.trailing")
49 | var snp_trailing: ConstraintItem { return self.snp.trailing }
50 |
51 | @available(*, deprecated, renamed:"snp.width")
52 | var snp_width: ConstraintItem { return self.snp.width }
53 |
54 | @available(*, deprecated, renamed:"snp.height")
55 | var snp_height: ConstraintItem { return self.snp.height }
56 |
57 | @available(*, deprecated, renamed:"snp.centerX")
58 | var snp_centerX: ConstraintItem { return self.snp.centerX }
59 |
60 | @available(*, deprecated, renamed:"snp.centerY")
61 | var snp_centerY: ConstraintItem { return self.snp.centerY }
62 |
63 | @available(*, deprecated, renamed:"snp.baseline")
64 | var snp_baseline: ConstraintItem { return self.snp.baseline }
65 |
66 | @available(*, deprecated, renamed:"snp.lastBaseline")
67 | @available(iOS 8.0, OSX 10.11, *)
68 | var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
69 |
70 | @available(iOS, deprecated, renamed:"snp.firstBaseline")
71 | @available(iOS 8.0, OSX 10.11, *)
72 | var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
73 |
74 | @available(iOS, deprecated, renamed:"snp.leftMargin")
75 | @available(iOS 8.0, *)
76 | var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
77 |
78 | @available(iOS, deprecated, renamed:"snp.topMargin")
79 | @available(iOS 8.0, *)
80 | var snp_topMargin: ConstraintItem { return self.snp.topMargin }
81 |
82 | @available(iOS, deprecated, renamed:"snp.rightMargin")
83 | @available(iOS 8.0, *)
84 | var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
85 |
86 | @available(iOS, deprecated, renamed:"snp.bottomMargin")
87 | @available(iOS 8.0, *)
88 | var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
89 |
90 | @available(iOS, deprecated, renamed:"snp.leadingMargin")
91 | @available(iOS 8.0, *)
92 | var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
93 |
94 | @available(iOS, deprecated, renamed:"snp.trailingMargin")
95 | @available(iOS 8.0, *)
96 | var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
97 |
98 | @available(iOS, deprecated, renamed:"snp.centerXWithinMargins")
99 | @available(iOS 8.0, *)
100 | var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
101 |
102 | @available(iOS, deprecated, renamed:"snp.centerYWithinMargins")
103 | @available(iOS 8.0, *)
104 | var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
105 |
106 | @available(*, deprecated, renamed:"snp.edges")
107 | var snp_edges: ConstraintItem { return self.snp.edges }
108 |
109 | @available(*, deprecated, renamed:"snp.size")
110 | var snp_size: ConstraintItem { return self.snp.size }
111 |
112 | @available(*, deprecated, renamed:"snp.center")
113 | var snp_center: ConstraintItem { return self.snp.center }
114 |
115 | @available(iOS, deprecated, renamed:"snp.margins")
116 | @available(iOS 8.0, *)
117 | var snp_margins: ConstraintItem { return self.snp.margins }
118 |
119 | @available(iOS, deprecated, renamed:"snp.centerWithinMargins")
120 | @available(iOS 8.0, *)
121 | var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
122 |
123 | @available(*, deprecated, renamed:"snp.prepareConstraints(_:)")
124 | func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
125 | return self.snp.prepareConstraints(closure)
126 | }
127 |
128 | @available(*, deprecated, renamed:"snp.makeConstraints(_:)")
129 | func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
130 | self.snp.makeConstraints(closure)
131 | }
132 |
133 | @available(*, deprecated, renamed:"snp.remakeConstraints(_:)")
134 | func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
135 | self.snp.remakeConstraints(closure)
136 | }
137 |
138 | @available(*, deprecated, renamed:"snp.updateConstraints(_:)")
139 | func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
140 | self.snp.updateConstraints(closure)
141 | }
142 |
143 | @available(*, deprecated, renamed:"snp.removeConstraints()")
144 | func snp_removeConstraints() {
145 | self.snp.removeConstraints()
146 | }
147 |
148 | var snp: ConstraintViewDSL {
149 | return ConstraintViewDSL(view: self)
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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).rawValue
57 | }
58 | nonmutating set {
59 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal)
60 | }
61 | }
62 |
63 | public var contentHuggingVerticalPriority: Float {
64 | get {
65 | return self.view.contentHuggingPriority(for: .vertical).rawValue
66 | }
67 | nonmutating set {
68 | self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical)
69 | }
70 | }
71 |
72 | public var contentCompressionResistanceHorizontalPriority: Float {
73 | get {
74 | return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue
75 | }
76 | nonmutating set {
77 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal)
78 | }
79 | }
80 |
81 | public var contentCompressionResistanceVerticalPriority: Float {
82 | get {
83 | return self.view.contentCompressionResistancePriority(for: .vertical).rawValue
84 | }
85 | nonmutating set {
86 | self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: 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 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 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.rawValue != 1000.0 {
70 | description += " ^\(self.priority)"
71 | }
72 |
73 | description += ">"
74 |
75 | return description
76 | }
77 |
78 | }
79 |
80 | private func descriptionForRelation(_ relation: LayoutRelation) -> String {
81 | switch relation {
82 | case .equal: return "=="
83 | case .greaterThanOrEqual: return ">="
84 | case .lessThanOrEqual: return "<="
85 | #if swift(>=5.0)
86 | @unknown default: return "unknown"
87 | #endif
88 | }
89 | }
90 |
91 | private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
92 | #if os(iOS) || os(tvOS)
93 | switch attribute {
94 | case .notAnAttribute: return "notAnAttribute"
95 | case .top: return "top"
96 | case .left: return "left"
97 | case .bottom: return "bottom"
98 | case .right: return "right"
99 | case .leading: return "leading"
100 | case .trailing: return "trailing"
101 | case .width: return "width"
102 | case .height: return "height"
103 | case .centerX: return "centerX"
104 | case .centerY: return "centerY"
105 | case .lastBaseline: return "lastBaseline"
106 | case .firstBaseline: return "firstBaseline"
107 | case .topMargin: return "topMargin"
108 | case .leftMargin: return "leftMargin"
109 | case .bottomMargin: return "bottomMargin"
110 | case .rightMargin: return "rightMargin"
111 | case .leadingMargin: return "leadingMargin"
112 | case .trailingMargin: return "trailingMargin"
113 | case .centerXWithinMargins: return "centerXWithinMargins"
114 | case .centerYWithinMargins: return "centerYWithinMargins"
115 | #if swift(>=5.0)
116 | @unknown default: return "unknown"
117 | #endif
118 | }
119 | #else
120 | switch attribute {
121 | case .notAnAttribute: return "notAnAttribute"
122 | case .top: return "top"
123 | case .left: return "left"
124 | case .bottom: return "bottom"
125 | case .right: return "right"
126 | case .leading: return "leading"
127 | case .trailing: return "trailing"
128 | case .width: return "width"
129 | case .height: return "height"
130 | case .centerX: return "centerX"
131 | case .centerY: return "centerY"
132 | case .lastBaseline: return "lastBaseline"
133 | case .firstBaseline: return "firstBaseline"
134 | #if swift(>=5.0)
135 | @unknown default: return "unknown"
136 | #endif
137 | }
138 | #endif
139 | }
140 |
141 | private func conditionalOptional(from object: Optional) -> Optional {
142 | return object
143 | }
144 |
145 | private func conditionalOptional(from object: T) -> Optional {
146 | return Optional.some(object)
147 | }
148 |
149 | private func descriptionForObject(_ object: AnyObject) -> String {
150 | let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object)))
151 | var desc = ""
152 |
153 | desc += type(of: object).description()
154 |
155 | if let object = object as? ConstraintView {
156 | desc += ":\(object.snp.label() ?? pointerDescription)"
157 | } else if let object = object as? LayoutConstraint {
158 | desc += ":\(object.label ?? pointerDescription)"
159 | } else {
160 | desc += ":\(pointerDescription)"
161 | }
162 |
163 | if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {
164 | desc += "@\((file as NSString).lastPathComponent)#\(line)"
165 | }
166 |
167 | desc += ""
168 | return desc
169 | }
170 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 | // If firstItem or secondItem on either constraint has a dangling pointer
48 | // this comparison can cause a crash. The solution for this is to ensure
49 | // your layout code hold strong references to things like Views, LayoutGuides
50 | // and LayoutAnchors as SnapKit will not keep strong references to any of these.
51 | guard lhs.firstAttribute == rhs.firstAttribute &&
52 | lhs.secondAttribute == rhs.secondAttribute &&
53 | lhs.relation == rhs.relation &&
54 | lhs.priority == rhs.priority &&
55 | lhs.multiplier == rhs.multiplier &&
56 | lhs.secondItem === rhs.secondItem &&
57 | lhs.firstItem === rhs.firstItem else {
58 | return false
59 | }
60 | return true
61 | }
62 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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: AnyObject {
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.constraintsSet.allObjects as! [Constraint]
63 | }
64 |
65 | internal func add(constraints: [Constraint]) {
66 | let constraintsSet = self.constraintsSet
67 | for constraint in constraints {
68 | constraintsSet.add(constraint)
69 | }
70 | }
71 |
72 | internal func remove(constraints: [Constraint]) {
73 | let constraintsSet = self.constraintsSet
74 | for constraint in constraints {
75 | constraintsSet.remove(constraint)
76 | }
77 | }
78 |
79 | private var constraintsSet: NSMutableSet {
80 | let constraintsSet: NSMutableSet
81 |
82 | if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet {
83 | constraintsSet = existing
84 | } else {
85 | constraintsSet = NSMutableSet()
86 | objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
87 | }
88 | return constraintsSet
89 |
90 | }
91 |
92 | }
93 | private var constraintsKey: UInt8 = 0
94 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/Typealiases.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 | import Foundation
25 |
26 | #if os(iOS) || os(tvOS)
27 | import UIKit
28 | #if swift(>=4.2)
29 | typealias LayoutRelation = NSLayoutConstraint.Relation
30 | typealias LayoutAttribute = NSLayoutConstraint.Attribute
31 | #else
32 | typealias LayoutRelation = NSLayoutRelation
33 | typealias LayoutAttribute = NSLayoutAttribute
34 | #endif
35 | typealias LayoutPriority = UILayoutPriority
36 | #else
37 | import AppKit
38 | typealias LayoutRelation = NSLayoutConstraint.Relation
39 | typealias LayoutAttribute = NSLayoutConstraint.Attribute
40 | typealias LayoutPriority = NSLayoutConstraint.Priority
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/Example/Pods/SnapKit/Sources/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 | var snp: ConstraintLayoutSupportDSL {
33 | return ConstraintLayoutSupportDSL(support: self)
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | ${PODS_DEVELOPMENT_LANGUAGE}
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 2.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_FSEmptyDataSet : NSObject
3 | @end
4 | @implementation PodsDummy_FSEmptyDataSet
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double FSEmptyDataSetVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char FSEmptyDataSetVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet.debug.xcconfig:
--------------------------------------------------------------------------------
1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
7 | PODS_BUILD_DIR = ${BUILD_DIR}
8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
10 | PODS_ROOT = ${SRCROOT}
11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
14 | SKIP_INSTALL = YES
15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
16 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet.modulemap:
--------------------------------------------------------------------------------
1 | framework module FSEmptyDataSet {
2 | umbrella header "FSEmptyDataSet-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/FSEmptyDataSet/FSEmptyDataSet.release.xcconfig:
--------------------------------------------------------------------------------
1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
7 | PODS_BUILD_DIR = ${BUILD_DIR}
8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
9 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
10 | PODS_ROOT = ${SRCROOT}
11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../..
12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
13 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
14 | SKIP_INSTALL = YES
15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
16 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | ${PODS_DEVELOPMENT_LANGUAGE}
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## FSEmptyDataSet
5 |
6 | Copyright (c) 2023 Sheng (https://github.com/lifution)
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | ## SnapKit
28 |
29 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
30 |
31 | Permission is hereby granted, free of charge, to any person obtaining a copy
32 | of this software and associated documentation files (the "Software"), to deal
33 | in the Software without restriction, including without limitation the rights
34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35 | copies of the Software, and to permit persons to whom the Software is
36 | furnished to do so, subject to the following conditions:
37 |
38 | The above copyright notice and this permission notice shall be included in
39 | all copies or substantial portions of the Software.
40 |
41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47 | THE SOFTWARE.
48 |
49 | Generated by CocoaPods - https://cocoapods.org
50 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2023 Sheng (https://github.com/lifution)
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in
27 | all copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 | License
38 | MIT
39 | Title
40 | FSEmptyDataSet
41 | Type
42 | PSGroupSpecifier
43 |
44 |
45 | FooterText
46 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
47 |
48 | Permission is hereby granted, free of charge, to any person obtaining a copy
49 | of this software and associated documentation files (the "Software"), to deal
50 | in the Software without restriction, including without limitation the rights
51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52 | copies of the Software, and to permit persons to whom the Software is
53 | furnished to do so, subject to the following conditions:
54 |
55 | The above copyright notice and this permission notice shall be included in
56 | all copies or substantial portions of the Software.
57 |
58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
64 | THE SOFTWARE.
65 |
66 | License
67 | MIT
68 | Title
69 | SnapKit
70 | Type
71 | PSGroupSpecifier
72 |
73 |
74 | FooterText
75 | Generated by CocoaPods - https://cocoapods.org
76 | Title
77 |
78 | Type
79 | PSGroupSpecifier
80 |
81 |
82 | StringsTable
83 | Acknowledgements
84 | Title
85 | Acknowledgements
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_FSEmptyDataSet_Example : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_FSEmptyDataSet_Example
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 | set -u
4 | set -o pipefail
5 |
6 | function on_error {
7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
8 | }
9 | trap 'on_error $LINENO' ERR
10 |
11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
13 | # frameworks to, so exit 0 (signalling the script phase was successful).
14 | exit 0
15 | fi
16 |
17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
19 |
20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
21 | SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
22 | BCSYMBOLMAP_DIR="BCSymbolMaps"
23 |
24 |
25 | # This protects against multiple targets copying the same framework dependency at the same time. The solution
26 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
27 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
28 |
29 | # Copies and strips a vendored framework
30 | install_framework()
31 | {
32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
33 | local source="${BUILT_PRODUCTS_DIR}/$1"
34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
36 | elif [ -r "$1" ]; then
37 | local source="$1"
38 | fi
39 |
40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
41 |
42 | if [ -L "${source}" ]; then
43 | echo "Symlinked..."
44 | source="$(readlink -f "${source}")"
45 | fi
46 |
47 | if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
48 | # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied
49 | find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do
50 | echo "Installing $f"
51 | install_bcsymbolmap "$f" "$destination"
52 | rm "$f"
53 | done
54 | rmdir "${source}/${BCSYMBOLMAP_DIR}"
55 | fi
56 |
57 | # Use filter instead of exclude so missing patterns don't throw errors.
58 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
59 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
60 |
61 | local basename
62 | basename="$(basename -s .framework "$1")"
63 | binary="${destination}/${basename}.framework/${basename}"
64 |
65 | if ! [ -r "$binary" ]; then
66 | binary="${destination}/${basename}"
67 | elif [ -L "${binary}" ]; then
68 | echo "Destination binary is symlinked..."
69 | dirname="$(dirname "${binary}")"
70 | binary="${dirname}/$(readlink "${binary}")"
71 | fi
72 |
73 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
74 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
75 | strip_invalid_archs "$binary"
76 | fi
77 |
78 | # Resign the code if required by the build settings to avoid unstable apps
79 | code_sign_if_enabled "${destination}/$(basename "$1")"
80 |
81 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
82 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
83 | local swift_runtime_libs
84 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
85 | for lib in $swift_runtime_libs; do
86 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
87 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
88 | code_sign_if_enabled "${destination}/${lib}"
89 | done
90 | fi
91 | }
92 | # Copies and strips a vendored dSYM
93 | install_dsym() {
94 | local source="$1"
95 | warn_missing_arch=${2:-true}
96 | if [ -r "$source" ]; then
97 | # Copy the dSYM into the targets temp dir.
98 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
99 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
100 |
101 | local basename
102 | basename="$(basename -s .dSYM "$source")"
103 | binary_name="$(ls "$source/Contents/Resources/DWARF")"
104 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
105 |
106 | # Strip invalid architectures from the dSYM.
107 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
108 | strip_invalid_archs "$binary" "$warn_missing_arch"
109 | fi
110 | if [[ $STRIP_BINARY_RETVAL == 0 ]]; then
111 | # Move the stripped file into its final destination.
112 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
113 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
114 | else
115 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
116 | mkdir -p "${DWARF_DSYM_FOLDER_PATH}"
117 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
118 | fi
119 | fi
120 | }
121 |
122 | # Used as a return value for each invocation of `strip_invalid_archs` function.
123 | STRIP_BINARY_RETVAL=0
124 |
125 | # Strip invalid architectures
126 | strip_invalid_archs() {
127 | binary="$1"
128 | warn_missing_arch=${2:-true}
129 | # Get architectures for current target binary
130 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
131 | # Intersect them with the architectures we are building for
132 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
133 | # If there are no archs supported by this binary then warn the user
134 | if [[ -z "$intersected_archs" ]]; then
135 | if [[ "$warn_missing_arch" == "true" ]]; then
136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
137 | fi
138 | STRIP_BINARY_RETVAL=1
139 | return
140 | fi
141 | stripped=""
142 | for arch in $binary_archs; do
143 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then
144 | # Strip non-valid architectures in-place
145 | lipo -remove "$arch" -output "$binary" "$binary"
146 | stripped="$stripped $arch"
147 | fi
148 | done
149 | if [[ "$stripped" ]]; then
150 | echo "Stripped $binary of architectures:$stripped"
151 | fi
152 | STRIP_BINARY_RETVAL=0
153 | }
154 |
155 | # Copies the bcsymbolmap files of a vendored framework
156 | install_bcsymbolmap() {
157 | local bcsymbolmap_path="$1"
158 | local destination="${BUILT_PRODUCTS_DIR}"
159 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
160 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
161 | }
162 |
163 | # Signs a framework with the provided identity
164 | code_sign_if_enabled() {
165 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
166 | # Use the current code_sign_identity
167 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
168 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
169 |
170 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
171 | code_sign_cmd="$code_sign_cmd &"
172 | fi
173 | echo "$code_sign_cmd"
174 | eval "$code_sign_cmd"
175 | fi
176 | }
177 |
178 | if [[ "$CONFIGURATION" == "Debug" ]]; then
179 | install_framework "${BUILT_PRODUCTS_DIR}/FSEmptyDataSet/FSEmptyDataSet.framework"
180 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
181 | fi
182 | if [[ "$CONFIGURATION" == "Release" ]]; then
183 | install_framework "${BUILT_PRODUCTS_DIR}/FSEmptyDataSet/FSEmptyDataSet.framework"
184 | install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
185 | fi
186 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
187 | wait
188 | fi
189 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_FSEmptyDataSet_ExampleVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_FSEmptyDataSet_ExampleVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example.debug.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet/FSEmptyDataSet.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
8 | OTHER_LDFLAGS = $(inherited) -framework "FSEmptyDataSet" -framework "Foundation" -framework "SnapKit" -framework "UIKit"
9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
10 | PODS_BUILD_DIR = ${BUILD_DIR}
11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
13 | PODS_ROOT = ${SRCROOT}/Pods
14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
16 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_FSEmptyDataSet_Example {
2 | umbrella header "Pods-FSEmptyDataSet_Example-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/Pods-FSEmptyDataSet_Example/Pods-FSEmptyDataSet_Example.release.xcconfig:
--------------------------------------------------------------------------------
1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"
4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FSEmptyDataSet/FSEmptyDataSet.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers"
6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
7 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
8 | OTHER_LDFLAGS = $(inherited) -framework "FSEmptyDataSet" -framework "Foundation" -framework "SnapKit" -framework "UIKit"
9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
10 | PODS_BUILD_DIR = ${BUILD_DIR}
11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
13 | PODS_ROOT = ${SRCROOT}/Pods
14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
16 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | ${PODS_DEVELOPMENT_LANGUAGE}
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 5.6.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SnapKit : NSObject
3 | @end
4 | @implementation PodsDummy_SnapKit
5 | @end
6 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double SnapKitVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.debug.xcconfig:
--------------------------------------------------------------------------------
1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
6 | PODS_BUILD_DIR = ${BUILD_DIR}
7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
9 | PODS_ROOT = ${SRCROOT}
10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
13 | SKIP_INSTALL = YES
14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
15 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.modulemap:
--------------------------------------------------------------------------------
1 | framework module SnapKit {
2 | umbrella header "SnapKit-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Example/Pods/Target Support Files/SnapKit/SnapKit.release.xcconfig:
--------------------------------------------------------------------------------
1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 | LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
6 | PODS_BUILD_DIR = ${BUILD_DIR}
7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
9 | PODS_ROOT = ${SRCROOT}
10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
13 | SKIP_INSTALL = YES
14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
15 |
--------------------------------------------------------------------------------
/FSEmptyDataSet.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'FSEmptyDataSet'
3 | s.version = '2.0.0'
4 | s.summary = 'An easy-to-use empty placeholder library for iOS written in Swift.'
5 | s.homepage = 'https://github.com/lifution/FSEmptyDataSet'
6 | s.license = { :type => 'MIT', :file => 'LICENSE' }
7 | s.author = 'Sheng'
8 | s.source = {
9 | :git => 'https://github.com/lifution/FSEmptyDataSet.git',
10 | :tag => s.version.to_s
11 | }
12 |
13 | s.requires_arc = true
14 | s.swift_version = '5'
15 | s.ios.deployment_target = '11.0'
16 |
17 | s.frameworks = 'UIKit', 'Foundation'
18 | s.source_files = 'Sources/Classes/**/*'
19 |
20 | # s.resource_bundles = {
21 | # 'FSUIKit' => ['Sources/Assets/*.png']
22 | # }
23 | end
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2023 Sheng (https://github.com/lifution)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > This repository has been deprecated, use [FSUIKit/FSEmptyView](https://github.com/lifution/FSUIKit/tree/main/Sources/Classes/FSEmptyView) instead.
2 |
--------------------------------------------------------------------------------
/Sources/Classes/FSEmptyContent.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FSEmptyContent.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 2023/12/25.
6 | // Copyright © 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | /// FSEmptyDataSet 提供的默认空白占位内容类型。
12 | public enum FSEmptyContentType {
13 | /// 不显示 empty
14 | case none
15 | /// 自定义
16 | case custom
17 | /// 重新加载
18 | case reload(title: String? = "Reload", tintColor: UIColor? = .gray)
19 | /// 无内容
20 | case noContent(title: String? = "No Content", titleColor: UIColor? = .black, detail: String? = nil, detailColor: UIColor? = .gray)
21 | /// 加载中...
22 | case loading(title: String? = "Loading...", tintColor: UIColor? = .gray)
23 | }
24 |
25 | /// 这是 FSEmptyDataSet 提供的默认 FSEmptyView 的内容容器,外部无法修改该类的内容,
26 | /// 外部如有需要自定义 empty 内容,请自己实现 FSEmptyViewDelegate & FSEmptyViewDataSource。
27 | public final class FSEmptyContent: FSEmptyViewDelegate, FSEmptyViewDataSource {
28 |
29 | public let type: FSEmptyContentType
30 |
31 | public var onDidPressButton: ((_ button: UIButton) -> Void)? {
32 | get {
33 | return contentProxy.onDidPressButton
34 | }
35 | set {
36 | contentProxy.onDidPressButton = newValue
37 | }
38 | }
39 |
40 | private var contentProxy: FSEmptyContentProxy!
41 |
42 | // MARK: Initialization
43 |
44 | public init(content: FSEmptyContentProxy) {
45 | self.type = .custom
46 | contentProxy = content
47 | }
48 |
49 | public init(type: FSEmptyContentType) {
50 | self.type = type
51 | switch type {
52 | case .none:
53 | contentProxy = FSEmptyContentNone()
54 | case .custom:
55 | #if DEBUG
56 | fatalError("Use `init(content:)` initializer if you want to cutom content.")
57 | #else
58 | contentProxy = FSEmptyContentTemplate()
59 | #endif
60 | case let .reload(title, tintColor):
61 | contentProxy = FSEmptyContentReload(title: title, tintColor: tintColor)
62 | case let .noContent(title, titleColor, detail, detailColor):
63 | contentProxy = FSEmptyContentNoContent(title: title, titleColor: titleColor, detail: detail, detailColor: detailColor)
64 | case let .loading(title, tintColor):
65 | contentProxy = FSEmptyContentLoading(title: title, tintColor: tintColor)
66 | }
67 | }
68 |
69 | // MARK:
70 |
71 | public func contentOffset(for emptyView: FSEmptyView) -> CGPoint {
72 | return contentProxy.contentOffset
73 | }
74 |
75 | public func imageBottomSpace(for emptyView: FSEmptyView) -> CGFloat {
76 | return contentProxy.imageBottomSpace
77 | }
78 |
79 | public func textBottomSpace(for emptyView: FSEmptyView) -> CGFloat {
80 | return contentProxy.textBottomSpace
81 | }
82 |
83 | public func detailTextBottomSpace(for emptyView: FSEmptyView) -> CGFloat {
84 | return contentProxy.detailTextBottomSpace
85 | }
86 |
87 | public func emptyViewShouldAllowScroll(_ emptyView: FSEmptyView) -> Bool {
88 | return contentProxy.isScrollEnabled
89 | }
90 |
91 | public func backgroundColor(for emptyView: FSEmptyView) -> UIColor? {
92 | if let color = contentProxy.backgroundColor {
93 | return color
94 | }
95 | return .clear
96 | }
97 |
98 | public func emptyView(_ emptyView: FSEmptyView, didPress button: UIButton) {
99 | contentProxy.onDidPressButton?(button)
100 | }
101 |
102 | // MARK:
103 |
104 | public func image(for emptyView: FSEmptyView) -> UIImage? {
105 | return contentProxy.image
106 | }
107 |
108 | public func customView(for emptyView: FSEmptyView) -> UIView? {
109 | return contentProxy.customView
110 | }
111 |
112 | public func text(for emptyView: FSEmptyView) -> String? {
113 | return contentProxy.title
114 | }
115 |
116 | public func attributedText(for emptyView: FSEmptyView) -> NSAttributedString? {
117 | return contentProxy.richTitle
118 | }
119 |
120 | public func detailText(for emptyView: FSEmptyView) -> String? {
121 | return contentProxy.detail
122 | }
123 |
124 | public func attributedDetailText(for emptyView: FSEmptyView) -> NSAttributedString? {
125 | return contentProxy.richDetail
126 | }
127 |
128 | public func emptyView(_ emptyView: FSEmptyView, buttonTitleFor state: UIControl.State) -> String? {
129 | if state == .normal {
130 | return contentProxy.buttonTitle
131 | } else {
132 | return nil
133 | }
134 | }
135 |
136 | public func buttonTitleFont(for emptyView: FSEmptyView) -> UIFont? {
137 | return contentProxy.buttonTitleFont
138 | }
139 |
140 | public func emptyView(_ emptyView: FSEmptyView, buttonTitleColorFor state: UIControl.State) -> UIColor? {
141 | if state == .highlighted, let color = contentProxy.buttonTitleColor {
142 | return color.withAlphaComponent(0.65)
143 | }
144 | return contentProxy.buttonTitleColor
145 | }
146 |
147 | public func emptyView(_ emptyView: FSEmptyView, buttonAttributedTitleFor state: UIControl.State) -> NSAttributedString? {
148 | if state == .normal {
149 | return contentProxy.richButtonTitle
150 | } else {
151 | return nil
152 | }
153 | }
154 |
155 | public func customButton(for emptyView: FSEmptyView) -> UIButton? {
156 | return contentProxy.customButton
157 | }
158 | }
159 |
160 | // MARK: - Strategies
161 |
162 | /// 这是完全遵守 FSEmptyContentProxy 协议的 FSEmptyContent 模板。
163 | /// 该类默认没有实现任何的内容,外部可使用该类做自定义。
164 | public struct FSEmptyContentTemplate: FSEmptyContentProxy {
165 |
166 | public var contentOffset: CGPoint = .zero
167 | public var imageBottomSpace: CGFloat = 10.0
168 | public var textBottomSpace: CGFloat = 10.0
169 | public var detailTextBottomSpace: CGFloat = 10.0
170 | public var isScrollEnabled: Bool = false
171 | public var image: UIImage?
172 | public var customView: UIView?
173 | public var title: String?
174 | public var richTitle: NSAttributedString?
175 | public var detail: String?
176 | public var richDetail: NSAttributedString?
177 | public var buttonTitleFont: UIFont?
178 | public var buttonTitleColor: UIColor?
179 | public var buttonTitle: String?
180 | public var richButtonTitle: NSAttributedString?
181 | public var onDidPressButton: ((_ button: UIButton) -> Void)?
182 | public var customButton: UIButton?
183 | public var backgroundColor: UIColor?
184 |
185 | // MARK: Initialization
186 |
187 | public init() {}
188 | }
189 |
190 |
191 | public struct FSEmptyContentNone: FSEmptyContentProxy {
192 | public init() {}
193 | }
194 |
195 |
196 | public class FSEmptyContentReload: FSEmptyContentProxy {
197 |
198 | public var customButton: UIButton?
199 | public var onDidPressButton: ((_ button: UIButton) -> Void)?
200 |
201 | public init(title: String? = "Reload", tintColor: UIColor? = nil) {
202 | let color = tintColor ?? .gray
203 | customButton = {
204 | let button = UIButton()
205 | button.titleLabel?.font = .systemFont(ofSize: 16.0)
206 | button.setTitle(title, for: .normal)
207 | button.setTitleColor(color, for: .normal)
208 | button.layer.borderColor = color.cgColor
209 | button.layer.borderWidth = 1.0
210 | button.layer.cornerRadius = 6.0
211 | let size = button.sizeThatFits(.init(width: 10000.0, height: 10000.0))
212 | button.frame.size.width = floor(size.width) + 26.0
213 | button.frame.size.height = floor(size.height) + 6.0
214 | button.addTarget(self, action: #selector(p_didPress(_:)), for: .touchUpInside)
215 | return button
216 | }()
217 | }
218 |
219 | @objc
220 | private func p_didPress(_ sender: UIButton) {
221 | onDidPressButton?(sender)
222 | }
223 | }
224 |
225 |
226 | public struct FSEmptyContentNoContent: FSEmptyContentProxy {
227 |
228 | public var richTitle: NSAttributedString?
229 | public var richDetail: NSAttributedString?
230 |
231 | public init(title: String? = "No Content", titleColor: UIColor? = .gray, detail: String? = nil, detailColor: UIColor? = .lightGray) {
232 | if let title = title, !title.isEmpty {
233 | let color = titleColor ?? .gray
234 | richTitle = {
235 | let attributes: [NSAttributedString.Key : Any] = [
236 | .font : UIFont.systemFont(ofSize: 16.0),
237 | .foregroundColor : color
238 | ]
239 | return NSAttributedString(string: title, attributes: attributes)
240 | }()
241 | }
242 | if let detail = detail, !detail.isEmpty {
243 | let color = detailColor ?? .lightGray
244 | richDetail = {
245 | let attributes: [NSAttributedString.Key : Any] = [
246 | .font : UIFont.systemFont(ofSize: 14.0),
247 | .foregroundColor : color
248 | ]
249 | return NSAttributedString(string: detail, attributes: attributes)
250 | }()
251 | }
252 | }
253 | }
254 |
255 |
256 | public struct FSEmptyContentLoading: FSEmptyContentProxy {
257 |
258 | public var customView: UIView?
259 | public var richTitle: NSAttributedString?
260 |
261 | public init(title: String? = "Loading...", tintColor: UIColor? = nil) {
262 | let color = tintColor ?? .gray
263 | customView = {
264 | let loadingView = UIActivityIndicatorView()
265 | loadingView.color = color
266 | loadingView.startAnimating()
267 | if #available(iOS 13.0, *) {
268 | loadingView.style = .large
269 | }
270 | return loadingView
271 | }()
272 | if let title = title, !title.isEmpty {
273 | richTitle = {
274 | let fontSize: CGFloat = { if #available(iOS 13.0, *) { return 18.0 } else { return 16.0 } }()
275 | let attributes: [NSAttributedString.Key : Any] = [
276 | .font : UIFont.systemFont(ofSize: fontSize),
277 | .foregroundColor : color
278 | ]
279 | return NSAttributedString(string: title, attributes: attributes)
280 | }()
281 | }
282 | }
283 | }
284 |
--------------------------------------------------------------------------------
/Sources/Classes/FSEmptyContentProxy.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FSEmptyContentProxy.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 2023/12/25.
6 | // Copyright © 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol FSEmptyContentProxy {
12 |
13 | var contentOffset: CGPoint { get set }
14 |
15 | var imageBottomSpace: CGFloat { get set }
16 |
17 | var textBottomSpace: CGFloat { get set }
18 |
19 | var detailTextBottomSpace: CGFloat { get set }
20 |
21 | var isScrollEnabled: Bool { get set }
22 |
23 | var image: UIImage? { get set }
24 |
25 | var customView: UIView? { get set }
26 |
27 | var title: String? { get set }
28 |
29 | var richTitle: NSAttributedString? { get set }
30 |
31 | var detail: String? { get set }
32 |
33 | var richDetail: NSAttributedString? { get set }
34 |
35 | var buttonTitleFont: UIFont? { get set }
36 |
37 | var buttonTitleColor: UIColor? { get set }
38 |
39 | var buttonTitle: String? { get set }
40 |
41 | var richButtonTitle: NSAttributedString? { get set }
42 |
43 | var onDidPressButton: ((_ button: UIButton) -> Void)? { get set }
44 |
45 | var customButton: UIButton? { get set }
46 |
47 | var backgroundColor: UIColor? { get set }
48 | }
49 |
50 | // optional
51 | public extension FSEmptyContentProxy {
52 | var contentOffset: CGPoint { get { return .zero } set {} }
53 | var imageBottomSpace: CGFloat { get { return 10.0 } set {} }
54 | var textBottomSpace: CGFloat { get { return 10.0 } set {} }
55 | var detailTextBottomSpace: CGFloat { get { return 10.0 } set {} }
56 | var isScrollEnabled: Bool { get { return false } set {} }
57 | var image: UIImage? { get { return nil } set {} }
58 | var customView: UIView? { get { return nil } set {} }
59 | var title: String? { get { return nil } set {} }
60 | var richTitle: NSAttributedString? { get { return nil } set {} }
61 | var detail: String? { get { return nil } set {} }
62 | var richDetail: NSAttributedString? { get { return nil } set {} }
63 | var buttonTitleFont: UIFont? { get { return nil } set {} }
64 | var buttonTitleColor: UIColor? { get { return nil } set {} }
65 | var buttonTitle: String? { get { return nil } set {} }
66 | var richButtonTitle: NSAttributedString? { get { return nil } set {} }
67 | var onDidPressButton: ((_ button: UIButton) -> Void)? { get { return nil } set {} }
68 | var customButton: UIButton? { get { return nil } set {} }
69 | var backgroundColor: UIColor? { get { return nil } set {} }
70 | }
71 |
--------------------------------------------------------------------------------
/Sources/Classes/FSEmptyViewDataSource.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FSEmptyViewDataSource.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 2023/12/25.
6 | // Copyright © 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Foundation
11 |
12 | public protocol FSEmptyViewDataSource: AnyObject {
13 |
14 | /// - Note: 如果没有实现所需的数据源方法则会默认隐藏对应的控件。
15 |
16 | // MARK: ImageView
17 |
18 | /// 图片, 只需要返回 UIImage 实例即可, FSEmptyView 会根据图片的 size 自动调整 UIImageView 的 size。
19 | /// 如果实现了 `customView(for emptyView:)` 方法的话则会忽略该方法,不管是否返回有效的 UIImage 对象,
20 | /// 但如果 `customView(for emptyView:)` 方法返回 nil 且该方法返回有效 UIImage 对象的话则当前方法有效。
21 | /// - Note: 如果不实现该方法或返回 nil 则隐藏 UIImageView。
22 | func image(for emptyView: FSEmptyView) -> UIImage?
23 |
24 | // MARK: CustomView
25 |
26 | /// 自定义 view 替代 UIImageView 所在位置,比如设置一个 loading 控件。
27 | /// 自定义 view 底部的空隙用的是 `imageBottomSpace(for emptyView:)` 方法的返回值(如果没有实现该方法则使用默认值)。
28 | /// - Note: 此 customView 只是替代顶部的 UIImage 所在控件,并非指替代整个 EmptyView 的内容,
29 | /// 不过,你可以只设置 customView 而忽略其它所有控件,这样就达到了替代整个 EmptyView 内容的效果。
30 | func customView(for emptyView: FSEmptyView) -> UIView?
31 |
32 | /// 配置自定义 view 的 size,
33 | /// 如果不实现该方法则会先判断 customView 的 frame.size 是否有效,如果有效则使用 frame.size,
34 | /// 否则使用 customView 的 `sizeThatFits(_:)` 来确定 customView 的 size。
35 | func customViewSize(for emptyView: FSEmptyView) -> CGSize
36 |
37 | // MARK: TextLabel
38 |
39 | /// 文本,使用默认的字体和文本颜色。
40 | /// - Note: 如果返回 nil 则隐藏 textLabel。
41 | func text(for emptyView: FSEmptyView) -> String?
42 |
43 | /// 文本的富文本,如果实现了该方法这会自动忽略 `text(for emptyView:)` 方法。
44 | /// - Note: 如果该方法返回 nil 则会去使用 `text(for emptyView:)` 方法配置 textLabel。
45 | func attributedText(for emptyView: FSEmptyView) -> NSAttributedString?
46 |
47 | // MARK: DetailTextLabel
48 |
49 | /// 详细文本,使用默认的字体和文本颜色。
50 | /// - Note: 如果返回 nil 则隐藏 detailTextLabel。
51 | func detailText(for emptyView: FSEmptyView) -> String?
52 |
53 | /// 详细文本的富文本,如果实现了该方法这会自动忽略 `detailText(for emptyView:)` 方法。
54 | /// - Note: 如果该方法返回 nil 则会去使用 `detailText(for emptyView:)` 方法配置 detailTextLabel。
55 | func attributedDetailText(for emptyView: FSEmptyView) -> NSAttributedString?
56 |
57 | // MARK: Button
58 |
59 | /// 默认按钮的标题字体。
60 | /// - Note: 如果返回 nil 则使用默认的字体。
61 | func buttonTitleFont(for emptyView: FSEmptyView) -> UIFont?
62 |
63 | /// 指定状态下的按钮标题文本颜色。
64 | /// - Note: 如果返回 nil 则使用默认的颜色。
65 | func emptyView(_ emptyView: FSEmptyView, buttonTitleColorFor state: UIControl.State) -> UIColor?
66 |
67 | /// 指定状态下的按钮标题文本标题。
68 | /// - Note: 如果 UIControl.State.normal 状态下返回 nil 则默认会隐藏 UIButton。
69 | func emptyView(_ emptyView: FSEmptyView, buttonTitleFor state: UIControl.State) -> String?
70 |
71 | /// 指定状态下的富文本按钮标题。
72 | /// - Important: 如果实现了该方法则会忽略 `buttonTitleFont(for emptyView:)` 和 `emptyView(_ emptyView:, buttonTitleFor state:)` 以及 `emptyView(_ emptyView:, buttonTitleColorFor state:)` 方法.
73 | /// - Note: 如果 UIControl.State.normal 状态下返回 nil 则默认会继续使用上述三个被忽略的方法去配置 button。
74 | func emptyView(_ emptyView: FSEmptyView, buttonAttributedTitleFor state: UIControl.State) -> NSAttributedString?
75 |
76 | /// 自定义按钮。
77 | /// 如果实现了该方法则会忽略与按钮相关的其它任何数据源方法,
78 | /// 而且不会回调代理方法 `emptyView(_ emptyView:, didPressButton:)`, 需由开发者自己指定 target-action,
79 | /// 使用者需给这个自定义的 button 设置一个 bounds, 否则 FSEmpetyView 内部会使用 UIView 默认的 sizeToFit 方法配置 button 的 size.
80 | func customButton(for emptyView: FSEmptyView) -> UIButton?
81 | }
82 |
83 | // optional
84 | public extension FSEmptyViewDataSource {
85 | func image(for emptyView: FSEmptyView) -> UIImage? { return nil }
86 | func customView(for emptyView: FSEmptyView) -> UIView? { return nil }
87 | func customViewSize(for emptyView: FSEmptyView) -> CGSize { return .zero }
88 | func text(for emptyView: FSEmptyView) -> String? { return nil }
89 | func attributedText(for emptyView: FSEmptyView) -> NSAttributedString? { return nil }
90 | func detailText(for emptyView: FSEmptyView) -> String? { return nil }
91 | func attributedDetailText(for emptyView: FSEmptyView) -> NSAttributedString? { return nil }
92 | func buttonTitleFont(for emptyView: FSEmptyView) -> UIFont? { return nil }
93 | func emptyView(_ emptyView: FSEmptyView, buttonTitleColorFor state: UIControl.State) -> UIColor? { return nil }
94 | func emptyView(_ emptyView: FSEmptyView, buttonTitleFor state: UIControl.State) -> String? { return nil }
95 | func emptyView(_ emptyView: FSEmptyView, buttonAttributedTitleFor state: UIControl.State) -> NSAttributedString? { return nil }
96 | func customButton(for emptyView: FSEmptyView) -> UIButton? { return nil }
97 | }
98 |
--------------------------------------------------------------------------------
/Sources/Classes/FSEmptyViewDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FSEmptyViewDelegate.swift
3 | // FSEmptyDataSet
4 | //
5 | // Created by Sheng on 2023/12/25.
6 | // Copyright © 2023 Sheng. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Foundation
11 |
12 | public protocol FSEmptyViewDelegate: AnyObject {
13 |
14 | /// 内容偏移量,默认为 CGPointZero。
15 | func contentOffset(for emptyView: FSEmptyView) -> CGPoint
16 |
17 | /// 图片底部空隙,如果不实现该方法则使用默认的空隙。
18 | func imageBottomSpace(for emptyView: FSEmptyView) -> CGFloat
19 |
20 | /// 文本底部空隙,如果不实现该方法则使用默认的空隙。
21 | func textBottomSpace(for emptyView: FSEmptyView) -> CGFloat
22 |
23 | /// 详细文本底部空隙,如果不实现该方法则使用默认的空隙。
24 | func detailTextBottomSpace(for emptyView: FSEmptyView) -> CGFloat
25 |
26 | /// 文本最大布局宽度,如果不实现该方法这默认使用 FSEmptyView 的宽度。
27 | func textPreferredMaxLayoutWidth(for emptyView: FSEmptyView) -> CGFloat
28 |
29 | /// 详细文本最大布局宽度,如果不实现该方法这默认使用 FSEmptyView 的宽度。
30 | func detailTextPreferredMaxLayoutWidth(for emptyView: FSEmptyView) -> CGFloat
31 |
32 | /// 是否允许滑动,默认是 true。
33 | func emptyViewShouldAllowScroll(_ emptyView: FSEmptyView) -> Bool
34 |
35 | /// 自定义 FSEmptyView 背景颜色,默认为 nil。
36 | func backgroundColor(for emptyView: FSEmptyView) -> UIColor?
37 |
38 | /// 点击了 FSEmptyView 上的默认按钮。
39 | /// - Note: 自定义按钮不会回调该方法。
40 | func emptyView(_ emptyView: FSEmptyView, didPress button: UIButton)
41 | }
42 |
43 | // optional
44 | public extension FSEmptyViewDelegate {
45 | func contentOffset(for emptyView: FSEmptyView) -> CGPoint { return .zero }
46 | func imageBottomSpace(for emptyView: FSEmptyView) -> CGFloat { return 10.0 }
47 | func textBottomSpace(for emptyView: FSEmptyView) -> CGFloat { return 10.0 }
48 | func detailTextBottomSpace(for emptyView: FSEmptyView) -> CGFloat { return 10.0 }
49 | func textPreferredMaxLayoutWidth(for emptyView: FSEmptyView) -> CGFloat { return 0.0 }
50 | func detailTextPreferredMaxLayoutWidth(for emptyView: FSEmptyView) -> CGFloat { return 0.0 }
51 | func emptyViewShouldAllowScroll(_ emptyView: FSEmptyView) -> Bool { return true }
52 | func backgroundColor(for emptyView: FSEmptyView) -> UIColor? { return nil }
53 | func emptyView(_ emptyView: FSEmptyView, didPress button: UIButton) {}
54 | }
55 |
--------------------------------------------------------------------------------
/_Pods.xcodeproj:
--------------------------------------------------------------------------------
1 | Example/Pods/Pods.xcodeproj
--------------------------------------------------------------------------------