├── CBuilder ├── Demo │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ └── App │ │ ├── ViewController.swift │ │ ├── View.swift │ │ └── AppDelegate.swift ├── Source │ ├── LayoutAnchor.swift │ ├── LayoutProxy.swift │ ├── LayoutProperty.swift │ ├── LayoutAnchor+operations.swift │ └── CBuilder.swift ├── Info.plist └── Base.lproj │ └── LaunchScreen.storyboard ├── CBuilder.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── viniciusmangueira.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── .travis.yml ├── CBuilderTests ├── Info.plist └── CBuilderTests.swift ├── CBuilder.podspec ├── LICENSE ├── Package.swift ├── .gitignore └── README.md /CBuilder/Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CBuilder.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: osx 2 | language: objective-c 3 | osx_image: xcode10.2 4 | script: 5 | - set -o pipefail && xcodebuild build -project CBuilder.xcodeproj -scheme CBuilder -sdk iphonesimulator12.2 -destination 'name=iPhone 6,OS=12.2' ONLY_ACTIVE_ARCH=NO | xcpretty 6 | -------------------------------------------------------------------------------- /CBuilder.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CBuilder.xcodeproj/xcuserdata/viniciusmangueira.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CBuilder.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CBuilder/Demo/App/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CBuilder 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | let myView = View() 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | view.addSubview(myView) 18 | view.backgroundColor = .white 19 | myView.cBuild(make: .fillSuperview) 20 | print(myView.constraints) 21 | 22 | // myView.cBuild(make: .desactiveAllConstraints) 23 | print(myView.constraints) 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /CBuilderTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CBuilder/Source/LayoutAnchor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LayoutAnchor.swift 3 | // CBuilder 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol LayoutAnchor { 12 | func constraint(equalTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint 13 | func constraint(greaterThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint 14 | func constraint(lessThanOrEqualTo anchor: Self, constant: CGFloat) -> NSLayoutConstraint 15 | } 16 | 17 | protocol DimensionAnchor: LayoutAnchor { 18 | func constraint(equalTo anchor: Self, multiplier: CGFloat) -> NSLayoutConstraint 19 | func constraint(equalToConstant c: CGFloat) -> NSLayoutConstraint 20 | } 21 | 22 | extension NSLayoutAnchor: LayoutAnchor {} 23 | 24 | extension NSLayoutDimension: DimensionAnchor {} 25 | -------------------------------------------------------------------------------- /CBuilder.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "CBuilder" 3 | s.version = "0.2.0" 4 | s.summary = "A Swift Autolayout DSL for iOS" 5 | s.description = <<-DESC 6 | Super sweet syntactic sugar for Constraints in UIKit. 7 | A Swift Autolayout DSL for iOS 8 | DESC 9 | s.homepage = "https://github.com/ViniciusDeep/CBuilder" 10 | s.license = 'MIT' 11 | s.author = { "Vinicius Mangueira " => "email-here" } 12 | s.source = { :git => "https://github.com/ViniciusDeep/CBuilder.git", :tag => s.version.to_s } 13 | 14 | s.requires_arc = true 15 | 16 | s.ios.deployment_target = '9.0' 17 | 18 | s.source_files = 'CBuilder/Source/**/*.swift' 19 | s.swift_version = '5.0' 20 | 21 | s.test_spec 'Tests' do |test_spec| 22 | test_spec.source_files = 'CBuilderTests/**/*.swift' 23 | end 24 | 25 | end 26 | 27 | -------------------------------------------------------------------------------- /CBuilder/Demo/App/View.swift: -------------------------------------------------------------------------------- 1 | // 2 | // View.swift 3 | // CBuilder 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class View: UIView { 12 | 13 | let label: UILabel = { 14 | let lb = UILabel() 15 | lb.translatesAutoresizingMaskIntoConstraints = false 16 | lb.text = "CBuilder is good" 17 | lb.backgroundColor = .red 18 | return lb 19 | }() 20 | 21 | override init(frame: CGRect) { 22 | super.init(frame: frame) 23 | addSubview(label) 24 | label.cBuild { (layout) in 25 | layout.centerX == self.centerXAnchor 26 | layout.centerY == self.centerYAnchor 27 | layout.height == 200 28 | layout.width == self.widthAnchor / 2 29 | } 30 | } 31 | 32 | required init?(coder aDecoder: NSCoder) { 33 | fatalError("init(coder:) has not been implemented") 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CBuilder/Demo/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CBuilder 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | 19 | window = UIWindow(frame: UIScreen.main.bounds) 20 | window?.makeKeyAndVisible() 21 | window?.rootViewController = ViewController() 22 | return true 23 | } 24 | 25 | func applicationWillResignActive(_ application: UIApplication) {} 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) {} 28 | 29 | func applicationWillEnterForeground(_ application: UIApplication) {} 30 | 31 | func applicationDidBecomeActive(_ application: UIApplication) {} 32 | 33 | func applicationWillTerminate(_ application: UIApplication) {} 34 | } 35 | 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Vinicius Mangueira 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CBuilder/Source/LayoutProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LayoutProxy.swift 3 | // CBuilder 4 | // 5 | // Created by Elias Paulino on 07/09/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class LayoutProxy { 13 | lazy var leading = property(with: view.leadingAnchor) 14 | lazy var trailing = property(with: view.trailingAnchor) 15 | lazy var top = property(with: view.topAnchor) 16 | lazy var bottom = property(with: view.bottomAnchor) 17 | lazy var width = property(with: view.widthAnchor) 18 | lazy var height = property(with: view.heightAnchor) 19 | lazy var centerX = property(with: view.centerXAnchor) 20 | lazy var centerY = property(with: view.centerYAnchor) 21 | 22 | private let view: UIView 23 | 24 | init(view: UIView) { 25 | self.view = view 26 | } 27 | 28 | private func property(with anchor: A) -> LayoutDimensionProperty { 29 | return LayoutDimensionProperty(anchor: anchor) 30 | } 31 | 32 | private func property(with anchor: A) -> LayoutProperty { 33 | return LayoutProperty(anchor: anchor) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "CBuilder", 8 | platforms: [ 9 | .iOS("9.0") 10 | ], 11 | products: [ 12 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 13 | .library( 14 | name: "CBuilder", 15 | targets: ["CBuilder"]), 16 | ], 17 | dependencies: [ 18 | // Dependencies declare other packages that this package depends on. 19 | // .package(url: /* package url */, from: "1.0.0"), 20 | ], 21 | targets: [ 22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 23 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 24 | .target( 25 | name: "CBuilder", 26 | dependencies: [], 27 | path: "CBuilder/Source"), 28 | .testTarget( 29 | name: "CBuilderTests", 30 | dependencies: ["CBuilder"], 31 | path: "CBuilderTests" 32 | ) 33 | ], 34 | swiftLanguageVersions: [ 35 | .v5 36 | ] 37 | ) 38 | -------------------------------------------------------------------------------- /CBuilder/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CBuilder/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # DS_STORE # 36 | ###################### 37 | .DS_Store 38 | .DS_Store? 39 | ._* 40 | 41 | 42 | # Swift Package Manager 43 | # 44 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 45 | # Packages/ 46 | # Package.pins 47 | # Package.resolved 48 | .build/ 49 | 50 | # CocoaPods 51 | # 52 | # We recommend against adding the Pods directory to your .gitignore. However 53 | # you should judge for yourself, the pros and cons are mentioned at: 54 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 55 | # 56 | Pods/ 57 | 58 | # Carthage 59 | # 60 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 61 | # Carthage/Checkouts 62 | 63 | Carthage/Build 64 | 65 | # fastlane 66 | # 67 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 68 | # screenshots whenever they are needed. 69 | # For more information about the recommended setup visit: 70 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 71 | 72 | fastlane/report.xml 73 | fastlane/Preview.html 74 | fastlane/screenshots/**/*.png 75 | fastlane/test_output 76 | 77 | -------------------------------------------------------------------------------- /CBuilder/Source/LayoutProperty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LayoutProperty.swift 3 | // CBuilder 4 | // 5 | // Created by Elias Paulino on 07/09/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | /// Represents a property assigned to a Anchor 13 | protocol LayoutPropertyProtocol { 14 | associatedtype Anchor: LayoutAnchor 15 | 16 | var anchor: Anchor { get set } 17 | init(anchor: Anchor) 18 | } 19 | 20 | extension LayoutPropertyProtocol where Anchor: LayoutAnchor { 21 | func equal(to otherAnchor: Anchor, offsetBy constant: CGFloat = 0) { 22 | anchor.constraint(equalTo: otherAnchor, 23 | constant: constant).isActive = true 24 | } 25 | 26 | func greaterThanOrEqual(to otherAnchor: Anchor, 27 | offsetBy constant: CGFloat = 0) { 28 | anchor.constraint(greaterThanOrEqualTo: otherAnchor, 29 | constant: constant).isActive = true 30 | } 31 | 32 | func lessThanOrEqual(to otherAnchor: Anchor, 33 | offsetBy constant: CGFloat = 0) { 34 | anchor.constraint(lessThanOrEqualTo: otherAnchor, 35 | constant: constant).isActive = true 36 | } 37 | } 38 | 39 | extension LayoutPropertyProtocol where Anchor: DimensionAnchor { 40 | func equal(to otherAnchor: Anchor, multiplier: CGFloat) { 41 | anchor.constraint(equalTo: otherAnchor, multiplier: multiplier).isActive = true 42 | } 43 | 44 | func equal(to constant: CGFloat) { 45 | anchor.constraint(equalToConstant: constant).isActive = true 46 | } 47 | } 48 | 49 | struct LayoutProperty: LayoutPropertyProtocol { 50 | var anchor: Anchor 51 | } 52 | 53 | struct LayoutDimensionProperty: LayoutPropertyProtocol { 54 | var anchor: Anchor 55 | } 56 | -------------------------------------------------------------------------------- /CBuilderTests/CBuilderTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CBuilderTests.swift 3 | // CBuilderTests 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import CBuilder 11 | 12 | class CBuilderTests: XCTestCase { 13 | 14 | let mainView = UIView(frame: UIScreen.main.bounds) 15 | 16 | /// Test at subviews 17 | func testAddSubViews() { 18 | let stubView = UIView(frame: .zero) 19 | let scrubView = UIView(frame: .zero) 20 | 21 | 22 | mainView.addSubviews([stubView, scrubView]) 23 | 24 | let subViews = [stubView, scrubView] 25 | 26 | 27 | let subviews = mainView.subviews.map({$0}) 28 | 29 | XCTAssertEqual(subViews, subviews) 30 | } 31 | 32 | func testStaticMethodsConstraintsAtView() { 33 | let scrub = UIView() 34 | mainView.addSubviews([scrub]) 35 | scrub.cBuild(make: .fillSuperview) 36 | XCTAssertNotNil(scrub.constraints) 37 | } 38 | 39 | func testDSLClosureConstructor() { 40 | 41 | } 42 | 43 | override func setUp() { 44 | // Put setup code here. This method is called before the invocation of each test method in the class. 45 | } 46 | 47 | override func tearDown() { 48 | // Put teardown code here. This method is called after the invocation of each test method in the class. 49 | } 50 | 51 | func testExample() { 52 | // This is an example of a functional test case. 53 | // Use XCTAssert and related functions to verify your tests produce the correct results. 54 | } 55 | 56 | func testPerformanceExample() { 57 | // This is an example of a performance test case. 58 | self.measure { 59 | // Put the code you want to measure the time of here. 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /CBuilder/Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CBuilder/Source/LayoutAnchor+operations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LayoutAnchor+operations.swift 3 | // CBuilder 4 | // 5 | // Created by Elias Paulino on 07/09/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | 13 | // Operator overloading 14 | 15 | // SUM 16 | func +(lhs: A, rhs: CGFloat) -> (A, sum: CGFloat) { 17 | return (lhs, rhs) 18 | } 19 | 20 | func -(lhs: A, rhs: CGFloat) -> (A, sum: CGFloat) { 21 | return (lhs, -rhs) 22 | } 23 | 24 | 25 | //MULTIPLICATON 26 | func *(lhs: A, rhs: CGFloat) -> (A, mult: CGFloat) { 27 | return (lhs, rhs) 28 | } 29 | 30 | func /(lhs: A, rhs: CGFloat) -> (A, mult: CGFloat) { 31 | return (lhs, 1/rhs) 32 | } 33 | 34 | //EQUALITY 35 | 36 | func ==(lhs: LayoutDimensionProperty, rhs: CGFloat) { 37 | lhs.equal(to: rhs) 38 | } 39 | 40 | func ==(lhs: LayoutDimensionProperty, rhs: (A, mult: CGFloat)) { 41 | lhs.equal(to: rhs.0, multiplier: rhs.mult) 42 | } 43 | 44 | func ==(lhs: LayoutDimensionProperty, rhs: (A, sum: CGFloat)) { 45 | lhs.equal(to: rhs.0, offsetBy: rhs.sum) 46 | } 47 | 48 | func ==(lhs: LayoutDimensionProperty, rhs: A) { 49 | lhs.equal(to: rhs) 50 | } 51 | 52 | func ==(lhs: LayoutProperty, rhs: (A, sum: CGFloat)) { 53 | lhs.equal(to: rhs.0, offsetBy: rhs.sum) 54 | } 55 | 56 | func ==(lhs: LayoutProperty, rhs: A) { 57 | lhs.equal(to: rhs) 58 | } 59 | 60 | //GREATHER THEN 61 | 62 | func >=(lhs: LayoutProperty, 63 | rhs: (A, CGFloat)) { 64 | lhs.greaterThanOrEqual(to: rhs.0, offsetBy: rhs.1) 65 | } 66 | 67 | func >=(lhs: LayoutProperty, rhs: A) { 68 | lhs.greaterThanOrEqual(to: rhs) 69 | } 70 | 71 | //LESS THEN 72 | 73 | func <=(lhs: LayoutProperty, 74 | rhs: (A, CGFloat)) { 75 | lhs.lessThanOrEqual(to: rhs.0, offsetBy: rhs.1) 76 | } 77 | 78 | func <=(lhs: LayoutProperty, rhs: A) { 79 | lhs.lessThanOrEqual(to: rhs) 80 | } 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CBuilder 2 | 3 |

