Skip to content

Commit ea0ea6b

Browse files
Constrictor 5.0.0 (#22)
* Revamp MVP (WIP) * Sets translateAutoresizingMaskIntoConstraints to false * Lazy Constrictor * Updated naming * Deleted Contrictor 4.1.0 * Added way of updating constraints for animations * Added deep find functions to retrieve a constraint * Updated naming * Updated Travis Configuration * Updated design * Unit tests Anchor, AnchorDimension, AnchorXAxis, AnchorYAxis and NSLayoutConstraint+Set * Updated .podspec * Updated README.md * Added new cover * Updated README.md * Added SnapshotTesting * Unit Tested Constants * Added Snapshots to Edge, Center and Size * Updated Travis Configuration * Updated Schema Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Updated Travis Configuration * Locked SnapshotTesting * Updated Project Configuration * Unit Tested UIView+Constrictor * United Tested UILayoutGuide+Constrictor * Added missing coverage to snapshots * Unit Tested Update * Fixed issue with Example * Added UILayoutPriority operators (+ & -) * Added MARKs * Updated .podspec * Fixed issues with tests * Added presentation.gif * Updated gif and css * Updated GIF * Updated GIF * LayoutPriority, LayoutState & LayoutState * Updated README.md * Updated README.md * Updated README.md * Updated README.md * Updated README.md * Added new sugar to NSLayoutConstraint (isActive) * Code Review
1 parent bdc158e commit ea0ea6b

146 files changed

Lines changed: 8230 additions & 3531 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,34 @@ install: true
55

66
env:
77
global:
8-
- PROJECT=Constrictor.xcodeproj
8+
- PROJECT=Constrictor.xcworkspace
99
- FRAMEWORK_SCHEME=Constrictor
1010
- PODSPEC=Constrictor.podspec
1111
- PROJECT_EXAMPLE=Example.xcworkspace
1212
- PROJECT_SCHEME=Example
13-
- DESTINATION_PLATFORM_LATEST='platform=iOS Simulator,name=iPhone 8,OS=latest'
14-
- DESTINATION_PLATFORM_OLD='platform=iOS Simulator,name=iPhone 5s,OS=9.0'
13+
- DESTINATION_PLATFORM='platform=iOS Simulator,name=iPhone 8,OS=12.0'
1514
- CODECOV_ENDPOINT=https://codecov.io/bash
1615
- SDK=iphonesimulator
1716

1817
before_install:
19-
- gem install cocoapods
18+
- gem install cocoapods --pre
2019
- pod --version
2120

2221
script:
2322
- cd Constrictor
23+
- pod update
2424
- set -o pipefail
25-
- xcodebuild -project "$PROJECT" -scheme "$FRAMEWORK_SCHEME" -sdk "$SDK" -configuration Debug ONLY_ACTIVE_ARCH=YES -destination "$DESTINATION_PLATFORM_LATEST" CODE_SIGNING_REQUIRED=NO -enableCodeCoverage YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
26-
- bash <(curl -s "$CODECOV_ENDPOINT") -cF swift
27-
- set -o pipefail
28-
- xcodebuild -project "$PROJECT" -scheme "$FRAMEWORK_SCHEME" -sdk "$SDK" -configuration Debug ONLY_ACTIVE_ARCH=YES -destination "$DESTINATION_PLATFORM_OLD" CODE_SIGNING_REQUIRED=NO -enableCodeCoverage YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
25+
26+
- xcodebuild -workspace "$PROJECT" -scheme "$FRAMEWORK_SCHEME" -sdk "$SDK" -destination "$DESTINATION_PLATFORM" CODE_SIGNING_REQUIRED=NO -enableCodeCoverage YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
2927
- bash <(curl -s "$CODECOV_ENDPOINT") -cF swift
3028
- cd ..
3129

3230
- cd "$PROJECT_SCHEME"
3331
- pod repo update && pod update
3432
- set -o pipefail
35-
- xcodebuild -workspace "$PROJECT_EXAMPLE" -scheme "$PROJECT_SCHEME" -sdk iphonesimulator ONLY_ACTIVE_ARCH=YES | xcpretty -c
33+
- xcodebuild -workspace "$PROJECT_EXAMPLE" -scheme "$PROJECT_SCHEME" -sdk "$SDK" ONLY_ACTIVE_ARCH=YES | xcpretty -c
3634
- cd ..
3735
- travis_wait 30 pod lib lint "$PODSPEC"
3836

3937
after_success:
40-
- bash <(curl -s "$CODECOV_ENDPOINT") -J '^Constrictor$'
38+
- bash <(curl -s "$CODECOV_ENDPOINT") -J '^Constrictor$'

Constrictor.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Pod::Spec.new do |s|
22
s.swift_version = "4.2"
33
s.name = "Constrictor"
4-
s.version = "4.1.1"
5-
s.summary = "🐍 AutoLayout's µFramework"
4+
s.version = "5.0.0"
5+
s.summary = "🐍 Constrict your layout in Swift"
66

7-
s.description = "(Boe) Constrictor's AutoLayout µFramework with the goal of simplying your constraints by reducing the amount of code you have to write."
7+
s.description = "Constrict your Auto Layout code with Constrictor, your chainable sugar."
88

99
s.homepage = "https://github.com/pedrommcarrasco/Constrictor"
1010
s.license = { :type => 'MIT', :file => 'LICENSE' }

Constrictor/Constrictor.xcodeproj/project.pbxproj

Lines changed: 392 additions & 153 deletions
Large diffs are not rendered by default.

Constrictor/Constrictor.xcodeproj/xcshareddata/xcschemes/Constrictor.xcscheme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
onlyGenerateCoverageForSpecifiedTargets = "YES"
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<CodeCoverageTargets>
4546
<BuildableReference

Constrictor/Constrictor.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// Anchor.swift
3+
// Constrictor
4+
//
5+
// Created by Pedro Carrasco on 12/01/2019.
6+
// Copyright © 2019 Pedro Carrasco. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
// MARK: - Anchor
12+
public enum Anchor: CaseIterable {
13+
case top
14+
case bottom
15+
case leading
16+
case trailing
17+
case right
18+
case left
19+
case centerX
20+
case centerY
21+
case width
22+
case height
23+
}
24+
25+
// MARK: - Properties
26+
extension Anchor {
27+
28+
var attribute: NSLayoutConstraint.Attribute {
29+
switch self {
30+
case .top: return .top
31+
case .bottom: return .bottom
32+
case .leading: return .leading
33+
case .trailing: return .trailing
34+
case .right: return .right
35+
case .left: return .left
36+
case .centerX: return .centerX
37+
case .centerY: return .centerY
38+
case .width: return .width
39+
case .height: return .height
40+
}
41+
}
42+
}
43+
44+
// MARK: - Functions
45+
extension Anchor {
46+
47+
func constraints(for constraints: Constraints) -> [NSLayoutConstraint] {
48+
switch self {
49+
case .top: return constraints.top
50+
case .bottom: return constraints.bottom
51+
case .leading: return constraints.leading
52+
case .trailing: return constraints.trailing
53+
case .right: return constraints.right
54+
case .left: return constraints.left
55+
case .centerX: return constraints.centerX
56+
case .centerY: return constraints.centerY
57+
case .width: return constraints.width
58+
case .height: return constraints.height
59+
}
60+
}
61+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// AnchorDimension.swift
3+
// Constrictor
4+
//
5+
// Created by Pedro Carrasco on 11/01/2019.
6+
// Copyright © 2019 Pedro Carrasco. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
// MARK: - AnchorDimension
12+
public enum AnchorDimension: CaseIterable {
13+
case width
14+
case height
15+
}
16+
17+
// MARK: - Properties
18+
extension AnchorDimension {
19+
20+
var attribute: NSLayoutConstraint.Attribute {
21+
switch self {
22+
case .width: return .width
23+
case .height: return .height
24+
}
25+
}
26+
}
27+
28+
// MARK: - Functions
29+
extension AnchorDimension {
30+
31+
func anchor(for anchorable: Anchorable) -> NSLayoutDimension {
32+
switch self {
33+
case .width: return anchorable.widthAnchor
34+
case .height: return anchorable.heightAnchor
35+
}
36+
}
37+
38+
func constraints(for constraints: Constraints) -> [NSLayoutConstraint] {
39+
switch self {
40+
case .width: return constraints.width
41+
case .height: return constraints.height
42+
}
43+
}
44+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// AnchorXAxis.swift
3+
// Constrictor
4+
//
5+
// Created by Pedro Carrasco on 11/01/2019.
6+
// Copyright © 2019 Pedro Carrasco. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
// MARK: - AnchorXAxis
12+
public enum AnchorXAxis: CaseIterable {
13+
case centerX
14+
case left
15+
case leading
16+
case right
17+
case trailing
18+
}
19+
20+
// MARK: - Functions
21+
extension AnchorXAxis {
22+
23+
func anchor(for anchorable: Anchorable) -> NSLayoutXAxisAnchor {
24+
switch self {
25+
case .centerX: return anchorable.centerXAnchor
26+
case .left: return anchorable.leftAnchor
27+
case .leading: return anchorable.leadingAnchor
28+
case .right: return anchorable.rightAnchor
29+
case .trailing: return anchorable.trailingAnchor
30+
}
31+
}
32+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// AnchorYAxis.swift
3+
// Constrictor
4+
//
5+
// Created by Pedro Carrasco on 11/01/2019.
6+
// Copyright © 2019 Pedro Carrasco. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
// MARK: - AnchorYAxis
12+
public enum AnchorYAxis: CaseIterable {
13+
case centerY
14+
case top
15+
case bottom
16+
}
17+
18+
// MARK: - Functions
19+
extension AnchorYAxis {
20+
21+
func anchor(for anchorable: Anchorable) -> NSLayoutYAxisAnchor {
22+
switch self {
23+
case .centerY: return anchorable.centerYAnchor
24+
case .top: return anchorable.topAnchor
25+
case .bottom: return anchorable.bottomAnchor
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)