diff --git a/.codeclimate.yml b/.codeclimate.yml index 3a52babd..b7fd1c11 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -7,8 +7,8 @@ ratings: - "**.swift" exclude_paths: - - MCSwiftLayoutTests - - MCSwiftLayoutSample + - PinLayoutTests + - PinLayoutSample - Carthage - Source/Pods - data diff --git a/.gitignore b/.gitignore index d8a909ce..1a157745 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ build/ DerivedData/ Pods/ Carthage/ -MCSwiftLayoutSample/Pods +PinLayoutSample/Pods xcuserdata *.xcworkspace data/ \ No newline at end of file diff --git a/.tailor.yml b/.tailor.yml index 1fe48c37..25a33ed7 100644 --- a/.tailor.yml +++ b/.tailor.yml @@ -1,9 +1,9 @@ include: - - MCSwiftLayout + - PinLayout exclude: - - MCSwiftLayoutTests - - MCSwiftLayoutSample + - PinLayoutTests + - PinLayoutSample - Carthage - Source/Pods - data diff --git a/.travis.yml b/.travis.yml index be96f1e9..fcc6bc10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: objective-c osx_image: xcode8 -xcode_project: MCSwiftLayout.xcodeproj -xcode_scheme: MCSwiftLayout +xcode_project: PinLayout.xcodeproj +xcode_scheme: PinLayout xcode_sdk: iphonesimulator9.3 env: global: @@ -12,8 +12,8 @@ before_install: - ./install-dependencies.sh script: xcodebuild - -project MCSwiftLayout.xcodeproj - -scheme "MCSwiftLayout" + -project PinLayout.xcodeproj + -scheme "PinLayout" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' -enableCodeCoverage YES diff --git a/MCSwiftLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MCSwiftLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index d3aa2124..00000000 --- a/MCSwiftLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 262fb27a..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/AppDelegate.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/AppDelegate.swift deleted file mode 100644 index b1deee38..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/AppDelegate.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.swift -// MCSwiftLayoutSample -// -// Created by DION, Luc (MTL) on 2017-02-27. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. -// - -import UIKit -import MCSwiftLayout - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - - window = UIWindow(frame: UIScreen.main.bounds) - window!.backgroundColor = UIColor.white - window!.rootViewController = UINavigationController(rootViewController: MenuViewController()) - window!.makeKeyAndVisible() - - return true - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Domain/Expect.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/Domain/Expect.swift deleted file mode 100644 index 0a9dabf4..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/Domain/Expect.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Expect.swift -// MCSwiftLayoutSample -// -// Created by DION, Luc (MTL) on 2017-03-02. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. -// - -import UIKit - -func expect(view: UIView, toMatchRect rect: CGRect) { - if view.frame != rect { - print("Doesn't match rect") - } -} - diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Common/BasicView.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Common/BasicView.swift deleted file mode 100644 index eb048fc0..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Common/BasicView.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// BasicView.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright © 2017 Mirego. All rights reserved. -// -import UIKit - -class BasicView: UIView { - fileprivate let label = UILabel() - - init(text: String? = nil, color: UIColor) { - super.init(frame: .zero) - - backgroundColor = color - layer.borderWidth = 1 - layer.borderColor = UIColor.lightGray.cgColor - - label.text = text - label.font = UIFont.systemFont(ofSize: 7) - label.textColor = .white - label.sizeToFit() - addSubview(label) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func layoutSubviews() { - super.layoutSubviews() - - label.pin.top(0).left(0) - } - - var sizeThatFitsExpectedArea: CGFloat = 40 * 40 - - override func sizeThatFits(_ size: CGSize) -> CGSize { - var newSize = CGSize() - if size.width != CGFloat.greatestFiniteMagnitude { - newSize.width = size.width - newSize.height = sizeThatFitsExpectedArea / newSize.width - } else if size.height != CGFloat.greatestFiniteMagnitude { - newSize.height = size.height - newSize.width = sizeThatFitsExpectedArea / newSize.height - } else { - newSize.width = 40 - newSize.height = sizeThatFitsExpectedArea / newSize.width - } - - return newSize - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift deleted file mode 100644 index 4fef2825..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// BothEdgesSnappedViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class BothEdgesSnappedViewController: UIViewController { - fileprivate var mainView: BothEdgesSnappedView { - return self.view as! BothEdgesSnappedView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = BothEdgesSnappedView() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(true) - - navigationController?.isNavigationBarHidden = true - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift deleted file mode 100644 index b1da60a6..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// ChainedLayoutViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-20. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class ChainedLayoutViewController: UIViewController { - fileprivate var mainView: ChainedLayoutView? { - return self.view as? ChainedLayoutView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = ChainedLayoutView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift deleted file mode 100644 index fa5c9a45..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// MarginsAndInsetsViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class MarginsAndInsetsViewController: UIViewController { - fileprivate var mainView: MarginsAndInsetsView { - return self.view as! MarginsAndInsetsView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = MarginsAndInsetsView() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(true) - - navigationController?.isNavigationBarHidden = true - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift deleted file mode 100644 index c8392dc6..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MarginsAndPaddingsLeftRightViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class MarginsAndPaddingsLeftRightViewController: UIViewController { - fileprivate var mainView: MarginsAndPaddingsLeftRightView { - return self.view as! MarginsAndPaddingsLeftRightView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = MarginsAndPaddingsLeftRightView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift deleted file mode 100644 index 92bef7d1..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MarginsAndPaddingsLeftWidthViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class MarginsAndPaddingsLeftWidthViewController: UIViewController { - fileprivate var mainView: MarginsAndPaddingsLeftWidthView { - return self.view as! MarginsAndPaddingsLeftWidthView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = MarginsAndPaddingsLeftWidthView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift deleted file mode 100644 index 35fe88f2..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// MultiRelativeView.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-25. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class MultiRelativeView: UIView { - private let view1 = BasicView(text: "View1", color: UIColor.blue.withAlphaComponent(0.6)) - private let view2 = BasicView(text: "View2", color: UIColor.blue.withAlphaComponent(0.6)) - private let view = BasicView(text: "View", color: UIColor.blue.withAlphaComponent(1.0)) - - init() { - super.init(frame: .zero) - backgroundColor = .white - - addSubview(view1) - addSubview(view2) - addSubview(view) - } - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - func configure() { - - } - - override func layoutSubviews() { - super.layoutSubviews() - - view1.pin.top(64).left(10).width(100).height(100) - view2.pin.right(of: view1, aligned: .top).marginLeft(150).width(100).height(100) - - view.pin.right(of: view1, aligned: .top).left(of: view2).height(75).insetLeft(10).insetRight(10) - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift deleted file mode 100644 index d63d3610..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// MultiRelativeViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-25. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class MultiRelativeViewController: UIViewController { - fileprivate var mainView: MultiRelativeView { - return self.view as! MultiRelativeView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = MultiRelativeView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift deleted file mode 100644 index 057817d6..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// PinScrollingViewController.swift -// MCSwiftLayoutSample -// -// Created by Luc Dion on 2017-03-23. -// Copyright (c) 2017 mcswiftlayyout.mirego.com. All rights reserved. -// -import UIKit - -class PinScrollingViewController: UIViewController { - fileprivate var mainView: PinScrollingView { - return self.view as! PinScrollingView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - override func loadView() { - view = PinScrollingView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift deleted file mode 100644 index 2cccea15..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// RelativeViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-22. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class RelativeViewController: UIViewController { - fileprivate var mainView: RelativeView { - return self.view as! RelativeView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = RelativeView() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(true) - - navigationController?.isNavigationBarHidden = true - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift deleted file mode 100644 index 8a4b6f11..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ValidateConflictsView.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-23. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class ValidateConflictsView: UIView { - private let topLeftView = UIView() - - init() { - super.init(frame: .zero) - - backgroundColor = .white - - addSquare(topLeftView, color: .green) - } - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - fileprivate func addSquare(_ view: UIView, color: UIColor) { - view.backgroundColor = color - view.pin.width(50).height(50) - addSubview(view) - } - - override func layoutSubviews() { - super.layoutSubviews() - - topLeftView.pin.right(10).width(20).top(10).left(10).left(10) - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift deleted file mode 100644 index 8c34d52d..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// ValidateConflictsViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-23. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit - -class ValidateConflictsViewController: UIViewController { - fileprivate var mainView: ValidateConflictsView { - return self.view as! ValidateConflictsView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = ValidateConflictsView() - } -} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift b/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift deleted file mode 100644 index 573ffac0..00000000 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewExtensionsPositionningViewController.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-17. -// Copyright (c) 2017 Mirego. All rights reserved. -// -import UIKit -import UIKit - -class ViewExtensionsPositionningViewController: UIViewController { - fileprivate var mainView: ViewExtensionsPositionningView { - return self.view as! ViewExtensionsPositionningView - } - - init() { - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func loadView() { - view = ViewExtensionsPositionningView() - } -} diff --git a/MCSwiftLayoutSample/Podfile b/MCSwiftLayoutSample/Podfile deleted file mode 100644 index 543d49a6..00000000 --- a/MCSwiftLayoutSample/Podfile +++ /dev/null @@ -1,18 +0,0 @@ -use_frameworks! - -workspace 'MCSwiftLayoutSample.xcworkspace' - -target 'MCSwiftLayoutSample' do - project 'MCSwiftLayoutSample.xcodeproj' - #pod 'YogaKit', '~> 1.1' - - # Debug only - pod 'Reveal-SDK', :configurations => ['Debug'] - pod 'SwiftLint' -end - -#target 'MCSwiftLayoutTests' do -# project '../MCSwiftLayout.xcodeproj' -# pod 'Quick' -# pod 'Nimble' -#end diff --git a/MCSwiftLayoutTests/BasicView.swift b/MCSwiftLayoutTests/BasicView.swift deleted file mode 100644 index eb048fc0..00000000 --- a/MCSwiftLayoutTests/BasicView.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// BasicView.swift -// MCLayoutExample -// -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright © 2017 Mirego. All rights reserved. -// -import UIKit - -class BasicView: UIView { - fileprivate let label = UILabel() - - init(text: String? = nil, color: UIColor) { - super.init(frame: .zero) - - backgroundColor = color - layer.borderWidth = 1 - layer.borderColor = UIColor.lightGray.cgColor - - label.text = text - label.font = UIFont.systemFont(ofSize: 7) - label.textColor = .white - label.sizeToFit() - addSubview(label) - } - - required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func layoutSubviews() { - super.layoutSubviews() - - label.pin.top(0).left(0) - } - - var sizeThatFitsExpectedArea: CGFloat = 40 * 40 - - override func sizeThatFits(_ size: CGSize) -> CGSize { - var newSize = CGSize() - if size.width != CGFloat.greatestFiniteMagnitude { - newSize.width = size.width - newSize.height = sizeThatFitsExpectedArea / newSize.width - } else if size.height != CGFloat.greatestFiniteMagnitude { - newSize.height = size.height - newSize.width = sizeThatFitsExpectedArea / newSize.height - } else { - newSize.width = 40 - newSize.height = sizeThatFitsExpectedArea / newSize.width - } - - return newSize - } -} diff --git a/MCSwiftLayoutTests/MCSwiftLayoutTests.swift b/MCSwiftLayoutTests/MCSwiftLayoutTests.swift deleted file mode 100644 index e1d76173..00000000 --- a/MCSwiftLayoutTests/MCSwiftLayoutTests.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// MCSwiftLayoutTests.swift -// MCSwiftLayoutTests -// -// Created by DION, Luc (MTL) on 2017-02-27. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. -// - -import XCTest -@testable import MCSwiftLayout - -class MCSwiftLayoutTests: XCTestCase { - var viewController: UIViewController! - var rootView: UIView! - - override func setUp() { - super.setUp() - - viewController = UIViewController() - - rootView = UIView() - rootView.frame = CGRect(x: 0, y: 0, width: 100, height: 100) - viewController.view.addSubview(rootView) - } - - func testExample() { - let child1 = UIView() - rootView.addSubview(child1) - -// pin(rootView).topLeft(to: child1.pin.center) -// rootView.pin.topLeft(to: child1.pin.center) - -// child1.pin.pinCenter(of: rootView) -// print("child1.frame: \(child1.frame)") - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/MCSwiftLayoutTests/RectNimbleMatcher.swift b/MCSwiftLayoutTests/RectNimbleMatcher.swift deleted file mode 100644 index 48cbd52b..00000000 --- a/MCSwiftLayoutTests/RectNimbleMatcher.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// RectNimbleMatcher.swift -// MCSwiftLayout -// -// Created by DION, Luc (MTL) on 2017-03-12. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. -// -import Nimble -import UIKit - -public func beCloseTo(_ expectedValues: CGRect, within delta: CGFloat = 0.00001) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be close to CGRect <\(stringify(expectedValues))> (each within \(stringify(delta)))" - if let actual = try actualExpression.evaluate() { - failureMessage.actualValue = "<\(stringify(actual))>" - - if fabs(actual.origin.x - expectedValues.origin.x) > delta { - return false - } - - if fabs(actual.origin.y - expectedValues.origin.y) > delta { - return false - } - - if fabs(actual.size.width - expectedValues.size.width) > delta { - return false - } - - if fabs(actual.size.height - expectedValues.size.height) > delta { - return false - } - - return true - } - - return false - } -} diff --git a/MCSwiftLayout.xcodeproj/project.pbxproj b/PinLayout.xcodeproj/project.pbxproj similarity index 86% rename from MCSwiftLayout.xcodeproj/project.pbxproj rename to PinLayout.xcodeproj/project.pbxproj index cc0f0b50..b22db754 100644 --- a/MCSwiftLayout.xcodeproj/project.pbxproj +++ b/PinLayout.xcodeproj/project.pbxproj @@ -18,9 +18,9 @@ 2469C5041E75DB7600073BEE /* RectNimbleMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2469C5031E75DB7600073BEE /* RectNimbleMatcher.swift */; }; 246D36481E6C46F50050F202 /* PinPointCoordinatesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 246D36471E6C46F50050F202 /* PinPointCoordinatesSpec.swift */; }; 2482908C1E78CFFC00667D08 /* RelativePositionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2482908B1E78CFFC00667D08 /* RelativePositionSpec.swift */; }; - 249EFE841E64FB4C00165E39 /* MCSwiftLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 249EFE7A1E64FB4C00165E39 /* MCSwiftLayout.framework */; }; - 249EFE891E64FB4C00165E39 /* MCSwiftLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249EFE881E64FB4C00165E39 /* MCSwiftLayoutTests.swift */; }; - 249EFE8B1E64FB4C00165E39 /* MCSwiftLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 249EFE7D1E64FB4C00165E39 /* MCSwiftLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 249EFE841E64FB4C00165E39 /* PinLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 249EFE7A1E64FB4C00165E39 /* PinLayout.framework */; }; + 249EFE891E64FB4C00165E39 /* PinLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249EFE881E64FB4C00165E39 /* PinLayoutTests.swift */; }; + 249EFE8B1E64FB4C00165E39 /* PinLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 249EFE7D1E64FB4C00165E39 /* PinLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; DF11A3711E833F03008B33E5 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF11A3701E833F03008B33E5 /* Types.swift */; }; DF11A3781E834B32008B33E5 /* UIView+PinLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF11A3771E834B32008B33E5 /* UIView+PinLayout.swift */; }; DF11A37A1E834B3F008B33E5 /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF11A3791E834B3F008B33E5 /* Coordinates.swift */; }; @@ -34,7 +34,7 @@ containerPortal = 249EFE711E64FB4C00165E39 /* Project object */; proxyType = 1; remoteGlobalIDString = 249EFE791E64FB4C00165E39; - remoteInfo = MCSwiftLayout; + remoteInfo = PinLayout; }; /* End PBXContainerItemProxy section */ @@ -62,11 +62,11 @@ 2469C5031E75DB7600073BEE /* RectNimbleMatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RectNimbleMatcher.swift; sourceTree = ""; }; 246D36471E6C46F50050F202 /* PinPointCoordinatesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinPointCoordinatesSpec.swift; sourceTree = ""; }; 2482908B1E78CFFC00667D08 /* RelativePositionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelativePositionSpec.swift; sourceTree = ""; }; - 249EFE7A1E64FB4C00165E39 /* MCSwiftLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MCSwiftLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 249EFE7D1E64FB4C00165E39 /* MCSwiftLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCSwiftLayout.h; sourceTree = ""; }; + 249EFE7A1E64FB4C00165E39 /* PinLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PinLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 249EFE7D1E64FB4C00165E39 /* PinLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PinLayout.h; sourceTree = ""; }; 249EFE7E1E64FB4C00165E39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 249EFE831E64FB4C00165E39 /* MCSwiftLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MCSwiftLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 249EFE881E64FB4C00165E39 /* MCSwiftLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCSwiftLayoutTests.swift; sourceTree = ""; }; + 249EFE831E64FB4C00165E39 /* PinLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PinLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 249EFE881E64FB4C00165E39 /* PinLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutTests.swift; sourceTree = ""; }; 249EFE8A1E64FB4C00165E39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DF11A3701E833F03008B33E5 /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = ""; }; DF11A3771E834B32008B33E5 /* UIView+PinLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+PinLayout.swift"; sourceTree = ""; }; @@ -87,7 +87,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 249EFE841E64FB4C00165E39 /* MCSwiftLayout.framework in Frameworks */, + 249EFE841E64FB4C00165E39 /* PinLayout.framework in Frameworks */, 241962391E7F582C00A0466C /* Nimble.framework in Frameworks */, 2419623A1E7F582C00A0466C /* Quick.framework in Frameworks */, ); @@ -108,8 +108,8 @@ 249EFE701E64FB4C00165E39 = { isa = PBXGroup; children = ( - 249EFE7C1E64FB4C00165E39 /* MCSwiftLayout */, - 249EFE871E64FB4C00165E39 /* MCSwiftLayoutTests */, + 249EFE7C1E64FB4C00165E39 /* PinLayout */, + 249EFE871E64FB4C00165E39 /* PinLayoutTests */, 249EFE7B1E64FB4C00165E39 /* Products */, DF11A3741E834181008B33E5 /* Supporting Files */, 138A1F602470415292B7194B /* Frameworks */, @@ -119,45 +119,45 @@ 249EFE7B1E64FB4C00165E39 /* Products */ = { isa = PBXGroup; children = ( - 249EFE7A1E64FB4C00165E39 /* MCSwiftLayout.framework */, - 249EFE831E64FB4C00165E39 /* MCSwiftLayoutTests.xctest */, + 249EFE7A1E64FB4C00165E39 /* PinLayout.framework */, + 249EFE831E64FB4C00165E39 /* PinLayoutTests.xctest */, ); name = Products; sourceTree = ""; }; - 249EFE7C1E64FB4C00165E39 /* MCSwiftLayout */ = { + 249EFE7C1E64FB4C00165E39 /* PinLayout */ = { isa = PBXGroup; children = ( DFC97CA61E8A8F2C001545D5 /* PinLayout.swift */, - DFC97CA41E8A8EB3001545D5 /* PinLayoutImpl.swift */, DF11A3701E833F03008B33E5 /* Types.swift */, + DFA06B031E8B38B300B6D5E7 /* Impl */, DF11A3751E834194008B33E5 /* Extensions */, DF11A3761E8341A2008B33E5 /* Helpers */, ); - path = MCSwiftLayout; + path = PinLayout; sourceTree = ""; }; - 249EFE871E64FB4C00165E39 /* MCSwiftLayoutTests */ = { + 249EFE871E64FB4C00165E39 /* PinLayoutTests */ = { isa = PBXGroup; children = ( 2469C4FF1E75D74000073BEE /* AdjustSizeSpec.swift */, 2469C5011E75D88500073BEE /* BasicView.swift */, 249EFE8A1E64FB4C00165E39 /* Info.plist */, - 249EFE881E64FB4C00165E39 /* MCSwiftLayoutTests.swift */, + 249EFE881E64FB4C00165E39 /* PinLayoutTests.swift */, 244C6E141E776A0C0074FC74 /* MarginsAndInsetsSpec.swift */, 2469C4FB1E74855D00073BEE /* PinEdgeCoordinateSpec.swift */, 246D36471E6C46F50050F202 /* PinPointCoordinatesSpec.swift */, 2469C5031E75DB7600073BEE /* RectNimbleMatcher.swift */, 2482908B1E78CFFC00667D08 /* RelativePositionSpec.swift */, ); - path = MCSwiftLayoutTests; + path = PinLayoutTests; sourceTree = ""; }; DF11A3741E834181008B33E5 /* Supporting Files */ = { isa = PBXGroup; children = ( 249EFE7E1E64FB4C00165E39 /* Info.plist */, - 249EFE7D1E64FB4C00165E39 /* MCSwiftLayout.h */, + 249EFE7D1E64FB4C00165E39 /* PinLayout.h */, ); path = "Supporting Files"; sourceTree = ""; @@ -178,6 +178,14 @@ path = Helpers; sourceTree = ""; }; + DFA06B031E8B38B300B6D5E7 /* Impl */ = { + isa = PBXGroup; + children = ( + DFC97CA41E8A8EB3001545D5 /* PinLayoutImpl.swift */, + ); + name = Impl; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -185,16 +193,16 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 249EFE8B1E64FB4C00165E39 /* MCSwiftLayout.h in Headers */, + 249EFE8B1E64FB4C00165E39 /* PinLayout.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 249EFE791E64FB4C00165E39 /* MCSwiftLayout */ = { + 249EFE791E64FB4C00165E39 /* PinLayout */ = { isa = PBXNativeTarget; - buildConfigurationList = 249EFE8E1E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayout" */; + buildConfigurationList = 249EFE8E1E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "PinLayout" */; buildPhases = ( 249EFE751E64FB4C00165E39 /* Sources */, 249EFE761E64FB4C00165E39 /* Frameworks */, @@ -206,14 +214,14 @@ ); dependencies = ( ); - name = MCSwiftLayout; - productName = MCSwiftLayout; - productReference = 249EFE7A1E64FB4C00165E39 /* MCSwiftLayout.framework */; + name = PinLayout; + productName = PinLayout; + productReference = 249EFE7A1E64FB4C00165E39 /* PinLayout.framework */; productType = "com.apple.product-type.framework"; }; - 249EFE821E64FB4C00165E39 /* MCSwiftLayoutTests */ = { + 249EFE821E64FB4C00165E39 /* PinLayoutTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 249EFE911E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayoutTests" */; + buildConfigurationList = 249EFE911E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "PinLayoutTests" */; buildPhases = ( 249EFE7F1E64FB4C00165E39 /* Sources */, 249EFE801E64FB4C00165E39 /* Frameworks */, @@ -225,9 +233,9 @@ dependencies = ( 249EFE861E64FB4C00165E39 /* PBXTargetDependency */, ); - name = MCSwiftLayoutTests; - productName = MCSwiftLayoutTests; - productReference = 249EFE831E64FB4C00165E39 /* MCSwiftLayoutTests.xctest */; + name = PinLayoutTests; + productName = PinLayoutTests; + productReference = 249EFE831E64FB4C00165E39 /* PinLayoutTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -253,7 +261,7 @@ }; }; }; - buildConfigurationList = 249EFE741E64FB4C00165E39 /* Build configuration list for PBXProject "MCSwiftLayout" */; + buildConfigurationList = 249EFE741E64FB4C00165E39 /* Build configuration list for PBXProject "PinLayout" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -265,8 +273,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 249EFE791E64FB4C00165E39 /* MCSwiftLayout */, - 249EFE821E64FB4C00165E39 /* MCSwiftLayoutTests */, + 249EFE791E64FB4C00165E39 /* PinLayout */, + 249EFE821E64FB4C00165E39 /* PinLayoutTests */, ); }; /* End PBXProject section */ @@ -329,7 +337,7 @@ 2469C5021E75D88500073BEE /* BasicView.swift in Sources */, 246D36481E6C46F50050F202 /* PinPointCoordinatesSpec.swift in Sources */, 244C6E151E776A0C0074FC74 /* MarginsAndInsetsSpec.swift in Sources */, - 249EFE891E64FB4C00165E39 /* MCSwiftLayoutTests.swift in Sources */, + 249EFE891E64FB4C00165E39 /* PinLayoutTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -338,7 +346,7 @@ /* Begin PBXTargetDependency section */ 249EFE861E64FB4C00165E39 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 249EFE791E64FB4C00165E39 /* MCSwiftLayout */; + target = 249EFE791E64FB4C00165E39 /* PinLayout */; targetProxy = 249EFE851E64FB4C00165E39 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -457,7 +465,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayout; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayout; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -479,7 +487,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayout; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayout; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_VERSION = 3.0; @@ -495,9 +503,9 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = MCSwiftLayoutTests/Info.plist; + INFOPLIST_FILE = PinLayoutTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayoutTests; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayoutTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; @@ -512,9 +520,9 @@ "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = MCSwiftLayoutTests/Info.plist; + INFOPLIST_FILE = PinLayoutTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayoutTests; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayoutTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; @@ -523,7 +531,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 249EFE741E64FB4C00165E39 /* Build configuration list for PBXProject "MCSwiftLayout" */ = { + 249EFE741E64FB4C00165E39 /* Build configuration list for PBXProject "PinLayout" */ = { isa = XCConfigurationList; buildConfigurations = ( 249EFE8C1E64FB4C00165E39 /* Debug */, @@ -532,7 +540,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 249EFE8E1E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayout" */ = { + 249EFE8E1E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "PinLayout" */ = { isa = XCConfigurationList; buildConfigurations = ( 249EFE8F1E64FB4C00165E39 /* Debug */, @@ -541,7 +549,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 249EFE911E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayoutTests" */ = { + 249EFE911E64FB4C00165E39 /* Build configuration list for PBXNativeTarget "PinLayoutTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 249EFE921E64FB4C00165E39 /* Debug */, diff --git a/MCSwiftLayout.xcodeproj/xcshareddata/xcschemes/MCSwiftLayout.xcscheme b/PinLayout.xcodeproj/xcshareddata/xcschemes/PinLayout.xcscheme similarity index 76% rename from MCSwiftLayout.xcodeproj/xcshareddata/xcschemes/MCSwiftLayout.xcscheme rename to PinLayout.xcodeproj/xcshareddata/xcschemes/PinLayout.xcscheme index a7ec325e..cf3f6613 100644 --- a/MCSwiftLayout.xcodeproj/xcshareddata/xcschemes/MCSwiftLayout.xcscheme +++ b/PinLayout.xcodeproj/xcshareddata/xcschemes/PinLayout.xcscheme @@ -15,9 +15,9 @@ + BuildableName = "PinLayout.framework" + BlueprintName = "PinLayout" + ReferencedContainer = "container:PinLayout.xcodeproj"> @@ -34,9 +34,9 @@ + BuildableName = "PinLayoutTests.xctest" + BlueprintName = "PinLayoutTests" + ReferencedContainer = "container:PinLayout.xcodeproj"> @@ -44,9 +44,9 @@ + BuildableName = "PinLayout.framework" + BlueprintName = "PinLayout" + ReferencedContainer = "container:PinLayout.xcodeproj"> @@ -66,9 +66,9 @@ + BuildableName = "PinLayout.framework" + BlueprintName = "PinLayout" + ReferencedContainer = "container:PinLayout.xcodeproj"> @@ -84,9 +84,9 @@ + BuildableName = "PinLayout.framework" + BlueprintName = "PinLayout" + ReferencedContainer = "container:PinLayout.xcodeproj"> diff --git a/MCSwiftLayout/Extensions/UIView+PinLayout.swift b/PinLayout/Extensions/UIView+PinLayout.swift similarity index 70% rename from MCSwiftLayout/Extensions/UIView+PinLayout.swift rename to PinLayout/Extensions/UIView+PinLayout.swift index 08c5fe28..e2f32f58 100644 --- a/MCSwiftLayout/Extensions/UIView+PinLayout.swift +++ b/PinLayout/Extensions/UIView+PinLayout.swift @@ -1,10 +1,29 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// UIView+PinLayout.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2017-03-22. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. import UIKit diff --git a/MCSwiftLayout/Helpers/Coordinates.swift b/PinLayout/Helpers/Coordinates.swift similarity index 65% rename from MCSwiftLayout/Helpers/Coordinates.swift rename to PinLayout/Helpers/Coordinates.swift index 6742f66c..16000897 100644 --- a/MCSwiftLayout/Helpers/Coordinates.swift +++ b/PinLayout/Helpers/Coordinates.swift @@ -1,12 +1,31 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// View.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2017-03-22. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // - -import Foundation +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit internal class Coordinates { // static func top(_ view: UIView) -> CGFloat { diff --git a/MCSwiftLayout/PinLayout.swift b/PinLayout/PinLayout.swift similarity index 76% rename from MCSwiftLayout/PinLayout.swift rename to PinLayout/PinLayout.swift index 3861a066..82fe51e1 100644 --- a/MCSwiftLayout/PinLayout.swift +++ b/PinLayout/PinLayout.swift @@ -1,12 +1,31 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// PinLayout.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2017-03-28. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // - -import Foundation +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit public extension UIView { public var pin: PinLayout { diff --git a/MCSwiftLayout/PinLayoutImpl.swift b/PinLayout/PinLayoutImpl.swift similarity index 96% rename from MCSwiftLayout/PinLayoutImpl.swift rename to PinLayout/PinLayoutImpl.swift index c43abef3..c467d1de 100644 --- a/MCSwiftLayout/PinLayoutImpl.swift +++ b/PinLayout/PinLayoutImpl.swift @@ -1,11 +1,31 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// PinLayout.swift +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-17. -// Copyright © 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // -import UIKit +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +import UIKit /* =============================================== diff --git a/MCSwiftLayout/Types.swift b/PinLayout/Types.swift similarity index 71% rename from MCSwiftLayout/Types.swift rename to PinLayout/Types.swift index c87e51be..4b6c858c 100644 --- a/MCSwiftLayout/Types.swift +++ b/PinLayout/Types.swift @@ -1,12 +1,31 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// Types.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2017-03-22. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // - -import Foundation +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit typealias Context = () -> String typealias Size = (width: CGFloat?, height: CGFloat?) diff --git a/MCSwiftLayoutSample/.ruby-version b/PinLayoutSample/.ruby-version similarity index 100% rename from MCSwiftLayoutSample/.ruby-version rename to PinLayoutSample/.ruby-version diff --git a/MCSwiftLayoutSample/.swiftlint.yml b/PinLayoutSample/.swiftlint.yml similarity index 100% rename from MCSwiftLayoutSample/.swiftlint.yml rename to PinLayoutSample/.swiftlint.yml diff --git a/MCSwiftLayoutSample/Gemfile b/PinLayoutSample/Gemfile similarity index 100% rename from MCSwiftLayoutSample/Gemfile rename to PinLayoutSample/Gemfile diff --git a/MCSwiftLayoutSample/Gemfile.lock b/PinLayoutSample/Gemfile.lock similarity index 100% rename from MCSwiftLayoutSample/Gemfile.lock rename to PinLayoutSample/Gemfile.lock diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.pbxproj b/PinLayoutSample/PinLayoutSample.xcodeproj/project.pbxproj similarity index 86% rename from MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.pbxproj rename to PinLayoutSample/PinLayoutSample.xcodeproj/project.pbxproj index e1e61b11..c3bd1728 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample.xcodeproj/project.pbxproj +++ b/PinLayoutSample/PinLayoutSample.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 2439CC281E6658C3003326FB /* MCSwiftLayout.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2439CC241E665858003326FB /* MCSwiftLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 2439CC2B1E6658CC003326FB /* MCSwiftLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2439CC241E665858003326FB /* MCSwiftLayout.framework */; }; + 2439CC281E6658C3003326FB /* ReferenceProxy in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2439CC241E665858003326FB /* PinLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 2439CC2B1E6658CC003326FB /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 2439CC241E665858003326FB /* PinLayout.framework */; }; 2439CC351E665BF6003326FB /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2439CC331E665BF6003326FB /* MenuView.swift */; }; 2439CC361E665BF6003326FB /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2439CC341E665BF6003326FB /* MenuViewController.swift */; }; 2439CC4B1E665C6B003326FB /* BasicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2439CC381E665C6B003326FB /* BasicView.swift */; }; @@ -34,7 +34,7 @@ 24E6547A1E68F27D00A72A8B /* BothEdgesSnappedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E654781E68F27D00A72A8B /* BothEdgesSnappedView.swift */; }; 24E6547B1E68F27D00A72A8B /* BothEdgesSnappedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E654791E68F27D00A72A8B /* BothEdgesSnappedViewController.swift */; }; 24E654821E69041B00A72A8B /* Expect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E654811E69041B00A72A8B /* Expect.swift */; }; - DE6C3D736B571B80E207DF6A /* Pods_MCSwiftLayoutSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAD69688AA2A3F0994F3074E /* Pods_MCSwiftLayoutSample.framework */; }; + DE6C3D736B571B80E207DF6A /* Pods_PinLayoutSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAD69688AA2A3F0994F3074E /* Pods_PinLayoutSample.framework */; }; DF66F9DA1E8493E000ADB8D5 /* PinScrollingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF66F9D81E8493E000ADB8D5 /* PinScrollingView.swift */; }; DF66F9DB1E8493E000ADB8D5 /* PinScrollingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF66F9D91E8493E000ADB8D5 /* PinScrollingViewController.swift */; }; /* End PBXBuildFile section */ @@ -42,24 +42,24 @@ /* Begin PBXContainerItemProxy section */ 2439CC231E665858003326FB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */; + containerPortal = 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */; proxyType = 2; remoteGlobalIDString = 249EFE7A1E64FB4C00165E39; - remoteInfo = MCSwiftLayout; + remoteInfo = PinLayout; }; 2439CC251E665858003326FB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */; + containerPortal = 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */; proxyType = 2; remoteGlobalIDString = 249EFE831E64FB4C00165E39; - remoteInfo = MCSwiftLayoutTests; + remoteInfo = PinLayoutTests; }; 2439CC291E6658C3003326FB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */; + containerPortal = 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */; proxyType = 1; remoteGlobalIDString = 249EFE791E64FB4C00165E39; - remoteInfo = MCSwiftLayout; + remoteInfo = PinLayout; }; /* End PBXContainerItemProxy section */ @@ -70,7 +70,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 2439CC281E6658C3003326FB /* MCSwiftLayout.framework in Embed Frameworks */, + 2439CC281E6658C3003326FB /* ReferenceProxy in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -78,7 +78,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MCSwiftLayout.xcodeproj; path = ../MCSwiftLayout.xcodeproj; sourceTree = ""; }; + 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PinLayout.xcodeproj; path = ../PinLayout.xcodeproj; sourceTree = ""; }; 2439CC331E665BF6003326FB /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = ""; }; 2439CC341E665BF6003326FB /* MenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = ""; }; 2439CC381E665C6B003326FB /* BasicView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicView.swift; sourceTree = ""; }; @@ -98,7 +98,7 @@ 2439CC461E665C6B003326FB /* ValidateConflictsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidateConflictsViewController.swift; sourceTree = ""; }; 244C6E181E776ADB0074FC74 /* MarginsAndInsetsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarginsAndInsetsView.swift; sourceTree = ""; }; 244C6E191E776ADB0074FC74 /* MarginsAndInsetsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarginsAndInsetsViewController.swift; sourceTree = ""; }; - 249EFE3F1E64FAFE00165E39 /* MCSwiftLayoutSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MCSwiftLayoutSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 249EFE3F1E64FAFE00165E39 /* PinLayoutSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PinLayoutSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 249EFE421E64FAFE00165E39 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 249EFE491E64FAFE00165E39 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 249EFE4C1E64FAFE00165E39 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -106,11 +106,11 @@ 24E654781E68F27D00A72A8B /* BothEdgesSnappedView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BothEdgesSnappedView.swift; sourceTree = ""; }; 24E654791E68F27D00A72A8B /* BothEdgesSnappedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BothEdgesSnappedViewController.swift; sourceTree = ""; }; 24E654811E69041B00A72A8B /* Expect.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Expect.swift; sourceTree = ""; }; - AAD69688AA2A3F0994F3074E /* Pods_MCSwiftLayoutSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MCSwiftLayoutSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AAD69688AA2A3F0994F3074E /* Pods_PinLayoutSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PinLayoutSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DF66F9D81E8493E000ADB8D5 /* PinScrollingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PinScrollingView.swift; path = PinScrolling/PinScrollingView.swift; sourceTree = ""; }; DF66F9D91E8493E000ADB8D5 /* PinScrollingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PinScrollingViewController.swift; path = PinScrolling/PinScrollingViewController.swift; sourceTree = ""; }; - F121E291CADD796B007C04BB /* Pods-MCSwiftLayoutSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MCSwiftLayoutSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-MCSwiftLayoutSample/Pods-MCSwiftLayoutSample.release.xcconfig"; sourceTree = ""; }; - F1ACB0EACBD84B57B50D472D /* Pods-MCSwiftLayoutSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MCSwiftLayoutSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MCSwiftLayoutSample/Pods-MCSwiftLayoutSample.debug.xcconfig"; sourceTree = ""; }; + F121E291CADD796B007C04BB /* Pods-PinLayoutSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PinLayoutSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-PinLayoutSample/Pods-PinLayoutSample.release.xcconfig"; sourceTree = ""; }; + F1ACB0EACBD84B57B50D472D /* Pods-PinLayoutSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PinLayoutSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PinLayoutSample/Pods-PinLayoutSample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -118,8 +118,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2439CC2B1E6658CC003326FB /* MCSwiftLayout.framework in Frameworks */, - DE6C3D736B571B80E207DF6A /* Pods_MCSwiftLayoutSample.framework in Frameworks */, + 2439CC2B1E6658CC003326FB /* ReferenceProxy in Frameworks */, + DE6C3D736B571B80E207DF6A /* Pods_PinLayoutSample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -129,7 +129,7 @@ 160FB83905049FCEDD18DC8A /* Frameworks */ = { isa = PBXGroup; children = ( - AAD69688AA2A3F0994F3074E /* Pods_MCSwiftLayoutSample.framework */, + AAD69688AA2A3F0994F3074E /* Pods_PinLayoutSample.framework */, ); name = Frameworks; sourceTree = ""; @@ -137,8 +137,8 @@ 2439CC1F1E665858003326FB /* Products */ = { isa = PBXGroup; children = ( - 2439CC241E665858003326FB /* MCSwiftLayout.framework */, - 2439CC261E665858003326FB /* MCSwiftLayoutTests.xctest */, + 2439CC241E665858003326FB /* PinLayout.framework */, + 2439CC261E665858003326FB /* PinLayoutTests.xctest */, ); name = Products; sourceTree = ""; @@ -273,22 +273,22 @@ isa = PBXGroup; children = ( 160FB83905049FCEDD18DC8A /* Frameworks */, - 249EFE411E64FAFE00165E39 /* MCSwiftLayoutSample */, + 249EFE411E64FAFE00165E39 /* PinLayoutSample */, F143180314A617EFD07C5709 /* Pods */, 249EFE401E64FAFE00165E39 /* Products */, - 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */, + 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */, ); sourceTree = ""; }; 249EFE401E64FAFE00165E39 /* Products */ = { isa = PBXGroup; children = ( - 249EFE3F1E64FAFE00165E39 /* MCSwiftLayoutSample.app */, + 249EFE3F1E64FAFE00165E39 /* PinLayoutSample.app */, ); name = Products; sourceTree = ""; }; - 249EFE411E64FAFE00165E39 /* MCSwiftLayoutSample */ = { + 249EFE411E64FAFE00165E39 /* PinLayoutSample */ = { isa = PBXGroup; children = ( 24E654801E69040000A72A8B /* Domain */, @@ -296,7 +296,7 @@ 2439CC321E665BE3003326FB /* UI */, 249EFE421E64FAFE00165E39 /* AppDelegate.swift */, ); - path = MCSwiftLayoutSample; + path = PinLayoutSample; sourceTree = ""; }; 24E654761E68F20400A72A8B /* BothEdgesSnapped */ = { @@ -328,8 +328,8 @@ F143180314A617EFD07C5709 /* Pods */ = { isa = PBXGroup; children = ( - F1ACB0EACBD84B57B50D472D /* Pods-MCSwiftLayoutSample.debug.xcconfig */, - F121E291CADD796B007C04BB /* Pods-MCSwiftLayoutSample.release.xcconfig */, + F1ACB0EACBD84B57B50D472D /* Pods-PinLayoutSample.debug.xcconfig */, + F121E291CADD796B007C04BB /* Pods-PinLayoutSample.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -337,9 +337,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 249EFE3E1E64FAFE00165E39 /* MCSwiftLayoutSample */ = { + 249EFE3E1E64FAFE00165E39 /* PinLayoutSample */ = { isa = PBXNativeTarget; - buildConfigurationList = 249EFE671E64FAFE00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayoutSample" */; + buildConfigurationList = 249EFE671E64FAFE00165E39 /* Build configuration list for PBXNativeTarget "PinLayoutSample" */; buildPhases = ( DDE1EE639E8C959FEBC41FDC /* [CP] Check Pods Manifest.lock */, 249EFE3B1E64FAFE00165E39 /* Sources */, @@ -355,9 +355,9 @@ dependencies = ( 2439CC2A1E6658C3003326FB /* PBXTargetDependency */, ); - name = MCSwiftLayoutSample; - productName = MCSwiftLayoutSample; - productReference = 249EFE3F1E64FAFE00165E39 /* MCSwiftLayoutSample.app */; + name = PinLayoutSample; + productName = PinLayoutSample; + productReference = 249EFE3F1E64FAFE00165E39 /* PinLayoutSample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -377,7 +377,7 @@ }; }; }; - buildConfigurationList = 249EFE3A1E64FAFE00165E39 /* Build configuration list for PBXProject "MCSwiftLayoutSample" */; + buildConfigurationList = 249EFE3A1E64FAFE00165E39 /* Build configuration list for PBXProject "PinLayoutSample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -391,28 +391,28 @@ projectReferences = ( { ProductGroup = 2439CC1F1E665858003326FB /* Products */; - ProjectRef = 2439CC1E1E665858003326FB /* MCSwiftLayout.xcodeproj */; + ProjectRef = 2439CC1E1E665858003326FB /* PinLayout.xcodeproj */; }, ); projectRoot = ""; targets = ( - 249EFE3E1E64FAFE00165E39 /* MCSwiftLayoutSample */, + 249EFE3E1E64FAFE00165E39 /* PinLayoutSample */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 2439CC241E665858003326FB /* MCSwiftLayout.framework */ = { + 2439CC241E665858003326FB /* PinLayout.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = MCSwiftLayout.framework; + path = PinLayout.framework; remoteRef = 2439CC231E665858003326FB /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 2439CC261E665858003326FB /* MCSwiftLayoutTests.xctest */ = { + 2439CC261E665858003326FB /* PinLayoutTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; - path = MCSwiftLayoutTests.xctest; + path = PinLayoutTests.xctest; remoteRef = 2439CC251E665858003326FB /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -457,7 +457,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MCSwiftLayoutSample/Pods-MCSwiftLayoutSample-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PinLayoutSample/Pods-PinLayoutSample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; CCCCC7EE5AE16BA960D7DB4F /* [CP] Copy Pods Resources */ = { @@ -472,7 +472,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MCSwiftLayoutSample/Pods-MCSwiftLayoutSample-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PinLayoutSample/Pods-PinLayoutSample-resources.sh\"\n"; showEnvVarsInLog = 0; }; DDE1EE639E8C959FEBC41FDC /* [CP] Check Pods Manifest.lock */ = { @@ -487,7 +487,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -530,7 +530,7 @@ /* Begin PBXTargetDependency section */ 2439CC2A1E6658C3003326FB /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = MCSwiftLayout; + name = PinLayout; targetProxy = 2439CC291E6658C3003326FB /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -643,14 +643,14 @@ }; 249EFE681E64FAFE00165E39 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F1ACB0EACBD84B57B50D472D /* Pods-MCSwiftLayoutSample.debug.xcconfig */; + baseConfigurationReference = F1ACB0EACBD84B57B50D472D /* Pods-PinLayoutSample.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 4Q596JWQC5; - INFOPLIST_FILE = "MCSwiftLayoutSample/Supporting Files/Info.plist"; + INFOPLIST_FILE = "PinLayoutSample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayoutSample; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayoutSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; @@ -658,14 +658,14 @@ }; 249EFE691E64FAFE00165E39 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F121E291CADD796B007C04BB /* Pods-MCSwiftLayoutSample.release.xcconfig */; + baseConfigurationReference = F121E291CADD796B007C04BB /* Pods-PinLayoutSample.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 4Q596JWQC5; - INFOPLIST_FILE = "MCSwiftLayoutSample/Supporting Files/Info.plist"; + INFOPLIST_FILE = "PinLayoutSample/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mirego.MCSwiftLayoutSample; + PRODUCT_BUNDLE_IDENTIFIER = com.mirego.PinLayoutSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; @@ -674,7 +674,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 249EFE3A1E64FAFE00165E39 /* Build configuration list for PBXProject "MCSwiftLayoutSample" */ = { + 249EFE3A1E64FAFE00165E39 /* Build configuration list for PBXProject "PinLayoutSample" */ = { isa = XCConfigurationList; buildConfigurations = ( 249EFE651E64FAFE00165E39 /* Debug */, @@ -683,7 +683,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 249EFE671E64FAFE00165E39 /* Build configuration list for PBXNativeTarget "MCSwiftLayoutSample" */ = { + 249EFE671E64FAFE00165E39 /* Build configuration list for PBXNativeTarget "PinLayoutSample" */ = { isa = XCConfigurationList; buildConfigurations = ( 249EFE681E64FAFE00165E39 /* Debug */, diff --git a/PinLayoutSample/PinLayoutSample/AppDelegate.swift b/PinLayoutSample/PinLayoutSample/AppDelegate.swift new file mode 100644 index 00000000..7a53c2fc --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/AppDelegate.swift @@ -0,0 +1,44 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit +import PinLayout + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + + window = UIWindow(frame: UIScreen.main.bounds) + window!.backgroundColor = UIColor.white + window!.rootViewController = UINavigationController(rootViewController: MenuViewController()) + window!.makeKeyAndVisible() + + return true + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Assets.xcassets/AppIcon.appiconset/Contents.json b/PinLayoutSample/PinLayoutSample/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/Assets.xcassets/AppIcon.appiconset/Contents.json rename to PinLayoutSample/PinLayoutSample/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Base.lproj/LaunchScreen.storyboard b/PinLayoutSample/PinLayoutSample/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/Base.lproj/LaunchScreen.storyboard rename to PinLayoutSample/PinLayoutSample/Base.lproj/LaunchScreen.storyboard diff --git a/PinLayoutSample/PinLayoutSample/Domain/Expect.swift b/PinLayoutSample/PinLayoutSample/Domain/Expect.swift new file mode 100644 index 00000000..f6881020 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/Domain/Expect.swift @@ -0,0 +1,35 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +func expect(view: UIView, toMatchRect rect: CGRect) { + if view.frame != rect { + print("Doesn't match rect") + } +} + diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json b/PinLayoutSample/PinLayoutSample/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json rename to PinLayoutSample/PinLayoutSample/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Base.lproj/LaunchScreen.storyboard b/PinLayoutSample/PinLayoutSample/Supporting Files/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Base.lproj/LaunchScreen.storyboard rename to PinLayoutSample/PinLayoutSample/Supporting Files/Base.lproj/LaunchScreen.storyboard diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Info.plist b/PinLayoutSample/PinLayoutSample/Supporting Files/Info.plist similarity index 100% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/Supporting Files/Info.plist rename to PinLayoutSample/PinLayoutSample/Supporting Files/Info.plist diff --git a/PinLayoutSample/PinLayoutSample/UI/Common/BasicView.swift b/PinLayoutSample/PinLayoutSample/UI/Common/BasicView.swift new file mode 100644 index 00000000..551e6376 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Common/BasicView.swift @@ -0,0 +1,74 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class BasicView: UIView { + fileprivate let label = UILabel() + + init(text: String? = nil, color: UIColor) { + super.init(frame: .zero) + + backgroundColor = color + layer.borderWidth = 1 + layer.borderColor = UIColor.lightGray.cgColor + + label.text = text + label.font = UIFont.systemFont(ofSize: 7) + label.textColor = .white + label.sizeToFit() + addSubview(label) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + + label.pin.top(0).left(0) + } + + var sizeThatFitsExpectedArea: CGFloat = 40 * 40 + + override func sizeThatFits(_ size: CGSize) -> CGSize { + var newSize = CGSize() + if size.width != CGFloat.greatestFiniteMagnitude { + newSize.width = size.width + newSize.height = sizeThatFitsExpectedArea / newSize.width + } else if size.height != CGFloat.greatestFiniteMagnitude { + newSize.height = size.height + newSize.width = sizeThatFitsExpectedArea / newSize.height + } else { + newSize.width = 40 + newSize.height = sizeThatFitsExpectedArea / newSize.width + } + + return newSize + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuView.swift b/PinLayoutSample/PinLayoutSample/UI/Main/MenuView.swift similarity index 53% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuView.swift rename to PinLayoutSample/PinLayoutSample/UI/Main/MenuView.swift index b0b8e0ec..d7b004aa 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Main/MenuView.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MenuView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2016-09-03. -// Copyright © 2016 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit protocol MenuViewDelegate: class { diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Main/MenuViewController.swift similarity index 66% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuViewController.swift rename to PinLayoutSample/PinLayoutSample/UI/Main/MenuViewController.swift index 31cfbd01..057574cc 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Main/MenuViewController.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Main/MenuViewController.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MenuViewController.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2016-09-03. -// Copyright © 2016 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit enum Page: Int { diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift similarity index 93% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift index 7d902992..92b23376 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedView.swift @@ -1,12 +1,32 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// BothEdgesSnappedView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit -import MCSwiftLayout +import PinLayout class BothEdgesSnappedView: UIView { private let contentScrollView = UIScrollView() diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift new file mode 100644 index 00000000..2c87edf7 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/BothEdgesSnapped/BothEdgesSnappedViewController.swift @@ -0,0 +1,52 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class BothEdgesSnappedViewController: UIViewController { + fileprivate var mainView: BothEdgesSnappedView { + return self.view as! BothEdgesSnappedView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = BothEdgesSnappedView() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + + navigationController?.isNavigationBarHidden = true + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift similarity index 68% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift index 5b23cc3c..df89dfb9 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutView.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// ChainedLayoutView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-20. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit class ChainedLayoutView: UIView { diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift new file mode 100644 index 00000000..51550f04 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ChainedLayoutView/ChainedLayoutViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class ChainedLayoutViewController: UIViewController { + fileprivate var mainView: ChainedLayoutView? { + return self.view as? ChainedLayoutView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = ChainedLayoutView() + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift similarity index 80% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift index 42b3bf9e..21086600 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsView.swift @@ -1,12 +1,32 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MarginsAndInsetsView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit -import MCSwiftLayout +import PinLayout class MarginsAndInsetsView: UIView { private let contentScrollView = UIScrollView() diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift new file mode 100644 index 00000000..e7152f3c --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndInsets/MarginsAndInsetsViewController.swift @@ -0,0 +1,52 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class MarginsAndInsetsViewController: UIViewController { + fileprivate var mainView: MarginsAndInsetsView { + return self.view as! MarginsAndInsetsView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = MarginsAndInsetsView() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + + navigationController?.isNavigationBarHidden = true + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift similarity index 86% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift index 155f90d7..8e6cf7d1 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightView.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MarginsAndPaddingsLeftRightView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit class MarginsAndPaddingsLeftRightView: UIView { diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift new file mode 100644 index 00000000..1bb08547 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftRightView/MarginsAndPaddingsLeftRightViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class MarginsAndPaddingsLeftRightViewController: UIViewController { + fileprivate var mainView: MarginsAndPaddingsLeftRightView { + return self.view as! MarginsAndPaddingsLeftRightView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = MarginsAndPaddingsLeftRightView() + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift similarity index 83% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift index 4c465807..a667f081 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthView.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MarginsAndPaddingsLeftWidthView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-21. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit class MarginsAndPaddingsLeftWidthView: UIView { diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift new file mode 100644 index 00000000..57a928d4 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MarginsAndPaddingsLeftWidthView/MarginsAndPaddingsLeftWidthViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class MarginsAndPaddingsLeftWidthViewController: UIViewController { + fileprivate var mainView: MarginsAndPaddingsLeftWidthView { + return self.view as! MarginsAndPaddingsLeftWidthView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = MarginsAndPaddingsLeftWidthView() + } +} diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift new file mode 100644 index 00000000..e0448891 --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeView.swift @@ -0,0 +1,60 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class MultiRelativeView: UIView { + private let view1 = BasicView(text: "View1", color: UIColor.blue.withAlphaComponent(0.6)) + private let view2 = BasicView(text: "View2", color: UIColor.blue.withAlphaComponent(0.6)) + private let view = BasicView(text: "View", color: UIColor.blue.withAlphaComponent(1.0)) + + init() { + super.init(frame: .zero) + backgroundColor = .white + + addSubview(view1) + addSubview(view2) + addSubview(view) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + func configure() { + + } + + override func layoutSubviews() { + super.layoutSubviews() + + view1.pin.top(64).left(10).width(100).height(100) + view2.pin.right(of: view1, aligned: .top).marginLeft(150).width(100).height(100) + + view.pin.right(of: view1, aligned: .top).left(of: view2).height(75).insetLeft(10).insetRight(10) + } +} diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift new file mode 100644 index 00000000..0f4fd07d --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/MultiRelativeView/MultiRelativeViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class MultiRelativeViewController: UIViewController { + fileprivate var mainView: MultiRelativeView { + return self.view as! MultiRelativeView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = MultiRelativeView() + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift similarity index 54% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift index 365e64cf..6cda97b8 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingView.swift @@ -1,10 +1,30 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// PinScrollingView.swift -// MCSwiftLayoutSample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by Luc Dion on 2017-03-23. -// Copyright (c) 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit class PinScrollingView: UIView { diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift new file mode 100644 index 00000000..4e5c198d --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/PinScrolling/PinScrollingViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class PinScrollingViewController: UIViewController { + fileprivate var mainView: PinScrollingView { + return self.view as! PinScrollingView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + override func loadView() { + view = PinScrollingView() + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeView.swift similarity index 67% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeView.swift index 3f4fb6ef..a54d67d4 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/RelativeView/RelativeView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeView.swift @@ -1,11 +1,32 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// RelativeView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-22. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit +import PinLayout class RelativeView: UIView { fileprivate let belowNavBarView = BasicView(text: "Below navbar", color: UIColor.lightGray) diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift new file mode 100644 index 00000000..86ea6f3c --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/RelativeView/RelativeViewController.swift @@ -0,0 +1,52 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class RelativeViewController: UIViewController { + fileprivate var mainView: RelativeView { + return self.view as! RelativeView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = RelativeView() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + + navigationController?.isNavigationBarHidden = true + } +} diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift new file mode 100644 index 00000000..5b2ff8bd --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsView.swift @@ -0,0 +1,56 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class ValidateConflictsView: UIView { + private let topLeftView = UIView() + + init() { + super.init(frame: .zero) + + backgroundColor = .white + + addSquare(topLeftView, color: .green) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + fileprivate func addSquare(_ view: UIView, color: UIColor) { + view.backgroundColor = color + view.pin.width(50).height(50) + addSubview(view) + } + + override func layoutSubviews() { + super.layoutSubviews() + + topLeftView.pin.right(10).width(20).top(10).left(10).left(10) + } +} diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift new file mode 100644 index 00000000..5fe2d16c --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ValidateConflictsView/ValidateConflictsViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class ValidateConflictsViewController: UIViewController { + fileprivate var mainView: ValidateConflictsView { + return self.view as! ValidateConflictsView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = ValidateConflictsView() + } +} diff --git a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift similarity index 63% rename from MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift rename to PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift index d05cb15f..0432a890 100644 --- a/MCSwiftLayoutSample/MCSwiftLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningView.swift @@ -1,11 +1,32 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// ViewExtensionsPositionningView.swift -// MCLayoutExample +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-02-17. -// Copyright (c) 2017 Mirego. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import UIKit +import PinLayout class ViewExtensionsPositionningView: UIView { private let centerView = UIView() diff --git a/PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift b/PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift new file mode 100644 index 00000000..9c095dff --- /dev/null +++ b/PinLayoutSample/PinLayoutSample/UI/Tests/ViewExtensionsPositionningView/ViewExtensionsPositionningViewController.swift @@ -0,0 +1,46 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class ViewExtensionsPositionningViewController: UIViewController { + fileprivate var mainView: ViewExtensionsPositionningView { + return self.view as! ViewExtensionsPositionningView + } + + init() { + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func loadView() { + view = ViewExtensionsPositionningView() + } +} diff --git a/PinLayoutSample/Podfile b/PinLayoutSample/Podfile new file mode 100644 index 00000000..32e15344 --- /dev/null +++ b/PinLayoutSample/Podfile @@ -0,0 +1,18 @@ +use_frameworks! + +workspace 'PinLayoutSample.xcworkspace' + +target 'PinLayoutSample' do + project 'PinLayoutSample.xcodeproj' + #pod 'YogaKit', '~> 1.1' + + # Debug only + pod 'Reveal-SDK', :configurations => ['Debug'] + pod 'SwiftLint' +end + +#target 'PinLayoutTests' do +# project '../PinLayout.xcodeproj' +# pod 'Quick' +# pod 'Nimble' +#end diff --git a/MCSwiftLayoutSample/Podfile.lock b/PinLayoutSample/Podfile.lock similarity index 74% rename from MCSwiftLayoutSample/Podfile.lock rename to PinLayoutSample/Podfile.lock index f68d7417..ac6980b6 100644 --- a/MCSwiftLayoutSample/Podfile.lock +++ b/PinLayoutSample/Podfile.lock @@ -10,6 +10,6 @@ SPEC CHECKSUMS: Reveal-SDK: 564657bc66c93d2718b1c0121cdebe99d354ddab SwiftLint: b8b683208cc09640898f16318a7a452274e91f61 -PODFILE CHECKSUM: a519712d8423f43c5e84c3689639b0c066b8d044 +PODFILE CHECKSUM: 59a9a3ad8ae4f0bb64a6dadf661a354de61b0d83 -COCOAPODS: 1.0.1 +COCOAPODS: 1.1.1 diff --git a/MCSwiftLayoutTests/AdjustSizeSpec.swift b/PinLayoutTests/AdjustSizeSpec.swift similarity index 89% rename from MCSwiftLayoutTests/AdjustSizeSpec.swift rename to PinLayoutTests/AdjustSizeSpec.swift index ba092f88..b2678c60 100644 --- a/MCSwiftLayoutTests/AdjustSizeSpec.swift +++ b/PinLayoutTests/AdjustSizeSpec.swift @@ -1,13 +1,33 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// AdjustSizeSpec.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-03-05. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import Quick import Nimble -import MCSwiftLayout +import PinLayout class AdjustSizeSpec: QuickSpec { override func spec() { diff --git a/PinLayoutTests/BasicView.swift b/PinLayoutTests/BasicView.swift new file mode 100644 index 00000000..551e6376 --- /dev/null +++ b/PinLayoutTests/BasicView.swift @@ -0,0 +1,74 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import UIKit + +class BasicView: UIView { + fileprivate let label = UILabel() + + init(text: String? = nil, color: UIColor) { + super.init(frame: .zero) + + backgroundColor = color + layer.borderWidth = 1 + layer.borderColor = UIColor.lightGray.cgColor + + label.text = text + label.font = UIFont.systemFont(ofSize: 7) + label.textColor = .white + label.sizeToFit() + addSubview(label) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + + label.pin.top(0).left(0) + } + + var sizeThatFitsExpectedArea: CGFloat = 40 * 40 + + override func sizeThatFits(_ size: CGSize) -> CGSize { + var newSize = CGSize() + if size.width != CGFloat.greatestFiniteMagnitude { + newSize.width = size.width + newSize.height = sizeThatFitsExpectedArea / newSize.width + } else if size.height != CGFloat.greatestFiniteMagnitude { + newSize.height = size.height + newSize.width = sizeThatFitsExpectedArea / newSize.height + } else { + newSize.width = 40 + newSize.height = sizeThatFitsExpectedArea / newSize.width + } + + return newSize + } +} diff --git a/MCSwiftLayoutTests/Info.plist b/PinLayoutTests/Info.plist similarity index 100% rename from MCSwiftLayoutTests/Info.plist rename to PinLayoutTests/Info.plist diff --git a/MCSwiftLayoutTests/MarginsAndInsetsSpec.swift b/PinLayoutTests/MarginsAndInsetsSpec.swift similarity index 92% rename from MCSwiftLayoutTests/MarginsAndInsetsSpec.swift rename to PinLayoutTests/MarginsAndInsetsSpec.swift index 842729fd..71662a6c 100644 --- a/MCSwiftLayoutTests/MarginsAndInsetsSpec.swift +++ b/PinLayoutTests/MarginsAndInsetsSpec.swift @@ -1,13 +1,33 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// MarginsAndInsetsSpec.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-03-05. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import Quick import Nimble -import MCSwiftLayout +import PinLayout class MarginsAndInsetsSpec: QuickSpec { override func spec() { diff --git a/MCSwiftLayoutTests/PinEdgeCoordinateSpec.swift b/PinLayoutTests/PinEdgeCoordinateSpec.swift similarity index 84% rename from MCSwiftLayoutTests/PinEdgeCoordinateSpec.swift rename to PinLayoutTests/PinEdgeCoordinateSpec.swift index 6d7f02ac..07f5ba01 100644 --- a/MCSwiftLayoutTests/PinEdgeCoordinateSpec.swift +++ b/PinLayoutTests/PinEdgeCoordinateSpec.swift @@ -1,13 +1,33 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// PinEdgeCoordinateSpec.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-03-05. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import Quick import Nimble -import MCSwiftLayout +import PinLayout class PinEdgeCoordinateSpec: QuickSpec { override func spec() { diff --git a/PinLayoutTests/PinLayoutTests.swift b/PinLayoutTests/PinLayoutTests.swift new file mode 100644 index 00000000..0562bd34 --- /dev/null +++ b/PinLayoutTests/PinLayoutTests.swift @@ -0,0 +1,63 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import XCTest +@testable import PinLayout + +class PinLayoutTests: XCTestCase { + var viewController: UIViewController! + var rootView: UIView! + + override func setUp() { + super.setUp() + + viewController = UIViewController() + + rootView = UIView() + rootView.frame = CGRect(x: 0, y: 0, width: 100, height: 100) + viewController.view.addSubview(rootView) + } + + func testExample() { + let child1 = UIView() + rootView.addSubview(child1) + +// pin(rootView).topLeft(to: child1.pin.center) +// rootView.pin.topLeft(to: child1.pin.center) + +// child1.pin.pinCenter(of: rootView) +// print("child1.frame: \(child1.frame)") + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/MCSwiftLayoutTests/PinPointCoordinatesSpec.swift b/PinLayoutTests/PinPointCoordinatesSpec.swift similarity index 91% rename from MCSwiftLayoutTests/PinPointCoordinatesSpec.swift rename to PinLayoutTests/PinPointCoordinatesSpec.swift index aa3b1a04..2ea228ec 100644 --- a/MCSwiftLayoutTests/PinPointCoordinatesSpec.swift +++ b/PinLayoutTests/PinPointCoordinatesSpec.swift @@ -1,13 +1,33 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// PinPointCoordinatesSpec.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-03-05. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import Quick import Nimble -import MCSwiftLayout +import PinLayout class PinPointCoordinatesSpec: QuickSpec { override func spec() { diff --git a/PinLayoutTests/RectNimbleMatcher.swift b/PinLayoutTests/RectNimbleMatcher.swift new file mode 100644 index 00000000..76b49b5c --- /dev/null +++ b/PinLayoutTests/RectNimbleMatcher.swift @@ -0,0 +1,58 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import Nimble +import UIKit + +public func beCloseTo(_ expectedValues: CGRect, within delta: CGFloat = 0.00001) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be close to CGRect <\(stringify(expectedValues))> (each within \(stringify(delta)))" + if let actual = try actualExpression.evaluate() { + failureMessage.actualValue = "<\(stringify(actual))>" + + if fabs(actual.origin.x - expectedValues.origin.x) > delta { + return false + } + + if fabs(actual.origin.y - expectedValues.origin.y) > delta { + return false + } + + if fabs(actual.size.width - expectedValues.size.width) > delta { + return false + } + + if fabs(actual.size.height - expectedValues.size.height) > delta { + return false + } + + return true + } + + return false + } +} diff --git a/MCSwiftLayoutTests/RelativePositionSpec.swift b/PinLayoutTests/RelativePositionSpec.swift similarity index 87% rename from MCSwiftLayoutTests/RelativePositionSpec.swift rename to PinLayoutTests/RelativePositionSpec.swift index 938ba414..fda79a6e 100644 --- a/MCSwiftLayoutTests/RelativePositionSpec.swift +++ b/PinLayoutTests/RelativePositionSpec.swift @@ -1,13 +1,33 @@ +// Copyright (c) 2017, Mirego +// All rights reserved. // -// RelativePositionSpec.swift -// MCSwiftLayout +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// Created by DION, Luc (MTL) on 2017-03-05. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// - Neither the name of the Mirego nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. // +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + import Quick import Nimble -import MCSwiftLayout +import PinLayout class RelativePositionSpec: QuickSpec { override func spec() { diff --git a/Supporting Files/MCSwiftLayout.h b/Supporting Files/MCSwiftLayout.h deleted file mode 100644 index f8fd9979..00000000 --- a/Supporting Files/MCSwiftLayout.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// MCSwiftLayout.h -// MCSwiftLayout -// -// Created by DION, Luc (MTL) on 2017-02-27. -// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. -// - -#import - -//! Project version number for MCSwiftLayout. -FOUNDATION_EXPORT double MCSwiftLayoutVersionNumber; - -//! Project version string for MCSwiftLayout. -FOUNDATION_EXPORT const unsigned char MCSwiftLayoutVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Supporting Files/PinLayout.h b/Supporting Files/PinLayout.h new file mode 100644 index 00000000..c0606801 --- /dev/null +++ b/Supporting Files/PinLayout.h @@ -0,0 +1,19 @@ +// +// PinLayout.h +// PinLayout +// +// Created by DION, Luc (MTL) on 2017-02-27. +// Copyright © 2017 mcswiftlayyout.mirego.com. All rights reserved. +// + +#import + +//! Project version number for PinLayout. +FOUNDATION_EXPORT double PinLayoutVersionNumber; + +//! Project version string for PinLayout. +FOUNDATION_EXPORT const unsigned char PinLayoutVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/scripts/synx.sh b/scripts/synx.sh index 766decfb..cb33205b 100755 --- a/scripts/synx.sh +++ b/scripts/synx.sh @@ -1,2 +1,2 @@ #!/bin/bash -synx --no-sort-by-name MCSwiftLayout.xcodeproj +synx --no-sort-by-name PinLayout.xcodeproj