4 | Screen Shot 2019-08-28 at 22 25 25 5 |

6 | 7 | ![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg) 8 | [![Build Status](https://travis-ci.org/ViniciusDeep/CBuilder.svg?branch=master)](https://travis-ci.org/ViniciusDeep/CBuilder) 9 | 10 | 11 | 12 | ✨ Super sweet syntactic sugar for Constraints in UIKit. 13 | 14 | ✨ A Swift Autolayout DSL for iOS 15 | 16 | 17 | ## At a Glance 18 | 19 | ### Before 20 | 21 | ```swift 22 | //In your controller 23 | let myView = View() 24 | 25 | view.addSubview(myView) 26 | 27 | 28 | myView.translatesAutoresizingMaskIntoConstraints = false 29 | 30 | NSLayoutConstraint.activate([ 31 | myView.topAnchor.constraint(equalTo: view.topAnchor), 32 | myView.leadingAnchor.constraint(equalTo: view.leadingAnchor), 33 | myView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 34 | myView.trailingAnchor.constraint(equalTo: view.trailingAnchor) 35 | ]) 36 | } 37 | ``` 38 | 39 | ### Then: 40 | 41 | ```swift 42 | view.addSubview(myView) 43 | myView.cBuild(make: .fillSuperview) 44 | 45 | ``` 46 | 47 | ## Small Advantages 48 | 49 | - You can use `closure` to construct the constraint to your view. 50 | 51 | ```swift 52 | label.cBuilder { 53 | $0.leading.equal(to: leadingAnchor, offsetBy: 20) 54 | $0.top.equal(to: topAnchor, offsetBy: 10) 55 | } 56 | ``` 57 | 58 | - Want to set your constraints with your own types? Just make that 59 | 60 | ```swift 61 | label.cBuild(top: topAnchor, bottom: bottomAnchor, left: leadingAnchor, right: trailingAnchor) 62 | ``` 63 | 64 | - A lot times you have set the view in center to super view, so... 65 | 66 | ```swift 67 | label.cBuild(make: .centerInSuperView) 68 | ``` 69 | 70 | 71 | ## Installation 72 | 1. `Clone project` 73 | 2. Open your Xcode, select a simulator, click the play button or `cmd + R` 74 | 3. Test in your cases, and don't worry to use `TranslateAutoRezingsMas.............................` 75 | 76 | ### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) 77 | 78 | ```ruby 79 | # Podfile 80 | use_frameworks! 81 | 82 | target 'YOUR_TARGET_NAME' do 83 | pod 'CBuilder' 84 | end 85 | ``` 86 | 87 | Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type: 88 | 89 | ```bash 90 | $ pod install 91 | ``` 92 | 93 | 94 | ## License 95 | 96 | **CBuilder** is under MIT license. See the [LICENSE](LICENSE) file for more info. 97 | -------------------------------------------------------------------------------- /CBuilder/Source/CBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CBuilder.swift 3 | // CBuilder 4 | // 5 | // Created by Vinicius Mangueira on 28/08/19. 6 | // Copyright © 2019 Vinicius Mangueira. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | /// This method add arrange of view in view 13 | func addSubviews(_ views: [UIView]) { 14 | views.forEach { (view) in 15 | view.translatesAutoresizingMaskIntoConstraints = false 16 | self.addSubview(view) 17 | } 18 | } 19 | 20 | func cBuild(_ make : (LayoutProxy) -> ()) { 21 | translatesAutoresizingMaskIntoConstraints = false 22 | make(LayoutProxy(view: self)) 23 | } 24 | 25 | /// This constraints with you respective constant, always anchor following with you constant 26 | func cBuild(top: NSLayoutYAxisAnchor?, costantTop: CGFloat = 0, bottom: NSLayoutYAxisAnchor?, constantBottom: CGFloat = 0, left: NSLayoutXAxisAnchor?, constantLeft: CGFloat = 0, right: NSLayoutXAxisAnchor?, constantRight: CGFloat = 0) { 27 | translatesAutoresizingMaskIntoConstraints = false 28 | 29 | if let tope = top { 30 | topAnchor.constraint(equalTo: tope, constant: costantTop).isActive = true 31 | } 32 | 33 | if let bott = bottom { 34 | bottomAnchor.constraint(equalTo: bott, constant: constantBottom).isActive = true 35 | } 36 | 37 | if let leading = left { 38 | leadingAnchor.constraint(equalTo: leading, constant: constantLeft).isActive = true 39 | } 40 | 41 | if let trailing = right { 42 | trailing.constraint(equalTo: trailing, constant: constantRight).isActive = true 43 | } 44 | } 45 | 46 | 47 | func cBuild(to anchor: TypeAnchor, with priotity: CGFloat) { 48 | switch anchor { 49 | case .top: 50 | break 51 | default: 52 | break 53 | } 54 | } 55 | 56 | /// This method is calling to set all constraints in to respective anchors 57 | func cBuild(top: NSLayoutYAxisAnchor?, bottom: NSLayoutYAxisAnchor?, left: NSLayoutXAxisAnchor?, right: NSLayoutXAxisAnchor?) { 58 | translatesAutoresizingMaskIntoConstraints = false 59 | 60 | if let tope = top { 61 | topAnchor.constraint(equalTo: tope).isActive = true 62 | } 63 | 64 | if let bott = bottom { 65 | bottomAnchor.constraint(equalTo: bott).isActive = true 66 | } 67 | 68 | if let leading = left { 69 | leadingAnchor.constraint(equalTo: leading).isActive = true 70 | } 71 | 72 | if let trailing = right { 73 | trailing.constraint(equalTo: trailing).isActive = true 74 | } 75 | } 76 | 77 | /// Define width from anchor with constant 78 | func cBuild(width: CGFloat) { 79 | translatesAutoresizingMaskIntoConstraints = false 80 | widthAnchor.constraint(equalToConstant: width).isActive = true 81 | } 82 | /// Define with from anchor with NSLayoutDimension 83 | func cBuild(width: NSLayoutDimension) { 84 | translatesAutoresizingMaskIntoConstraints = false 85 | widthAnchor.constraint(equalTo: width).isActive = true 86 | } 87 | 88 | /// Define height from anchor with constant 89 | func cBuild(height: CGFloat) { 90 | translatesAutoresizingMaskIntoConstraints = false 91 | heightAnchor.constraint(equalToConstant: height).isActive = true 92 | } 93 | /// Define height from anchor with NSLayoutDimension 94 | func cBuild(height: NSLayoutDimension) { 95 | translatesAutoresizingMaskIntoConstraints = false 96 | heightAnchor.constraint(equalTo: height).isActive = true 97 | } 98 | 99 | /// Provides access to simple view actions. See `ViewAction` for the list of constraint configurations. 100 | func cBuild(make: ViewAction) { 101 | translatesAutoresizingMaskIntoConstraints = false 102 | switch make { 103 | case .fillSuperview: 104 | equalToSuperView(top: 0, leading: 0, trailing: 0, bottom: 0) 105 | case let .fillSuperviewWithPaddings(top, leading, trailing, bottom): 106 | equalToSuperView(top: top, leading: leading, trailing: trailing, bottom: bottom) 107 | case .centerInSuperView: 108 | centerInSuperView() 109 | case .centerXInSuperView: 110 | centerXInSuperView() 111 | case .centerYInSuperView: 112 | centerYInSuperView() 113 | case let .fillSuperviewFromTop(height, leading, trailing, top): 114 | equalToSuperView(top: top, leading: leading, trailing: trailing) 115 | cBuild(height: height) 116 | case let .fillSuperviewFromBottom(height, leading, trailing, bottom): 117 | equalToSuperView(leading: leading, trailing: trailing, bottom: bottom) 118 | cBuild(height: height) 119 | case let .fillSuperviewFromRight(width, top, bottom, trailing): 120 | equalToSuperView(top: top, trailing: trailing, bottom: bottom) 121 | cBuild(width: width) 122 | case let .fillSuperviewFromLeft(width, top, bottom, leading): 123 | equalToSuperView(top: top, leading: leading, bottom: bottom) 124 | cBuild(width: width) 125 | } 126 | } 127 | 128 | 129 | func cBuild(make: ConstraintAction) { 130 | translatesAutoresizingMaskIntoConstraints = false 131 | switch make { 132 | case .deactivateAllConstraints: 133 | constraints.forEach { (constraint) in 134 | constraint.isActive = false 135 | } 136 | } 137 | } 138 | 139 | fileprivate func centerInSuperView() { 140 | centerXInSuperView() 141 | centerYInSuperView() 142 | } 143 | 144 | fileprivate func centerXInSuperView() { 145 | guard let spView = superview else {return} 146 | NSLayoutConstraint.activate([ 147 | centerXAnchor.constraint(equalTo: spView.centerXAnchor), 148 | ]) 149 | } 150 | 151 | fileprivate func centerYInSuperView() { 152 | guard let spView = superview else {return} 153 | NSLayoutConstraint.activate([ 154 | centerYAnchor.constraint(equalTo: spView.centerYAnchor), 155 | ]) 156 | } 157 | 158 | fileprivate func equalToSuperView(top: CGFloat? = nil, leading: CGFloat? = nil, trailing: CGFloat? = nil, bottom: CGFloat? = nil) { 159 | guard let spView = superview else {return} 160 | 161 | if let top = top { 162 | topAnchor.constraint(equalTo: spView.topAnchor, constant: top).isActive = true 163 | } 164 | 165 | if let leading = leading { 166 | leadingAnchor.constraint(equalTo: spView.leadingAnchor, constant: leading).isActive = true 167 | } 168 | 169 | if let trailing = trailing { 170 | trailingAnchor.constraint(equalTo: spView.trailingAnchor, constant: -trailing).isActive = true 171 | } 172 | 173 | if let bottom = bottom { 174 | bottomAnchor.constraint(equalTo: spView.bottomAnchor, constant: -bottom).isActive = true 175 | } 176 | } 177 | } 178 | 179 | enum ViewAction { 180 | case fillSuperview 181 | case fillSuperviewWithPaddings(top: CGFloat, leading: CGFloat, trailing: CGFloat, bottom: CGFloat) 182 | case fillSuperviewFromTop(height: CGFloat, leading: CGFloat, trailing: CGFloat, top: CGFloat) 183 | case fillSuperviewFromBottom(height: CGFloat, leading: CGFloat, trailing: CGFloat, bottom: CGFloat) 184 | case fillSuperviewFromRight(width: CGFloat, top: CGFloat, bottom: CGFloat, trailing: CGFloat) 185 | case fillSuperviewFromLeft(width: CGFloat, top: CGFloat, bottom: CGFloat, leading: CGFloat) 186 | case centerInSuperView 187 | case centerXInSuperView 188 | case centerYInSuperView 189 | } 190 | 191 | 192 | enum ConstraintAction { 193 | case deactivateAllConstraints 194 | } 195 | 196 | enum TypeAnchor { 197 | case top 198 | case leading 199 | case trailing 200 | case bottom 201 | } 202 | -------------------------------------------------------------------------------- /CBuilder.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | "CBuilder::CBuilderPackageTests::ProductTarget" /* CBuilderPackageTests */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = OBJ_42 /* Build configuration list for PBXAggregateTarget "CBuilderPackageTests" */; 13 | buildPhases = ( 14 | ); 15 | dependencies = ( 16 | OBJ_45 /* PBXTargetDependency */, 17 | ); 18 | name = CBuilderPackageTests; 19 | productName = CBuilderPackageTests; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | OBJ_29 /* CBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_8 /* CBuilder.swift */; }; 25 | OBJ_30 /* LayoutAnchor+operations.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* LayoutAnchor+operations.swift */; }; 26 | OBJ_31 /* LayoutAnchor.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_10 /* LayoutAnchor.swift */; }; 27 | OBJ_32 /* LayoutProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* LayoutProperty.swift */; }; 28 | OBJ_33 /* LayoutProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* LayoutProxy.swift */; }; 29 | OBJ_40 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; 30 | OBJ_51 /* CBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* CBuilderTests.swift */; }; 31 | OBJ_53 /* CBuilder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "CBuilder::CBuilder::Product" /* CBuilder.framework */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXContainerItemProxy section */ 35 | 5594EF41234D7BE0009FB34C /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = OBJ_1 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = "CBuilder::CBuilder"; 40 | remoteInfo = CBuilder; 41 | }; 42 | 5594EF42234D7BE1009FB34C /* PBXContainerItemProxy */ = { 43 | isa = PBXContainerItemProxy; 44 | containerPortal = OBJ_1 /* Project object */; 45 | proxyType = 1; 46 | remoteGlobalIDString = "CBuilder::CBuilderTests"; 47 | remoteInfo = CBuilderTests; 48 | }; 49 | /* End PBXContainerItemProxy section */ 50 | 51 | /* Begin PBXFileReference section */ 52 | 0AD04A342350887300CF91D8 /* CBuilder.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = CBuilder.podspec; sourceTree = ""; }; 53 | "CBuilder::CBuilder::Product" /* CBuilder.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CBuilder.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | "CBuilder::CBuilderTests::Product" /* CBuilderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = CBuilderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | OBJ_10 /* LayoutAnchor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutAnchor.swift; sourceTree = ""; }; 56 | OBJ_11 /* LayoutProperty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutProperty.swift; sourceTree = ""; }; 57 | OBJ_12 /* LayoutProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutProxy.swift; sourceTree = ""; }; 58 | OBJ_15 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | OBJ_16 /* CBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CBuilderTests.swift; sourceTree = ""; }; 60 | OBJ_20 /* CBuilder */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CBuilder; sourceTree = SOURCE_ROOT; }; 61 | OBJ_21 /* CBuilderTests */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CBuilderTests; sourceTree = SOURCE_ROOT; }; 62 | OBJ_22 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 63 | OBJ_23 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 64 | OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 65 | OBJ_8 /* CBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CBuilder.swift; sourceTree = ""; }; 66 | OBJ_9 /* LayoutAnchor+operations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LayoutAnchor+operations.swift"; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | OBJ_34 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 0; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | OBJ_52 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 0; 80 | files = ( 81 | OBJ_53 /* CBuilder.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | OBJ_13 /* Tests */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | OBJ_14 /* CBuilderTests */, 92 | ); 93 | name = Tests; 94 | sourceTree = SOURCE_ROOT; 95 | }; 96 | OBJ_14 /* CBuilderTests */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | OBJ_15 /* Info.plist */, 100 | OBJ_16 /* CBuilderTests.swift */, 101 | ); 102 | path = CBuilderTests; 103 | sourceTree = SOURCE_ROOT; 104 | }; 105 | OBJ_17 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | "CBuilder::CBuilder::Product" /* CBuilder.framework */, 109 | "CBuilder::CBuilderTests::Product" /* CBuilderTests.xctest */, 110 | ); 111 | name = Products; 112 | sourceTree = BUILT_PRODUCTS_DIR; 113 | }; 114 | OBJ_5 = { 115 | isa = PBXGroup; 116 | children = ( 117 | OBJ_6 /* Package.swift */, 118 | OBJ_7 /* Sources */, 119 | OBJ_13 /* Tests */, 120 | OBJ_17 /* Products */, 121 | OBJ_20 /* CBuilder */, 122 | OBJ_21 /* CBuilderTests */, 123 | OBJ_22 /* LICENSE */, 124 | OBJ_23 /* README.md */, 125 | 0AD04A342350887300CF91D8 /* CBuilder.podspec */, 126 | ); 127 | sourceTree = ""; 128 | }; 129 | OBJ_7 /* Sources */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | OBJ_8 /* CBuilder.swift */, 133 | OBJ_9 /* LayoutAnchor+operations.swift */, 134 | OBJ_10 /* LayoutAnchor.swift */, 135 | OBJ_11 /* LayoutProperty.swift */, 136 | OBJ_12 /* LayoutProxy.swift */, 137 | ); 138 | name = Sources; 139 | path = CBuilder/Source; 140 | sourceTree = SOURCE_ROOT; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | "CBuilder::CBuilder" /* CBuilder */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = OBJ_25 /* Build configuration list for PBXNativeTarget "CBuilder" */; 148 | buildPhases = ( 149 | OBJ_28 /* Sources */, 150 | OBJ_34 /* Frameworks */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = CBuilder; 157 | productName = CBuilder; 158 | productReference = "CBuilder::CBuilder::Product" /* CBuilder.framework */; 159 | productType = "com.apple.product-type.framework"; 160 | }; 161 | "CBuilder::CBuilderTests" /* CBuilderTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = OBJ_47 /* Build configuration list for PBXNativeTarget "CBuilderTests" */; 164 | buildPhases = ( 165 | OBJ_50 /* Sources */, 166 | OBJ_52 /* Frameworks */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | OBJ_54 /* PBXTargetDependency */, 172 | ); 173 | name = CBuilderTests; 174 | productName = CBuilderTests; 175 | productReference = "CBuilder::CBuilderTests::Product" /* CBuilderTests.xctest */; 176 | productType = "com.apple.product-type.bundle.unit-test"; 177 | }; 178 | "CBuilder::SwiftPMPackageDescription" /* CBuilderPackageDescription */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = OBJ_36 /* Build configuration list for PBXNativeTarget "CBuilderPackageDescription" */; 181 | buildPhases = ( 182 | OBJ_39 /* Sources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = CBuilderPackageDescription; 189 | productName = CBuilderPackageDescription; 190 | productType = "com.apple.product-type.framework"; 191 | }; 192 | /* End PBXNativeTarget section */ 193 | 194 | /* Begin PBXProject section */ 195 | OBJ_1 /* Project object */ = { 196 | isa = PBXProject; 197 | attributes = { 198 | LastSwiftMigration = 9999; 199 | LastUpgradeCheck = 9999; 200 | }; 201 | buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "CBuilder" */; 202 | compatibilityVersion = "Xcode 3.2"; 203 | developmentRegion = en; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | ); 208 | mainGroup = OBJ_5; 209 | productRefGroup = OBJ_17 /* Products */; 210 | projectDirPath = ""; 211 | projectRoot = ""; 212 | targets = ( 213 | "CBuilder::CBuilder" /* CBuilder */, 214 | "CBuilder::SwiftPMPackageDescription" /* CBuilderPackageDescription */, 215 | "CBuilder::CBuilderPackageTests::ProductTarget" /* CBuilderPackageTests */, 216 | "CBuilder::CBuilderTests" /* CBuilderTests */, 217 | ); 218 | }; 219 | /* End PBXProject section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | OBJ_28 /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 0; 225 | files = ( 226 | OBJ_29 /* CBuilder.swift in Sources */, 227 | OBJ_30 /* LayoutAnchor+operations.swift in Sources */, 228 | OBJ_31 /* LayoutAnchor.swift in Sources */, 229 | OBJ_32 /* LayoutProperty.swift in Sources */, 230 | OBJ_33 /* LayoutProxy.swift in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | OBJ_39 /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 0; 237 | files = ( 238 | OBJ_40 /* Package.swift in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | OBJ_50 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 0; 245 | files = ( 246 | OBJ_51 /* CBuilderTests.swift in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | OBJ_45 /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = "CBuilder::CBuilderTests" /* CBuilderTests */; 256 | targetProxy = 5594EF42234D7BE1009FB34C /* PBXContainerItemProxy */; 257 | }; 258 | OBJ_54 /* PBXTargetDependency */ = { 259 | isa = PBXTargetDependency; 260 | target = "CBuilder::CBuilder" /* CBuilder */; 261 | targetProxy = 5594EF41234D7BE0009FB34C /* PBXContainerItemProxy */; 262 | }; 263 | /* End PBXTargetDependency section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | OBJ_26 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ENABLE_TESTABILITY = YES; 270 | FRAMEWORK_SEARCH_PATHS = ( 271 | "$(inherited)", 272 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 273 | ); 274 | HEADER_SEARCH_PATHS = "$(inherited)"; 275 | INFOPLIST_FILE = CBuilder/info.plist; 276 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 277 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 278 | MACOSX_DEPLOYMENT_TARGET = 10.10; 279 | OTHER_CFLAGS = "$(inherited)"; 280 | OTHER_LDFLAGS = "$(inherited)"; 281 | OTHER_SWIFT_FLAGS = "$(inherited)"; 282 | PRODUCT_BUNDLE_IDENTIFIER = CBuilder; 283 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 284 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 285 | SKIP_INSTALL = YES; 286 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 287 | SWIFT_VERSION = 5.0; 288 | TARGET_NAME = CBuilder; 289 | TVOS_DEPLOYMENT_TARGET = 9.0; 290 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 291 | }; 292 | name = Debug; 293 | }; 294 | OBJ_27 /* Release */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ENABLE_TESTABILITY = YES; 298 | FRAMEWORK_SEARCH_PATHS = ( 299 | "$(inherited)", 300 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 301 | ); 302 | HEADER_SEARCH_PATHS = "$(inherited)"; 303 | INFOPLIST_FILE = CBuilder/info.plist; 304 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 305 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 306 | MACOSX_DEPLOYMENT_TARGET = 10.10; 307 | OTHER_CFLAGS = "$(inherited)"; 308 | OTHER_LDFLAGS = "$(inherited)"; 309 | OTHER_SWIFT_FLAGS = "$(inherited)"; 310 | PRODUCT_BUNDLE_IDENTIFIER = CBuilder; 311 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 312 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 313 | SKIP_INSTALL = YES; 314 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 315 | SWIFT_VERSION = 5.0; 316 | TARGET_NAME = CBuilder; 317 | TVOS_DEPLOYMENT_TARGET = 9.0; 318 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 319 | }; 320 | name = Release; 321 | }; 322 | OBJ_3 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | CLANG_ENABLE_OBJC_ARC = YES; 326 | COMBINE_HIDPI_IMAGES = YES; 327 | COPY_PHASE_STRIP = NO; 328 | DEBUG_INFORMATION_FORMAT = dwarf; 329 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 330 | ENABLE_NS_ASSERTIONS = YES; 331 | GCC_OPTIMIZATION_LEVEL = 0; 332 | GCC_PREPROCESSOR_DEFINITIONS = ( 333 | "$(inherited)", 334 | "SWIFT_PACKAGE=1", 335 | "DEBUG=1", 336 | ); 337 | MACOSX_DEPLOYMENT_TARGET = 10.10; 338 | ONLY_ACTIVE_ARCH = YES; 339 | OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | SDKROOT = macosx; 342 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 343 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG"; 344 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 345 | USE_HEADERMAP = NO; 346 | }; 347 | name = Debug; 348 | }; 349 | OBJ_37 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | LD = /usr/bin/true; 353 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5"; 354 | SWIFT_VERSION = 5.0; 355 | }; 356 | name = Debug; 357 | }; 358 | OBJ_38 /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | LD = /usr/bin/true; 362 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5"; 363 | SWIFT_VERSION = 5.0; 364 | }; 365 | name = Release; 366 | }; 367 | OBJ_4 /* Release */ = { 368 | isa = XCBuildConfiguration; 369 | buildSettings = { 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | COMBINE_HIDPI_IMAGES = YES; 372 | COPY_PHASE_STRIP = YES; 373 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 374 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 375 | GCC_OPTIMIZATION_LEVEL = s; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "$(inherited)", 378 | "SWIFT_PACKAGE=1", 379 | ); 380 | MACOSX_DEPLOYMENT_TARGET = 10.10; 381 | OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | SDKROOT = macosx; 384 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 385 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE"; 386 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 387 | USE_HEADERMAP = NO; 388 | }; 389 | name = Release; 390 | }; 391 | OBJ_43 /* Debug */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | INFOPLIST_FILE = CBuilderTests/info.plist; 395 | }; 396 | name = Debug; 397 | }; 398 | OBJ_44 /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | INFOPLIST_FILE = CBuilderTests/info.plist; 402 | }; 403 | name = Release; 404 | }; 405 | OBJ_48 /* Debug */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | CLANG_ENABLE_MODULES = YES; 409 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 410 | FRAMEWORK_SEARCH_PATHS = ( 411 | "$(inherited)", 412 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 413 | ); 414 | HEADER_SEARCH_PATHS = "$(inherited)"; 415 | INFOPLIST_FILE = CBuilderTests/info.plist; 416 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; 418 | MACOSX_DEPLOYMENT_TARGET = 10.10; 419 | OTHER_CFLAGS = "$(inherited)"; 420 | OTHER_LDFLAGS = "$(inherited)"; 421 | OTHER_SWIFT_FLAGS = "$(inherited)"; 422 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 423 | SWIFT_VERSION = 5.0; 424 | TARGET_NAME = CBuilderTests; 425 | TVOS_DEPLOYMENT_TARGET = 9.0; 426 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 427 | }; 428 | name = Debug; 429 | }; 430 | OBJ_49 /* Release */ = { 431 | isa = XCBuildConfiguration; 432 | buildSettings = { 433 | CLANG_ENABLE_MODULES = YES; 434 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 438 | ); 439 | HEADER_SEARCH_PATHS = "$(inherited)"; 440 | INFOPLIST_FILE = CBuilderTests/info.plist; 441 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @loader_path/Frameworks"; 443 | MACOSX_DEPLOYMENT_TARGET = 10.10; 444 | OTHER_CFLAGS = "$(inherited)"; 445 | OTHER_LDFLAGS = "$(inherited)"; 446 | OTHER_SWIFT_FLAGS = "$(inherited)"; 447 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 448 | SWIFT_VERSION = 5.0; 449 | TARGET_NAME = CBuilderTests; 450 | TVOS_DEPLOYMENT_TARGET = 9.0; 451 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | OBJ_2 /* Build configuration list for PBXProject "CBuilder" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | OBJ_3 /* Debug */, 462 | OBJ_4 /* Release */, 463 | ); 464 | defaultConfigurationIsVisible = 0; 465 | defaultConfigurationName = Release; 466 | }; 467 | OBJ_25 /* Build configuration list for PBXNativeTarget "CBuilder" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | OBJ_26 /* Debug */, 471 | OBJ_27 /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | OBJ_36 /* Build configuration list for PBXNativeTarget "CBuilderPackageDescription" */ = { 477 | isa = XCConfigurationList; 478 | buildConfigurations = ( 479 | OBJ_37 /* Debug */, 480 | OBJ_38 /* Release */, 481 | ); 482 | defaultConfigurationIsVisible = 0; 483 | defaultConfigurationName = Release; 484 | }; 485 | OBJ_42 /* Build configuration list for PBXAggregateTarget "CBuilderPackageTests" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | OBJ_43 /* Debug */, 489 | OBJ_44 /* Release */, 490 | ); 491 | defaultConfigurationIsVisible = 0; 492 | defaultConfigurationName = Release; 493 | }; 494 | OBJ_47 /* Build configuration list for PBXNativeTarget "CBuilderTests" */ = { 495 | isa = XCConfigurationList; 496 | buildConfigurations = ( 497 | OBJ_48 /* Debug */, 498 | OBJ_49 /* Release */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = OBJ_1 /* Project object */; 506 | } 507 | --------------------------------------------------------------------------------