Skip to content

Commit

Permalink
Constrictor 5.0.0 (#22)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pedrommcarrasco authored Jan 18, 2019
1 parent bdc158e commit ea0ea6b
Show file tree
Hide file tree
Showing 146 changed files with 8,230 additions and 3,531 deletions.
18 changes: 8 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,34 @@ install: true

env:
global:
- PROJECT=Constrictor.xcodeproj
- PROJECT=Constrictor.xcworkspace
- FRAMEWORK_SCHEME=Constrictor
- PODSPEC=Constrictor.podspec
- PROJECT_EXAMPLE=Example.xcworkspace
- PROJECT_SCHEME=Example
- DESTINATION_PLATFORM_LATEST='platform=iOS Simulator,name=iPhone 8,OS=latest'
- DESTINATION_PLATFORM_OLD='platform=iOS Simulator,name=iPhone 5s,OS=9.0'
- DESTINATION_PLATFORM='platform=iOS Simulator,name=iPhone 8,OS=12.0'
- CODECOV_ENDPOINT=https://codecov.io/bash
- SDK=iphonesimulator

before_install:
- gem install cocoapods
- gem install cocoapods --pre
- pod --version

script:
- cd Constrictor
- pod update
- set -o pipefail
- 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
- bash <(curl -s "$CODECOV_ENDPOINT") -cF swift
- set -o pipefail
- 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

- 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
- bash <(curl -s "$CODECOV_ENDPOINT") -cF swift
- cd ..

- cd "$PROJECT_SCHEME"
- pod repo update && pod update
- set -o pipefail
- xcodebuild -workspace "$PROJECT_EXAMPLE" -scheme "$PROJECT_SCHEME" -sdk iphonesimulator ONLY_ACTIVE_ARCH=YES | xcpretty -c
- xcodebuild -workspace "$PROJECT_EXAMPLE" -scheme "$PROJECT_SCHEME" -sdk "$SDK" ONLY_ACTIVE_ARCH=YES | xcpretty -c
- cd ..
- travis_wait 30 pod lib lint "$PODSPEC"

after_success:
- bash <(curl -s "$CODECOV_ENDPOINT") -J '^Constrictor$'
- bash <(curl -s "$CODECOV_ENDPOINT") -J '^Constrictor$'
6 changes: 3 additions & 3 deletions Constrictor.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Pod::Spec.new do |s|
s.swift_version = "4.2"
s.name = "Constrictor"
s.version = "4.1.1"
s.summary = "🐍 AutoLayout's µFramework"
s.version = "5.0.0"
s.summary = "🐍 Constrict your layout in Swift"

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

s.homepage = "https://github.com/pedrommcarrasco/Constrictor"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
545 changes: 392 additions & 153 deletions Constrictor/Constrictor.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
onlyGenerateCoverageForSpecifiedTargets = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<CodeCoverageTargets>
<BuildableReference
Expand Down
10 changes: 10 additions & 0 deletions Constrictor/Constrictor.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
61 changes: 61 additions & 0 deletions Constrictor/Constrictor/Anchors/Anchor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// Anchor.swift
// Constrictor
//
// Created by Pedro Carrasco on 12/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - Anchor
public enum Anchor: CaseIterable {
case top
case bottom
case leading
case trailing
case right
case left
case centerX
case centerY
case width
case height
}

// MARK: - Properties
extension Anchor {

var attribute: NSLayoutConstraint.Attribute {
switch self {
case .top: return .top
case .bottom: return .bottom
case .leading: return .leading
case .trailing: return .trailing
case .right: return .right
case .left: return .left
case .centerX: return .centerX
case .centerY: return .centerY
case .width: return .width
case .height: return .height
}
}
}

// MARK: - Functions
extension Anchor {

func constraints(for constraints: Constraints) -> [NSLayoutConstraint] {
switch self {
case .top: return constraints.top
case .bottom: return constraints.bottom
case .leading: return constraints.leading
case .trailing: return constraints.trailing
case .right: return constraints.right
case .left: return constraints.left
case .centerX: return constraints.centerX
case .centerY: return constraints.centerY
case .width: return constraints.width
case .height: return constraints.height
}
}
}
44 changes: 44 additions & 0 deletions Constrictor/Constrictor/Anchors/AnchorDimension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// AnchorDimension.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - AnchorDimension
public enum AnchorDimension: CaseIterable {
case width
case height
}

// MARK: - Properties
extension AnchorDimension {

var attribute: NSLayoutConstraint.Attribute {
switch self {
case .width: return .width
case .height: return .height
}
}
}

// MARK: - Functions
extension AnchorDimension {

func anchor(for anchorable: Anchorable) -> NSLayoutDimension {
switch self {
case .width: return anchorable.widthAnchor
case .height: return anchorable.heightAnchor
}
}

func constraints(for constraints: Constraints) -> [NSLayoutConstraint] {
switch self {
case .width: return constraints.width
case .height: return constraints.height
}
}
}
32 changes: 32 additions & 0 deletions Constrictor/Constrictor/Anchors/AnchorXAxis.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// AnchorXAxis.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - AnchorXAxis
public enum AnchorXAxis: CaseIterable {
case centerX
case left
case leading
case right
case trailing
}

// MARK: - Functions
extension AnchorXAxis {

func anchor(for anchorable: Anchorable) -> NSLayoutXAxisAnchor {
switch self {
case .centerX: return anchorable.centerXAnchor
case .left: return anchorable.leftAnchor
case .leading: return anchorable.leadingAnchor
case .right: return anchorable.rightAnchor
case .trailing: return anchorable.trailingAnchor
}
}
}
28 changes: 28 additions & 0 deletions Constrictor/Constrictor/Anchors/AnchorYAxis.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// AnchorYAxis.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - AnchorYAxis
public enum AnchorYAxis: CaseIterable {
case centerY
case top
case bottom
}

// MARK: - Functions
extension AnchorYAxis {

func anchor(for anchorable: Anchorable) -> NSLayoutYAxisAnchor {
switch self {
case .centerY: return anchorable.centerYAnchor
case .top: return anchorable.topAnchor
case .bottom: return anchorable.bottomAnchor
}
}
}
23 changes: 23 additions & 0 deletions Constrictor/Constrictor/Anchors/Anchorable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Anchorable.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - Anchorable
public protocol Anchorable: class {
var leadingAnchor: NSLayoutXAxisAnchor { get }
var trailingAnchor: NSLayoutXAxisAnchor { get }
var leftAnchor: NSLayoutXAxisAnchor { get }
var rightAnchor: NSLayoutXAxisAnchor { get }
var topAnchor: NSLayoutYAxisAnchor { get }
var bottomAnchor: NSLayoutYAxisAnchor { get }
var widthAnchor: NSLayoutDimension { get }
var heightAnchor: NSLayoutDimension { get }
var centerXAnchor: NSLayoutXAxisAnchor { get }
var centerYAnchor: NSLayoutYAxisAnchor { get }
}
12 changes: 12 additions & 0 deletions Constrictor/Constrictor/Anchors/UILayoutGuide+Anchorable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// UILayoutGuide+Anchorable.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - Anchorable
extension UILayoutGuide: Anchorable {}
12 changes: 12 additions & 0 deletions Constrictor/Constrictor/Anchors/UIView+Anchorable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// UIView+Anchorable.swift
// Constrictor
//
// Created by Pedro Carrasco on 11/01/2019.
// Copyright © 2019 Pedro Carrasco. All rights reserved.
//

import UIKit

// MARK: - Anchorable
extension UIView: Anchorable {}
Loading

0 comments on commit ea0ea6b

Please sign in to comment.