├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CodeSnippets ├── Masonry Constraint Make.codesnippet ├── Masonry Constraint Remake.codesnippet └── Masonry Constraint Update.codesnippet ├── Examples ├── Masonry iOS Examples.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Masonry iOS Examples.xcscheme └── Masonry iOS Examples │ ├── Images.xcassets │ └── Contents.json │ ├── Launch Screen.storyboard │ ├── MASAppDelegate.h │ ├── MASAppDelegate.m │ ├── MASExampleAnimatedView.h │ ├── MASExampleAnimatedView.m │ ├── MASExampleArrayView.h │ ├── MASExampleArrayView.m │ ├── MASExampleAspectFitView.h │ ├── MASExampleAspectFitView.m │ ├── MASExampleAttributeChainingView.h │ ├── MASExampleAttributeChainingView.m │ ├── MASExampleBasicView.h │ ├── MASExampleBasicView.m │ ├── MASExampleConstantsView.h │ ├── MASExampleConstantsView.m │ ├── MASExampleDebuggingView.h │ ├── MASExampleDebuggingView.m │ ├── MASExampleDistributeView.h │ ├── MASExampleDistributeView.m │ ├── MASExampleLabelView.h │ ├── MASExampleLabelView.m │ ├── MASExampleLayoutGuideViewController.h │ ├── MASExampleLayoutGuideViewController.m │ ├── MASExampleListViewController.h │ ├── MASExampleListViewController.m │ ├── MASExampleMarginView.h │ ├── MASExampleMarginView.m │ ├── MASExampleRemakeView.h │ ├── MASExampleRemakeView.m │ ├── MASExampleSafeAreaLayoutGuideViewController.h │ ├── MASExampleSafeAreaLayoutGuideViewController.m │ ├── MASExampleScrollView.h │ ├── MASExampleScrollView.m │ ├── MASExampleSidesView.h │ ├── MASExampleSidesView.m │ ├── MASExampleUpdateView.h │ ├── MASExampleUpdateView.m │ ├── MASExampleViewController.h │ ├── MASExampleViewController.m │ ├── Masonry iOS Examples-Info.plist │ ├── Masonry iOS Examples-Prefix.pch │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── ISSUE_TEMPLATE.md ├── LICENSE ├── Masonry.podspec ├── Masonry.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── Masonry.xccheckout └── xcshareddata │ └── xcschemes │ ├── Masonry OSX.xcscheme │ └── Masonry iOS.xcscheme ├── Masonry.xcworkspace └── contents.xcworkspacedata ├── Masonry ├── Info.plist ├── MASCompositeConstraint.h ├── MASCompositeConstraint.m ├── MASConstraint+Private.h ├── MASConstraint.h ├── MASConstraint.m ├── MASConstraintMaker.h ├── MASConstraintMaker.m ├── MASLayoutConstraint.h ├── MASLayoutConstraint.m ├── MASUtilities.h ├── MASViewAttribute.h ├── MASViewAttribute.m ├── MASViewConstraint.h ├── MASViewConstraint.m ├── Masonry.h ├── NSArray+MASAdditions.h ├── NSArray+MASAdditions.m ├── NSArray+MASShorthandAdditions.h ├── NSLayoutConstraint+MASDebugAdditions.h ├── NSLayoutConstraint+MASDebugAdditions.m ├── View+MASAdditions.h ├── View+MASAdditions.m ├── View+MASShorthandAdditions.h ├── ViewController+MASAdditions.h └── ViewController+MASAdditions.m ├── Podfile ├── Podfile.lock ├── Pods ├── Expecta │ ├── Expecta │ │ ├── EXPBlockDefinedMatcher.h │ │ ├── EXPBlockDefinedMatcher.m │ │ ├── EXPDefines.h │ │ ├── EXPDoubleTuple.h │ │ ├── EXPDoubleTuple.m │ │ ├── EXPExpect.h │ │ ├── EXPExpect.m │ │ ├── EXPFloatTuple.h │ │ ├── EXPFloatTuple.m │ │ ├── EXPMatcher.h │ │ ├── EXPUnsupportedObject.h │ │ ├── EXPUnsupportedObject.m │ │ ├── Expecta.h │ │ ├── ExpectaObject.h │ │ ├── ExpectaObject.m │ │ ├── ExpectaSupport.h │ │ ├── ExpectaSupport.m │ │ ├── Matchers │ │ │ ├── EXPMatcherHelpers.h │ │ │ ├── EXPMatcherHelpers.m │ │ │ ├── EXPMatchers+beCloseTo.h │ │ │ ├── EXPMatchers+beCloseTo.m │ │ │ ├── EXPMatchers+beFalsy.h │ │ │ ├── EXPMatchers+beFalsy.m │ │ │ ├── EXPMatchers+beGreaterThan.h │ │ │ ├── EXPMatchers+beGreaterThan.m │ │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.h │ │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.m │ │ │ ├── EXPMatchers+beIdenticalTo.h │ │ │ ├── EXPMatchers+beIdenticalTo.m │ │ │ ├── EXPMatchers+beInTheRangeOf.h │ │ │ ├── EXPMatchers+beInTheRangeOf.m │ │ │ ├── EXPMatchers+beInstanceOf.h │ │ │ ├── EXPMatchers+beInstanceOf.m │ │ │ ├── EXPMatchers+beKindOf.h │ │ │ ├── EXPMatchers+beKindOf.m │ │ │ ├── EXPMatchers+beLessThan.h │ │ │ ├── EXPMatchers+beLessThan.m │ │ │ ├── EXPMatchers+beLessThanOrEqualTo.h │ │ │ ├── EXPMatchers+beLessThanOrEqualTo.m │ │ │ ├── EXPMatchers+beNil.h │ │ │ ├── EXPMatchers+beNil.m │ │ │ ├── EXPMatchers+beSubclassOf.h │ │ │ ├── EXPMatchers+beSubclassOf.m │ │ │ ├── EXPMatchers+beSupersetOf.h │ │ │ ├── EXPMatchers+beSupersetOf.m │ │ │ ├── EXPMatchers+beTruthy.h │ │ │ ├── EXPMatchers+beTruthy.m │ │ │ ├── EXPMatchers+beginWith.h │ │ │ ├── EXPMatchers+beginWith.m │ │ │ ├── EXPMatchers+conformTo.h │ │ │ ├── EXPMatchers+conformTo.m │ │ │ ├── EXPMatchers+contain.h │ │ │ ├── EXPMatchers+contain.m │ │ │ ├── EXPMatchers+endWith.h │ │ │ ├── EXPMatchers+endWith.m │ │ │ ├── EXPMatchers+equal.h │ │ │ ├── EXPMatchers+equal.m │ │ │ ├── EXPMatchers+haveCountOf.h │ │ │ ├── EXPMatchers+haveCountOf.m │ │ │ ├── EXPMatchers+match.h │ │ │ ├── EXPMatchers+match.m │ │ │ ├── EXPMatchers+postNotification.h │ │ │ ├── EXPMatchers+postNotification.m │ │ │ ├── EXPMatchers+raise.h │ │ │ ├── EXPMatchers+raise.m │ │ │ ├── EXPMatchers+raiseWithReason.h │ │ │ ├── EXPMatchers+raiseWithReason.m │ │ │ ├── EXPMatchers+respondTo.h │ │ │ ├── EXPMatchers+respondTo.m │ │ │ └── EXPMatchers.h │ │ ├── NSObject+Expecta.h │ │ ├── NSValue+Expecta.h │ │ └── NSValue+Expecta.m │ ├── LICENSE │ └── README.md ├── Headers │ ├── Private │ │ ├── Expecta │ │ │ ├── EXPBlockDefinedMatcher.h │ │ │ ├── EXPDefines.h │ │ │ ├── EXPDoubleTuple.h │ │ │ ├── EXPExpect.h │ │ │ ├── EXPFloatTuple.h │ │ │ ├── EXPMatcher.h │ │ │ ├── EXPMatcherHelpers.h │ │ │ ├── EXPMatchers+beCloseTo.h │ │ │ ├── EXPMatchers+beFalsy.h │ │ │ ├── EXPMatchers+beGreaterThan.h │ │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.h │ │ │ ├── EXPMatchers+beIdenticalTo.h │ │ │ ├── EXPMatchers+beInTheRangeOf.h │ │ │ ├── EXPMatchers+beInstanceOf.h │ │ │ ├── EXPMatchers+beKindOf.h │ │ │ ├── EXPMatchers+beLessThan.h │ │ │ ├── EXPMatchers+beLessThanOrEqualTo.h │ │ │ ├── EXPMatchers+beNil.h │ │ │ ├── EXPMatchers+beSubclassOf.h │ │ │ ├── EXPMatchers+beSupersetOf.h │ │ │ ├── EXPMatchers+beTruthy.h │ │ │ ├── EXPMatchers+beginWith.h │ │ │ ├── EXPMatchers+conformTo.h │ │ │ ├── EXPMatchers+contain.h │ │ │ ├── EXPMatchers+endWith.h │ │ │ ├── EXPMatchers+equal.h │ │ │ ├── EXPMatchers+haveCountOf.h │ │ │ ├── EXPMatchers+match.h │ │ │ ├── EXPMatchers+postNotification.h │ │ │ ├── EXPMatchers+raise.h │ │ │ ├── EXPMatchers+raiseWithReason.h │ │ │ ├── EXPMatchers+respondTo.h │ │ │ ├── EXPMatchers.h │ │ │ ├── EXPUnsupportedObject.h │ │ │ ├── Expecta.h │ │ │ ├── ExpectaObject.h │ │ │ ├── ExpectaSupport.h │ │ │ ├── NSObject+Expecta.h │ │ │ └── NSValue+Expecta.h │ │ └── Masonry │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── MASConstraint.h │ │ │ ├── MASConstraintMaker.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASUtilities.h │ │ │ ├── MASViewAttribute.h │ │ │ ├── MASViewConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── View+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ └── ViewController+MASAdditions.h │ └── Public │ │ ├── Expecta │ │ ├── EXPBlockDefinedMatcher.h │ │ ├── EXPDefines.h │ │ ├── EXPDoubleTuple.h │ │ ├── EXPExpect.h │ │ ├── EXPFloatTuple.h │ │ ├── EXPMatcher.h │ │ ├── EXPMatcherHelpers.h │ │ ├── EXPMatchers+beCloseTo.h │ │ ├── EXPMatchers+beFalsy.h │ │ ├── EXPMatchers+beGreaterThan.h │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.h │ │ ├── EXPMatchers+beIdenticalTo.h │ │ ├── EXPMatchers+beInTheRangeOf.h │ │ ├── EXPMatchers+beInstanceOf.h │ │ ├── EXPMatchers+beKindOf.h │ │ ├── EXPMatchers+beLessThan.h │ │ ├── EXPMatchers+beLessThanOrEqualTo.h │ │ ├── EXPMatchers+beNil.h │ │ ├── EXPMatchers+beSubclassOf.h │ │ ├── EXPMatchers+beSupersetOf.h │ │ ├── EXPMatchers+beTruthy.h │ │ ├── EXPMatchers+beginWith.h │ │ ├── EXPMatchers+conformTo.h │ │ ├── EXPMatchers+contain.h │ │ ├── EXPMatchers+endWith.h │ │ ├── EXPMatchers+equal.h │ │ ├── EXPMatchers+haveCountOf.h │ │ ├── EXPMatchers+match.h │ │ ├── EXPMatchers+postNotification.h │ │ ├── EXPMatchers+raise.h │ │ ├── EXPMatchers+raiseWithReason.h │ │ ├── EXPMatchers+respondTo.h │ │ ├── EXPMatchers.h │ │ ├── EXPUnsupportedObject.h │ │ ├── Expecta.h │ │ ├── ExpectaObject.h │ │ ├── ExpectaSupport.h │ │ ├── NSObject+Expecta.h │ │ └── NSValue+Expecta.h │ │ └── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraintMaker.h │ │ ├── MASLayoutConstraint.h │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewConstraint.h │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── View+MASAdditions.h │ │ ├── View+MASShorthandAdditions.h │ │ └── ViewController+MASAdditions.h ├── Local Podspecs │ └── Masonry.podspec.json ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── Expecta │ ├── Expecta-dummy.m │ ├── Expecta-prefix.pch │ └── Expecta.xcconfig │ ├── Masonry │ ├── Masonry-dummy.m │ ├── Masonry-prefix.pch │ └── Masonry.xcconfig │ ├── Pods-Masonry iOS Examples │ ├── Pods-Masonry iOS Examples-acknowledgements.markdown │ ├── Pods-Masonry iOS Examples-acknowledgements.plist │ ├── Pods-Masonry iOS Examples-dummy.m │ ├── Pods-Masonry iOS Examples-frameworks.sh │ ├── Pods-Masonry iOS Examples-resources.sh │ ├── Pods-Masonry iOS Examples.debug.xcconfig │ └── Pods-Masonry iOS Examples.release.xcconfig │ ├── Pods-Masonry iOS Tests │ ├── Pods-Masonry iOS Tests-acknowledgements.markdown │ ├── Pods-Masonry iOS Tests-acknowledgements.plist │ ├── Pods-Masonry iOS Tests-dummy.m │ ├── Pods-Masonry iOS Tests-frameworks.sh │ ├── Pods-Masonry iOS Tests-resources.sh │ ├── Pods-Masonry iOS Tests.debug.xcconfig │ └── Pods-Masonry iOS Tests.release.xcconfig │ └── Pods-MasonryTestsLoader │ ├── Pods-MasonryTestsLoader-acknowledgements.markdown │ ├── Pods-MasonryTestsLoader-acknowledgements.plist │ ├── Pods-MasonryTestsLoader-dummy.m │ ├── Pods-MasonryTestsLoader-frameworks.sh │ ├── Pods-MasonryTestsLoader-resources.sh │ ├── Pods-MasonryTestsLoader.debug.xcconfig │ └── Pods-MasonryTestsLoader.release.xcconfig ├── README.md ├── Tests ├── GcovTestObserver.m ├── Masonry Tests.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── Masonry iOS Tests.xcscheme ├── MasonryTests-Info.plist ├── MasonryTests-Prefix.pch ├── MasonryTestsLoader │ ├── CASAppDelegate.h │ ├── CASAppDelegate.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── MasonryTestsLoader-Info.plist │ ├── MasonryTestsLoader-Prefix.pch │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── NSObject+MASSubscriptSupport.h ├── Specs │ ├── MASCompositeConstraintSpec.m │ ├── MASConstraintDelegateMock.h │ ├── MASConstraintDelegateMock.m │ ├── MASConstraintMakerSpec.m │ ├── MASViewAttributeSpec.m │ ├── MASViewConstraintSpec.m │ ├── NSArray+MASAdditionsSpec.m │ ├── NSLayoutConstraint+MASDebugAdditionsSpec.m │ ├── View+MASAdditionsSpec.m │ └── ViewController+MASAdditionsSpec.m └── XCTest+Spec.h └── script ├── coveralls.sh └── exportenv.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | profile 13 | *.moved-aside 14 | # Desktop Servies 15 | .DS_Store 16 | script/env.sh 17 | DerivedData/ 18 | 19 | /Masonry.xcworkspace/xcshareddata/Masonry.xccheckout 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: objective-c 3 | osx_image: xcode9 4 | before_install: 5 | - sudo easy_install cpp-coveralls 6 | - gem install xcpretty -N 7 | - export LANG=en_US.UTF-8 8 | 9 | script: 10 | - set -o pipefail 11 | - xcodebuild -workspace 'Masonry.xcworkspace' -scheme 'Masonry iOS Tests' -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.0' clean test ARCHS=i386 VALID_ARCHS=i386 ONLY_ACTIVE_ARCH=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcpretty -c 12 | - xcodebuild -workspace 'Masonry.xcworkspace' -scheme 'Masonry iOS' -configuration Debug -sdk iphonesimulator clean build ARCHS=i386 VALID_ARCHS=i386 ONLY_ACTIVE_ARCH=NO | xcpretty -c 13 | - xcodebuild -workspace 'Masonry.xcworkspace' -scheme 'Masonry OSX' -configuration Debug clean build | xcpretty -c 14 | 15 | after_success: 16 | - ./script/coveralls.sh 17 | -------------------------------------------------------------------------------- /CodeSnippets/Masonry Constraint Make.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mas_make 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [<#view#> mas_makeConstraints:^(MASConstraintMaker *make){ 13 | <#code#> 14 | }]; 15 | 16 | IDECodeSnippetIdentifier 17 | 4A0A057B-8C17-43BB-BDBA-3A315A942EF8 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetTitle 21 | Masonry Constraint Make 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /CodeSnippets/Masonry Constraint Remake.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mas_remake 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [<#view#> mas_remakeConstraints:^(MASConstraintMaker *make){ 13 | <#code#> 14 | }]; 15 | IDECodeSnippetIdentifier 16 | 53203A7C-0C2C-493C-9CAE-8900D9AB68A8 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | Masonry Constraint Remake 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeSnippets/Masonry Constraint Update.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mas_update 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [<#view#> mas_updateConstraints:^(MASConstraintMaker *make){ 13 | <#code#> 14 | }]; 15 | 16 | IDECodeSnippetIdentifier 17 | CF088737-121D-4166-97B0-D8AB63696B08 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetTitle 21 | Masonry Constraint Update 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASAppDelegate.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASAppDelegate.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASAppDelegate.h" 10 | #import "MASExampleListViewController.h" 11 | 12 | @implementation MASAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 15 | self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; 16 | // Override point for customization after application launch. 17 | self.window.backgroundColor = UIColor.whiteColor; 18 | 19 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:MASExampleListViewController.new]; 20 | self.window.rootViewController = navigationController; 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleAnimatedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleAnimatedView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleAnimatedView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleArrayView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleArrayView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleArrayView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleArrayView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleArrayView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleArrayView.h" 10 | 11 | static CGFloat const kArrayExampleIncrement = 10.0; 12 | 13 | @interface MASExampleArrayView () 14 | 15 | @property (nonatomic, assign) CGFloat offset; 16 | @property (nonatomic, strong) NSArray *buttonViews; 17 | 18 | @end 19 | 20 | @implementation MASExampleArrayView 21 | 22 | - (id)init { 23 | self = [super init]; 24 | if (!self) return nil; 25 | 26 | UIButton *raiseButton = [UIButton buttonWithType:UIButtonTypeSystem]; 27 | [raiseButton setTitle:@"Raise" forState:UIControlStateNormal]; 28 | [raiseButton addTarget:self action:@selector(raiseAction) forControlEvents:UIControlEventTouchUpInside]; 29 | [self addSubview:raiseButton]; 30 | 31 | UIButton *centerButton = [UIButton buttonWithType:UIButtonTypeSystem]; 32 | [centerButton setTitle:@"Center" forState:UIControlStateNormal]; 33 | [centerButton addTarget:self action:@selector(centerAction) forControlEvents:UIControlEventTouchUpInside]; 34 | [self addSubview:centerButton]; 35 | 36 | UIButton *lowerButton = [UIButton buttonWithType:UIButtonTypeSystem]; 37 | [lowerButton setTitle:@"Lower" forState:UIControlStateNormal]; 38 | [lowerButton addTarget:self action:@selector(lowerAction) forControlEvents:UIControlEventTouchUpInside]; 39 | [self addSubview:lowerButton]; 40 | 41 | [lowerButton mas_makeConstraints:^(MASConstraintMaker *make) { 42 | make.left.equalTo(self).with.offset(10.0); 43 | }]; 44 | 45 | [centerButton mas_makeConstraints:^(MASConstraintMaker *make) { 46 | make.centerX.equalTo(self); 47 | }]; 48 | 49 | [raiseButton mas_makeConstraints:^(MASConstraintMaker *make) { 50 | make.right.equalTo(self).with.offset(-10); 51 | }]; 52 | 53 | self.buttonViews = @[ raiseButton, lowerButton, centerButton ]; 54 | 55 | return self; 56 | } 57 | 58 | - (void)centerAction { 59 | self.offset = 0.0; 60 | } 61 | 62 | - (void)raiseAction { 63 | self.offset -= kArrayExampleIncrement; 64 | } 65 | 66 | - (void)lowerAction { 67 | self.offset += kArrayExampleIncrement; 68 | } 69 | 70 | - (void)setOffset:(CGFloat)offset { 71 | _offset = offset; 72 | [self setNeedsUpdateConstraints]; 73 | } 74 | 75 | - (void)updateConstraints { 76 | [self.buttonViews updateConstraints:^(MASConstraintMaker *make) { 77 | make.baseline.equalTo(self.mas_centerY).with.offset(self.offset); 78 | }]; 79 | 80 | //according to apple super should be called at end of method 81 | [super updateConstraints]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleAspectFitView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleAspectFitView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Michael Koukoullis on 19/01/2015. 6 | // Copyright (c) 2015 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleAspectFitView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleAttributeChainingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleAttributeChainingView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 31/03/14. 6 | // Copyright (c) 2014 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleAttributeChainingView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleAttributeChainingView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleAttributeChainingView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 31/03/14. 6 | // Copyright (c) 2014 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleAttributeChainingView.h" 10 | 11 | @implementation MASExampleAttributeChainingView 12 | 13 | - (id)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | UIView *greenView = UIView.new; 18 | greenView.backgroundColor = UIColor.greenColor; 19 | greenView.layer.borderColor = UIColor.blackColor.CGColor; 20 | greenView.layer.borderWidth = 2; 21 | [self addSubview:greenView]; 22 | 23 | UIView *redView = UIView.new; 24 | redView.backgroundColor = UIColor.redColor; 25 | redView.layer.borderColor = UIColor.blackColor.CGColor; 26 | redView.layer.borderWidth = 2; 27 | [self addSubview:redView]; 28 | 29 | UIView *blueView = UIView.new; 30 | blueView.backgroundColor = UIColor.blueColor; 31 | blueView.layer.borderColor = UIColor.blackColor.CGColor; 32 | blueView.layer.borderWidth = 2; 33 | [self addSubview:blueView]; 34 | 35 | UIView *superview = self; 36 | UIEdgeInsets padding = UIEdgeInsetsMake(15, 10, 15, 10); 37 | 38 | 39 | [greenView mas_makeConstraints:^(MASConstraintMaker *make) { 40 | // chain attributes 41 | make.top.and.left.equalTo(superview).insets(padding); 42 | 43 | // which is the equivalent of 44 | // make.top.greaterThanOrEqualTo(superview).insets(padding); 45 | // make.left.greaterThanOrEqualTo(superview).insets(padding); 46 | 47 | make.bottom.equalTo(blueView.mas_top).insets(padding); 48 | make.right.equalTo(redView.mas_left).insets(padding); 49 | make.width.equalTo(redView.mas_width); 50 | 51 | make.height.equalTo(@[redView, blueView]); 52 | }]; 53 | 54 | [redView mas_makeConstraints:^(MASConstraintMaker *make) { 55 | // chain attributes 56 | make.top.and.right.equalTo(superview).insets(padding); 57 | 58 | make.left.equalTo(greenView.mas_right).insets(padding); 59 | make.bottom.equalTo(blueView.mas_top).insets(padding); 60 | make.width.equalTo(greenView.mas_width); 61 | 62 | make.height.equalTo(@[greenView, blueView]); 63 | }]; 64 | 65 | [blueView mas_makeConstraints:^(MASConstraintMaker *make) { 66 | make.top.equalTo(greenView.mas_bottom).insets(padding); 67 | 68 | // chain attributes 69 | make.left.right.and.bottom.equalTo(superview).insets(padding); 70 | 71 | make.height.equalTo(@[greenView, redView]); 72 | }]; 73 | 74 | return self; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleBasicView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleBasicView.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleBasicView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleBasicView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleBasicView.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASExampleBasicView.h" 10 | 11 | @implementation MASExampleBasicView 12 | 13 | - (id)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | UIView *greenView = UIView.new; 18 | greenView.backgroundColor = UIColor.greenColor; 19 | greenView.layer.borderColor = UIColor.blackColor.CGColor; 20 | greenView.layer.borderWidth = 2; 21 | [self addSubview:greenView]; 22 | 23 | UIView *redView = UIView.new; 24 | redView.backgroundColor = UIColor.redColor; 25 | redView.layer.borderColor = UIColor.blackColor.CGColor; 26 | redView.layer.borderWidth = 2; 27 | [self addSubview:redView]; 28 | 29 | UIView *blueView = UIView.new; 30 | blueView.backgroundColor = UIColor.blueColor; 31 | blueView.layer.borderColor = UIColor.blackColor.CGColor; 32 | blueView.layer.borderWidth = 2; 33 | [self addSubview:blueView]; 34 | 35 | UIView *superview = self; 36 | int padding = 10; 37 | 38 | //if you want to use Masonry without the mas_ prefix 39 | //define MAS_SHORTHAND before importing Masonry.h see Masonry iOS Examples-Prefix.pch 40 | [greenView makeConstraints:^(MASConstraintMaker *make) { 41 | make.top.greaterThanOrEqualTo(superview.top).offset(padding); 42 | make.left.equalTo(superview.left).offset(padding); 43 | make.bottom.equalTo(blueView.top).offset(-padding); 44 | make.right.equalTo(redView.left).offset(-padding); 45 | make.width.equalTo(redView.width); 46 | 47 | make.height.equalTo(redView.height); 48 | make.height.equalTo(blueView.height); 49 | 50 | }]; 51 | 52 | //with is semantic and option 53 | [redView mas_makeConstraints:^(MASConstraintMaker *make) { 54 | make.top.equalTo(superview.mas_top).with.offset(padding); //with with 55 | make.left.equalTo(greenView.mas_right).offset(padding); //without with 56 | make.bottom.equalTo(blueView.mas_top).offset(-padding); 57 | make.right.equalTo(superview.mas_right).offset(-padding); 58 | make.width.equalTo(greenView.mas_width); 59 | 60 | make.height.equalTo(@[greenView, blueView]); //can pass array of views 61 | }]; 62 | 63 | [blueView mas_makeConstraints:^(MASConstraintMaker *make) { 64 | make.top.equalTo(greenView.mas_bottom).offset(padding); 65 | make.left.equalTo(superview.mas_left).offset(padding); 66 | make.bottom.equalTo(superview.mas_bottom).offset(-padding); 67 | make.right.equalTo(superview.mas_right).offset(-padding); 68 | make.height.equalTo(@[greenView.mas_height, redView.mas_height]); //can pass array of attributes 69 | }]; 70 | 71 | return self; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleConstantsView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleConstantsView.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleConstantsView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleConstantsView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleConstantsView.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASExampleConstantsView.h" 10 | 11 | @implementation MASExampleConstantsView 12 | 13 | - (id)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | UIView *purpleView = UIView.new; 18 | purpleView.backgroundColor = UIColor.purpleColor; 19 | purpleView.layer.borderColor = UIColor.blackColor.CGColor; 20 | purpleView.layer.borderWidth = 2; 21 | [self addSubview:purpleView]; 22 | 23 | UIView *orangeView = UIView.new; 24 | orangeView.backgroundColor = UIColor.orangeColor; 25 | orangeView.layer.borderColor = UIColor.blackColor.CGColor; 26 | orangeView.layer.borderWidth = 2; 27 | [self addSubview:orangeView]; 28 | 29 | //example of using constants 30 | 31 | [purpleView mas_makeConstraints:^(MASConstraintMaker *make) { 32 | make.top.equalTo(@20); 33 | make.left.equalTo(@20); 34 | make.bottom.equalTo(@-20); 35 | make.right.equalTo(@-20); 36 | }]; 37 | 38 | // auto-boxing macros allow you to simply use scalars and structs, they will be wrapped automatically 39 | 40 | [orangeView mas_makeConstraints:^(MASConstraintMaker *make) { 41 | make.center.equalTo(CGPointMake(0, 50)); 42 | make.size.equalTo(CGSizeMake(200, 100)); 43 | }]; 44 | 45 | return self; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleDebuggingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleDebuggingView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleDebuggingView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleDistributeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleDistributeView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by bibibi on 15/8/6. 6 | // Copyright (c) 2015年 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleDistributeView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleDistributeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleDistributeView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by bibibi on 15/8/6. 6 | // Copyright (c) 2015年 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleDistributeView.h" 10 | 11 | @implementation MASExampleDistributeView 12 | 13 | - (id)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | NSMutableArray *arr = @[].mutableCopy; 18 | for (int i = 0; i < 4; i++) { 19 | UIView *view = UIView.new; 20 | view.backgroundColor = [self randomColor]; 21 | view.layer.borderColor = UIColor.blackColor.CGColor; 22 | view.layer.borderWidth = 2; 23 | [self addSubview:view]; 24 | [arr addObject:view]; 25 | } 26 | 27 | unsigned int type = arc4random()%4; 28 | switch (type) { 29 | case 0: 30 | [arr mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:20 leadSpacing:5 tailSpacing:5]; 31 | [arr makeConstraints:^(MASConstraintMaker *make) { 32 | make.top.equalTo(@60); 33 | make.height.equalTo(@60); 34 | }]; 35 | break; 36 | case 1: 37 | [arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:20 leadSpacing:5 tailSpacing:5]; 38 | [arr makeConstraints:^(MASConstraintMaker *make) { 39 | make.left.equalTo(@0); 40 | make.width.equalTo(@60); 41 | }]; 42 | break; 43 | case 2: 44 | [arr mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedItemLength:30 leadSpacing:200 tailSpacing:30]; 45 | [arr makeConstraints:^(MASConstraintMaker *make) { 46 | make.top.equalTo(@60); 47 | make.height.equalTo(@60); 48 | }]; 49 | break; 50 | case 3: 51 | [arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedItemLength:30 leadSpacing:30 tailSpacing:200]; 52 | [arr makeConstraints:^(MASConstraintMaker *make) { 53 | make.left.equalTo(@0); 54 | make.width.equalTo(@60); 55 | }]; 56 | break; 57 | 58 | default: 59 | break; 60 | } 61 | 62 | return self; 63 | } 64 | 65 | - (UIColor *)randomColor { 66 | CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 67 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white 68 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black 69 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleLabelView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleLabelView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 24/10/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleLabelView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleLabelView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleLabelView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 24/10/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleLabelView.h" 10 | 11 | static UIEdgeInsets const kPadding = {10, 10, 10, 10}; 12 | 13 | @interface MASExampleLabelView () 14 | 15 | @property (nonatomic, strong) UILabel *shortLabel; 16 | @property (nonatomic, strong) UILabel *longLabel; 17 | 18 | @end 19 | 20 | @implementation MASExampleLabelView 21 | 22 | - (id)init { 23 | self = [super init]; 24 | if (!self) return nil; 25 | 26 | // text courtesy of http://baconipsum.com/ 27 | 28 | self.shortLabel = UILabel.new; 29 | self.shortLabel.numberOfLines = 1; 30 | self.shortLabel.textColor = [UIColor purpleColor]; 31 | self.shortLabel.lineBreakMode = NSLineBreakByTruncatingTail; 32 | self.shortLabel.text = @"Bacon"; 33 | [self addSubview:self.shortLabel]; 34 | 35 | self.longLabel = UILabel.new; 36 | self.longLabel.numberOfLines = 8; 37 | self.longLabel.textColor = [UIColor darkGrayColor]; 38 | self.longLabel.lineBreakMode = NSLineBreakByTruncatingTail; 39 | self.longLabel.text = @"Bacon ipsum dolor sit amet spare ribs fatback kielbasa salami, tri-tip jowl pastrami flank short loin rump sirloin. Tenderloin frankfurter chicken biltong rump chuck filet mignon pork t-bone flank ham hock."; 40 | [self addSubview:self.longLabel]; 41 | 42 | [self.longLabel makeConstraints:^(MASConstraintMaker *make) { 43 | make.left.equalTo(self.left).insets(kPadding); 44 | make.top.equalTo(self.top).insets(kPadding); 45 | }]; 46 | 47 | [self.shortLabel makeConstraints:^(MASConstraintMaker *make) { 48 | make.top.equalTo(self.longLabel.lastBaseline); 49 | make.right.equalTo(self.right).insets(kPadding); 50 | }]; 51 | 52 | return self; 53 | } 54 | 55 | - (void)layoutSubviews { 56 | [super layoutSubviews]; 57 | 58 | // for multiline UILabel's you need set the preferredMaxLayoutWidth 59 | // you need to do this after [super layoutSubviews] as the frames will have a value from Auto Layout at this point 60 | 61 | // stay tuned for new easier way todo this coming soon to Masonry 62 | 63 | CGFloat width = CGRectGetMinX(self.shortLabel.frame) - kPadding.left; 64 | width -= CGRectGetMinX(self.longLabel.frame); 65 | self.longLabel.preferredMaxLayoutWidth = width; 66 | 67 | // need to layoutSubviews again as frames need to recalculated with preferredLayoutWidth 68 | [super layoutSubviews]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleLayoutGuideViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleLayoutGuideViewController.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 26/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleLayoutGuideViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleLayoutGuideViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleLayoutGuideViewController.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 26/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleLayoutGuideViewController.h" 10 | 11 | @interface MASExampleLayoutGuideViewController () 12 | 13 | @end 14 | 15 | @implementation MASExampleLayoutGuideViewController 16 | 17 | - (id)init { 18 | self = [super init]; 19 | if (!self) return nil; 20 | 21 | self.title = @"Layout Guides"; 22 | 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | self.view.backgroundColor = [UIColor whiteColor]; 30 | 31 | UIView *topView = UIView.new; 32 | topView.backgroundColor = UIColor.greenColor; 33 | topView.layer.borderColor = UIColor.blackColor.CGColor; 34 | topView.layer.borderWidth = 2; 35 | [self.view addSubview:topView]; 36 | 37 | UIView *topSubview = UIView.new; 38 | topSubview.backgroundColor = UIColor.blueColor; 39 | topSubview.layer.borderColor = UIColor.blackColor.CGColor; 40 | topSubview.layer.borderWidth = 2; 41 | [topView addSubview:topSubview]; 42 | 43 | UIView *bottomView = UIView.new; 44 | bottomView.backgroundColor = UIColor.redColor; 45 | bottomView.layer.borderColor = UIColor.blackColor.CGColor; 46 | bottomView.layer.borderWidth = 2; 47 | [self.view addSubview:bottomView]; 48 | 49 | [topView makeConstraints:^(MASConstraintMaker *make) { 50 | make.top.equalTo(self.mas_topLayoutGuide); 51 | make.left.equalTo(self.view); 52 | make.right.equalTo(self.view); 53 | make.height.equalTo(@40); 54 | }]; 55 | 56 | [topSubview makeConstraints:^(MASConstraintMaker *make) { 57 | make.top.equalTo(self.mas_topLayoutGuide); 58 | make.centerX.equalTo(@0); 59 | make.width.equalTo(@20); 60 | make.height.equalTo(@20); 61 | }]; 62 | 63 | [bottomView makeConstraints:^(MASConstraintMaker *make) { 64 | make.bottom.equalTo(self.mas_bottomLayoutGuide); 65 | make.left.equalTo(self.view); 66 | make.right.equalTo(self.view); 67 | make.height.equalTo(@40); 68 | }]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleListViewController.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleListViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleMarginView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleMarginView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Craig Siemens on 2015-02-23. 6 | // Copyright (c) 2015 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleMarginView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleMarginView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleMarginView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Craig Siemens on 2015-02-23. 6 | // Copyright (c) 2015 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleMarginView.h" 10 | 11 | @implementation MASExampleMarginView 12 | 13 | - (instancetype)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | UIView *lastView = self; 18 | for (int i = 0; i < 10; i++) { 19 | UIView *view = UIView.new; 20 | view.backgroundColor = [self randomColor]; 21 | view.layer.borderColor = UIColor.blackColor.CGColor; 22 | view.layer.borderWidth = 2; 23 | view.layoutMargins = UIEdgeInsetsMake(5, 10, 15, 20); 24 | [self addSubview:view]; 25 | 26 | [view mas_makeConstraints:^(MASConstraintMaker *make) { 27 | make.top.equalTo(lastView.topMargin); 28 | make.bottom.equalTo(lastView.bottomMargin); 29 | make.left.equalTo(lastView.leftMargin); 30 | make.right.equalTo(lastView.rightMargin); 31 | }]; 32 | 33 | lastView = view; 34 | } 35 | 36 | return self; 37 | } 38 | 39 | - (UIColor *)randomColor { 40 | CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 41 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white 42 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black 43 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleRemakeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleRemakeView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Sam Symons on 2014-06-22. 6 | // Copyright (c) 2014 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleRemakeView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleRemakeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleRemakeView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Sam Symons on 2014-06-22. 6 | // Copyright (c) 2014 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleRemakeView.h" 10 | 11 | @interface MASExampleRemakeView () 12 | 13 | @property (nonatomic, strong) UIButton *movingButton; 14 | @property (nonatomic, assign) BOOL topLeft; 15 | 16 | - (void)toggleButtonPosition; 17 | 18 | @end 19 | 20 | @implementation MASExampleRemakeView 21 | 22 | - (id)init { 23 | self = [super init]; 24 | if (!self) return nil; 25 | 26 | self.movingButton = [UIButton buttonWithType:UIButtonTypeSystem]; 27 | [self.movingButton setTitle:@"Move Me!" forState:UIControlStateNormal]; 28 | self.movingButton.layer.borderColor = UIColor.greenColor.CGColor; 29 | self.movingButton.layer.borderWidth = 3; 30 | 31 | [self.movingButton addTarget:self action:@selector(toggleButtonPosition) forControlEvents:UIControlEventTouchUpInside]; 32 | [self addSubview:self.movingButton]; 33 | 34 | self.topLeft = YES; 35 | 36 | return self; 37 | } 38 | 39 | + (BOOL)requiresConstraintBasedLayout 40 | { 41 | return YES; 42 | } 43 | 44 | // this is Apple's recommended place for adding/updating constraints 45 | - (void)updateConstraints { 46 | 47 | [self.movingButton remakeConstraints:^(MASConstraintMaker *make) { 48 | make.width.equalTo(@(100)); 49 | make.height.equalTo(@(100)); 50 | 51 | if (self.topLeft) { 52 | make.left.equalTo(self.left).with.offset(10); 53 | make.top.equalTo(self.top).with.offset(10); 54 | } 55 | else { 56 | make.bottom.equalTo(self.bottom).with.offset(-10); 57 | make.right.equalTo(self.right).with.offset(-10); 58 | } 59 | }]; 60 | 61 | //according to apple super should be called at end of method 62 | [super updateConstraints]; 63 | } 64 | 65 | - (void)toggleButtonPosition { 66 | self.topLeft = !self.topLeft; 67 | 68 | // tell constraints they need updating 69 | [self setNeedsUpdateConstraints]; 70 | 71 | // update constraints now so we can animate the change 72 | [self updateConstraintsIfNeeded]; 73 | 74 | [UIView animateWithDuration:0.4 animations:^{ 75 | [self layoutIfNeeded]; 76 | }]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleSafeAreaLayoutGuideViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleSafeAreaLayoutGuideViewController.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by MingLQ on 2017-09-27. 6 | // Copyright © 2017 MingLQ. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleSafeAreaLayoutGuideViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleScrollView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 20/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleScrollView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleScrollView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 20/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleScrollView.h" 10 | 11 | /** 12 | * UIScrollView and Auto Layout don't play very nicely together see 13 | * https://developer.apple.com/library/ios/technotes/tn2154/_index.html 14 | * 15 | * This is an example of one workaround 16 | * 17 | * for another approach see https://github.com/bizz84/MVScrollViewAutoLayout 18 | */ 19 | 20 | @interface MASExampleScrollView () 21 | @property (strong, nonatomic) UIScrollView* scrollView; 22 | @end 23 | 24 | @implementation MASExampleScrollView 25 | 26 | - (id)init { 27 | self = [super init]; 28 | if (!self) return nil; 29 | 30 | UIScrollView *scrollView = UIScrollView.new; 31 | self.scrollView = scrollView; 32 | scrollView.backgroundColor = [UIColor grayColor]; 33 | [self addSubview:scrollView]; 34 | [self.scrollView makeConstraints:^(MASConstraintMaker *make) { 35 | make.edges.equalTo(self); 36 | }]; 37 | 38 | [self generateContent]; 39 | 40 | return self; 41 | } 42 | 43 | - (void)generateContent { 44 | UIView* contentView = UIView.new; 45 | [self.scrollView addSubview:contentView]; 46 | 47 | [contentView makeConstraints:^(MASConstraintMaker *make) { 48 | make.edges.equalTo(self.scrollView); 49 | make.width.equalTo(self.scrollView); 50 | }]; 51 | 52 | UIView *lastView; 53 | CGFloat height = 25; 54 | 55 | for (int i = 0; i < 10; i++) { 56 | UIView *view = UIView.new; 57 | view.backgroundColor = [self randomColor]; 58 | [contentView addSubview:view]; 59 | 60 | UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)]; 61 | [view addGestureRecognizer:singleTap]; 62 | 63 | [view mas_makeConstraints:^(MASConstraintMaker *make) { 64 | make.top.equalTo(lastView ? lastView.bottom : @0); 65 | make.left.equalTo(@0); 66 | make.width.equalTo(contentView.width); 67 | make.height.equalTo(@(height)); 68 | }]; 69 | 70 | height += 25; 71 | lastView = view; 72 | } 73 | 74 | [contentView makeConstraints:^(MASConstraintMaker *make) { 75 | make.bottom.equalTo(lastView.bottom); 76 | }]; 77 | } 78 | 79 | - (UIColor *)randomColor { 80 | CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 81 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white 82 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black 83 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; 84 | } 85 | 86 | - (void)singleTap:(UITapGestureRecognizer*)sender { 87 | [sender.view setAlpha:sender.view.alpha / 1.20]; // To see something happen on screen when you tap :O 88 | [self.scrollView scrollRectToVisible:sender.view.frame animated:YES]; 89 | }; 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleSidesView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleSidesView.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleSidesView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleSidesView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleSidesView.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASExampleSidesView.h" 10 | 11 | @implementation MASExampleSidesView 12 | 13 | - (id)init { 14 | self = [super init]; 15 | if (!self) return nil; 16 | 17 | UIView *lastView = self; 18 | for (int i = 0; i < 10; i++) { 19 | UIView *view = UIView.new; 20 | view.backgroundColor = [self randomColor]; 21 | view.layer.borderColor = UIColor.blackColor.CGColor; 22 | view.layer.borderWidth = 2; 23 | [self addSubview:view]; 24 | 25 | [view mas_makeConstraints:^(MASConstraintMaker *make) { 26 | make.edges.equalTo(lastView).insets(UIEdgeInsetsMake(5, 10, 15, 20)); 27 | }]; 28 | 29 | lastView = view; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (UIColor *)randomColor { 36 | CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 37 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white 38 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black 39 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleUpdateView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleUpdateView.h 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 3/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleUpdateView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleUpdateView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleUpdateView.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 3/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASExampleUpdateView.h" 10 | 11 | @interface MASExampleUpdateView () 12 | 13 | @property (nonatomic, strong) UIButton *growingButton; 14 | @property (nonatomic, assign) CGSize buttonSize; 15 | 16 | @end 17 | 18 | @implementation MASExampleUpdateView 19 | 20 | - (id)init { 21 | self = [super init]; 22 | if (!self) return nil; 23 | 24 | self.growingButton = [UIButton buttonWithType:UIButtonTypeSystem]; 25 | [self.growingButton setTitle:@"Grow Me!" forState:UIControlStateNormal]; 26 | self.growingButton.layer.borderColor = UIColor.greenColor.CGColor; 27 | self.growingButton.layer.borderWidth = 3; 28 | 29 | [self.growingButton addTarget:self action:@selector(didTapGrowButton:) forControlEvents:UIControlEventTouchUpInside]; 30 | [self addSubview:self.growingButton]; 31 | 32 | self.buttonSize = CGSizeMake(100, 100); 33 | 34 | return self; 35 | } 36 | 37 | + (BOOL)requiresConstraintBasedLayout 38 | { 39 | return YES; 40 | } 41 | 42 | // this is Apple's recommended place for adding/updating constraints 43 | - (void)updateConstraints { 44 | 45 | [self.growingButton updateConstraints:^(MASConstraintMaker *make) { 46 | make.center.equalTo(self); 47 | make.width.equalTo(@(self.buttonSize.width)).priorityLow(); 48 | make.height.equalTo(@(self.buttonSize.height)).priorityLow(); 49 | make.width.lessThanOrEqualTo(self); 50 | make.height.lessThanOrEqualTo(self); 51 | }]; 52 | 53 | //according to apple super should be called at end of method 54 | [super updateConstraints]; 55 | } 56 | 57 | - (void)didTapGrowButton:(UIButton *)button { 58 | self.buttonSize = CGSizeMake(self.buttonSize.width * 1.3, self.buttonSize.height * 1.3); 59 | 60 | // tell constraints they need updating 61 | [self setNeedsUpdateConstraints]; 62 | 63 | // update constraints now so we can animate the change 64 | [self updateConstraintsIfNeeded]; 65 | 66 | [UIView animateWithDuration:0.4 animations:^{ 67 | [self layoutIfNeeded]; 68 | }]; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleOneViewController.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MASExampleViewController : UIViewController 12 | 13 | - (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/MASExampleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASExampleOneViewController.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASExampleViewController.h" 10 | #import "MASExampleBasicView.h" 11 | 12 | @interface MASExampleViewController () 13 | 14 | @property (nonatomic, strong) Class viewClass; 15 | 16 | @end 17 | 18 | @implementation MASExampleViewController 19 | 20 | - (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass { 21 | self = [super init]; 22 | if (!self) return nil; 23 | 24 | self.title = title; 25 | self.viewClass = viewClass; 26 | 27 | return self; 28 | } 29 | 30 | - (void)loadView { 31 | self.view = self.viewClass.new; 32 | self.view.backgroundColor = [UIColor whiteColor]; 33 | } 34 | 35 | #ifdef __IPHONE_7_0 36 | - (UIRectEdge)edgesForExtendedLayout { 37 | return UIRectEdgeNone; 38 | } 39 | #endif 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/Masonry iOS Examples-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | Launch Screen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIRequiresFullScreen 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/Masonry iOS Examples-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Masonry iOS Examples' target in the 'Masonry iOS Examples' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import 15 | 16 | //define this constant if you want to use Masonry without the 'mas_' prefix 17 | #define MAS_SHORTHAND 18 | 19 | //define this constant if you want to enable auto-boxing for default syntax 20 | #define MAS_SHORTHAND_GLOBALS 21 | 22 | #import "Masonry.h" 23 | #endif 24 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/Masonry iOS Examples/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Masonry iOS Examples 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "MASAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([MASAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### New Issue Checklist 2 | 3 | 🚫 If this template is not filled out your issue **will** be closed with no comment. 🚫 4 | 5 | * [ ] I have looked at the [Documentation](https://github.com/SnapKit/Masonry/blob/master/README.md) 6 | * [ ] I have filled out this issue template. 7 | 8 | ### Issue Info 9 | 10 | Info | Value | 11 | -------------------------|-------------------------------------| 12 | Platform | e.g. ios/osx/tvos 13 | Platform Version | e.g. 8.0 14 | Masonry Version | e.g. 1.0 15 | Integration Method | e.g. carthage/cocoapods/manually 16 | 17 | 18 | ### Issue Description 19 | 20 | ⚠️ Replace this with the description of your issue. ⚠️ 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Masonry.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'Masonry' 3 | s.version = '1.1.0' 4 | s.license = 'MIT' 5 | s.summary = 'Harness the power of Auto Layout NSLayoutConstraints with a simplified, chainable and expressive syntax.' 6 | s.homepage = 'https://github.com/cloudkite/Masonry' 7 | s.author = { 'Jonas Budelmann' => 'jonas.budelmann@gmail.com' } 8 | s.social_media_url = "http://twitter.com/cloudkite" 9 | 10 | s.source = { :git => 'https://github.com/cloudkite/Masonry.git', :tag => "v#{s.version}" } 11 | 12 | s.description = %{ 13 | Masonry is a light-weight layout framework which wraps AutoLayout with a nicer syntax. 14 | Masonry has its own layout DSL which provides a chainable way of describing your 15 | NSLayoutConstraints which results in layout code which is more concise and readable. 16 | Masonry supports iOS and Mac OSX. 17 | } 18 | 19 | pch_AF = <<-EOS 20 | #ifndef TARGET_OS_IOS 21 | #define TARGET_OS_IOS TARGET_OS_IPHONE 22 | #endif 23 | #ifndef TARGET_OS_TV 24 | #define TARGET_OS_TV 0 25 | #endif 26 | EOS 27 | 28 | s.source_files = 'Masonry/*.{h,m}' 29 | 30 | s.ios.frameworks = 'Foundation', 'UIKit' 31 | s.tvos.frameworks = 'Foundation', 'UIKit' 32 | s.osx.frameworks = 'Foundation', 'AppKit' 33 | 34 | s.ios.deployment_target = '6.0' # minimum SDK with autolayout 35 | s.osx.deployment_target = '10.7' # minimum SDK with autolayout 36 | s.tvos.deployment_target = '9.0' # minimum SDK with autolayout 37 | s.requires_arc = true 38 | end 39 | -------------------------------------------------------------------------------- /Masonry.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Masonry.xcodeproj/project.xcworkspace/xcshareddata/Masonry.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | E430861F-D80D-40F7-BD85-FE97E606F3EA 9 | IDESourceControlProjectName 10 | Masonry 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 6FC4832245A6A8E50F2A782F20A8B58A46BD1FEB 14 | github.com:erichoracek/Masonry.git 15 | 16 | IDESourceControlProjectPath 17 | Masonry/Masonry.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 6FC4832245A6A8E50F2A782F20A8B58A46BD1FEB 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:erichoracek/Masonry.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 6FC4832245A6A8E50F2A782F20A8B58A46BD1FEB 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 6FC4832245A6A8E50F2A782F20A8B58A46BD1FEB 36 | IDESourceControlWCCName 37 | Masonry 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Masonry.xcodeproj/xcshareddata/xcschemes/Masonry OSX.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Masonry.xcodeproj/xcshareddata/xcschemes/Masonry iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Masonry.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Masonry/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide NS_DEPRECATED_IOS(8.0, 11.0); 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide NS_DEPRECATED_IOS(8.0, 11.0); 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop NS_DEPRECATED_IOS(8.0, 11.0); 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom NS_DEPRECATED_IOS(8.0, 11.0); 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop NS_DEPRECATED_IOS(8.0, 11.0); 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom NS_DEPRECATED_IOS(8.0, 11.0); 26 | 27 | @end 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | #pragma clang diagnostic push 16 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 17 | 18 | - (MASViewAttribute *)mas_topLayoutGuide { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideTop { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 23 | } 24 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 25 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 26 | } 27 | 28 | - (MASViewAttribute *)mas_bottomLayoutGuide { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 33 | } 34 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 35 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 36 | } 37 | 38 | #pragma clang diagnostic pop 39 | 40 | @end 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | workspace 'Masonry' 2 | 3 | platform :ios, '8.0' 4 | 5 | project 'Examples/Masonry iOS Examples' 6 | target 'Masonry iOS Examples' do 7 | pod 'Masonry', :path => './' 8 | end 9 | 10 | target 'Masonry iOS Tests' do 11 | project 'Tests/Masonry Tests' 12 | pod 'Expecta' 13 | end 14 | 15 | target 'MasonryTestsLoader' do 16 | project 'Tests/Masonry Tests' 17 | pod 'Masonry', :path => './' 18 | end 19 | 20 | # add settings needed to generate test coverage data 21 | post_install do |installer| 22 | 23 | COV_TARGET_NAME = "Pods-MasonryTestsLoader" 24 | EXPORT_ENV_PHASE_NAME = "Export Environment Vars" 25 | EXPORT_ENV_PHASE_SCRIPT = "export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > $SRCROOT/../script/env.sh" 26 | 27 | # find target 28 | classy_pods_target = installer.pods_project.targets.find{ |target| target.name == COV_TARGET_NAME } 29 | unless classy_pods_target 30 | raise ::Pod::Informative, "Failed to find '" << COV_TARGET_NAME << "' target" 31 | end 32 | 33 | # add build settings 34 | classy_pods_target.build_configurations.each do |config| 35 | config.build_settings['GCC_GENERATE_TEST_COVERAGE_FILES'] = 'YES' 36 | config.build_settings['GCC_INSTRUMENT_PROGRAM_FLOW_ARCS'] = 'YES' 37 | end 38 | 39 | # add build phase 40 | phase = classy_pods_target.shell_script_build_phases.select{ |bp| bp.name == EXPORT_ENV_PHASE_NAME }.first || 41 | classy_pods_target.new_shell_script_build_phase(EXPORT_ENV_PHASE_NAME) 42 | 43 | phase.shell_path = "/bin/sh" 44 | phase.shell_script = EXPORT_ENV_PHASE_SCRIPT 45 | phase.show_env_vars_in_log = '0' 46 | 47 | end 48 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Expecta (1.0.5) 3 | - Masonry (1.1.0) 4 | 5 | DEPENDENCIES: 6 | - Expecta 7 | - Masonry (from `./`) 8 | 9 | EXTERNAL SOURCES: 10 | Masonry: 11 | :path: ./ 12 | 13 | SPEC CHECKSUMS: 14 | Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe 15 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 16 | 17 | PODFILE CHECKSUM: a30c350a250a8af6afde1caabae52ede1d76714b 18 | 19 | COCOAPODS: 1.3.0.beta.2 20 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPBlockDefinedMatcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXPRuntimeMatcher.h 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EXPMatcher.h" 11 | #import "EXPDefines.h" 12 | 13 | @interface EXPBlockDefinedMatcher : NSObject { 14 | EXPBoolBlock prerequisiteBlock; 15 | EXPBoolBlock matchBlock; 16 | EXPStringBlock failureMessageForToBlock; 17 | EXPStringBlock failureMessageForNotToBlock; 18 | } 19 | 20 | @property(nonatomic, copy) EXPBoolBlock prerequisiteBlock; 21 | @property(nonatomic, copy) EXPBoolBlock matchBlock; 22 | @property(nonatomic, copy) EXPStringBlock failureMessageForToBlock; 23 | @property(nonatomic, copy) EXPStringBlock failureMessageForNotToBlock; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPBlockDefinedMatcher.m: -------------------------------------------------------------------------------- 1 | // 2 | // EXPRuntimeMatcher.m 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #import "EXPBlockDefinedMatcher.h" 10 | 11 | @implementation EXPBlockDefinedMatcher 12 | 13 | - (void)dealloc 14 | { 15 | self.prerequisiteBlock = nil; 16 | self.matchBlock = nil; 17 | self.failureMessageForToBlock = nil; 18 | self.failureMessageForNotToBlock = nil; 19 | 20 | [super dealloc]; 21 | } 22 | 23 | @synthesize prerequisiteBlock; 24 | @synthesize matchBlock; 25 | @synthesize failureMessageForToBlock; 26 | @synthesize failureMessageForNotToBlock; 27 | 28 | - (BOOL)meetsPrerequesiteFor:(id)actual 29 | { 30 | if (self.prerequisiteBlock) { 31 | return self.prerequisiteBlock(); 32 | } 33 | return YES; 34 | } 35 | 36 | - (BOOL)matches:(id)actual 37 | { 38 | if (self.matchBlock) { 39 | return self.matchBlock(); 40 | } 41 | return YES; 42 | } 43 | 44 | - (NSString *)failureMessageForTo:(id)actual 45 | { 46 | if (self.failureMessageForToBlock) { 47 | return self.failureMessageForToBlock(); 48 | } 49 | return nil; 50 | } 51 | 52 | - (NSString *)failureMessageForNotTo:(id)actual 53 | { 54 | if (self.failureMessageForNotToBlock) { 55 | return self.failureMessageForNotToBlock(); 56 | } 57 | return nil; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXPDefines.h 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #ifndef Expecta_EXPDefines_h 10 | #define Expecta_EXPDefines_h 11 | 12 | typedef void (^EXPBasicBlock)(); 13 | typedef id (^EXPIdBlock)(); 14 | typedef BOOL (^EXPBoolBlock)(); 15 | typedef NSString *(^EXPStringBlock)(); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPDoubleTuple.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPDoubleTuple : NSObject { 4 | double *_values; 5 | size_t _size; 6 | } 7 | 8 | @property (nonatomic, assign) double *values; 9 | @property (nonatomic, assign) size_t size; 10 | 11 | - (instancetype)initWithDoubleValues:(double *)values size:(size_t)size NS_DESIGNATED_INITIALIZER; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPDoubleTuple.m: -------------------------------------------------------------------------------- 1 | #import "EXPDoubleTuple.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPDoubleTuple 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize values = _values, size = _size; 9 | 10 | - (instancetype)initWithDoubleValues:(double *)values size:(size_t)size { 11 | if ((self = [super init])) { 12 | self.values = malloc(sizeof(double) * size); 13 | memcpy(self.values, values, sizeof(double) * size); 14 | self.size = size; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)dealloc { 20 | free(self.values); 21 | [super dealloc]; 22 | } 23 | 24 | - (BOOL)isEqual:(id)object { 25 | if (![object isKindOfClass:[EXPDoubleTuple class]]) return NO; 26 | EXPDoubleTuple *other = (EXPDoubleTuple *)object; 27 | if (self.size == other.size) { 28 | for (int i = 0; i < self.size; ++i) { 29 | if (self.values[i] != other.values[i]) return NO; 30 | } 31 | return YES; 32 | } 33 | return NO; 34 | } 35 | 36 | - (NSString *)description { 37 | if (self.size == 2) { 38 | return [NSString stringWithFormat:@"Double tuple: {%f, %f}", self.values[0], self.values[1]]; 39 | } else if (self.size == 4) { 40 | return [NSString stringWithFormat:@"Double tuple: {%f, %f, %f, %f}", self.values[0], self.values[1], self.values[2], self.values[3]]; 41 | } 42 | return [NSString stringWithFormat:@"Double tuple of unexpected size %zd, sadly", self.size]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPExpect.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "EXPMatcher.h" 3 | #import "EXPDefines.h" 4 | 5 | @interface EXPExpect : NSObject { 6 | EXPIdBlock _actualBlock; 7 | id _testCase; 8 | int _lineNumber; 9 | char *_fileName; 10 | BOOL _negative; 11 | BOOL _asynchronous; 12 | NSTimeInterval _timeout; 13 | } 14 | 15 | @property(nonatomic, copy) EXPIdBlock actualBlock; 16 | @property(nonatomic, readonly) id actual; 17 | @property(nonatomic, assign) id testCase; 18 | @property(nonatomic) int lineNumber; 19 | @property(nonatomic) const char *fileName; 20 | @property(nonatomic) BOOL negative; 21 | @property(nonatomic) BOOL asynchronous; 22 | @property(nonatomic) NSTimeInterval timeout; 23 | 24 | @property(nonatomic, readonly) EXPExpect *to; 25 | @property(nonatomic, readonly) EXPExpect *toNot; 26 | @property(nonatomic, readonly) EXPExpect *notTo; 27 | @property(nonatomic, readonly) EXPExpect *will; 28 | @property(nonatomic, readonly) EXPExpect *willNot; 29 | @property(nonatomic, readonly) EXPExpect *(^after)(NSTimeInterval timeInterval); 30 | 31 | - (instancetype)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName NS_DESIGNATED_INITIALIZER; 32 | + (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName; 33 | 34 | - (void)applyMatcher:(id)matcher; 35 | - (void)applyMatcher:(id)matcher to:(NSObject **)actual; 36 | 37 | @end 38 | 39 | @interface EXPDynamicPredicateMatcher : NSObject { 40 | EXPExpect *_expectation; 41 | SEL _selector; 42 | } 43 | - (instancetype)initWithExpectation:(EXPExpect *)expectation selector:(SEL)selector NS_DESIGNATED_INITIALIZER; 44 | @property (nonatomic, readonly, copy) void (^dispatch)(void); 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPFloatTuple.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPFloatTuple : NSObject { 4 | float *_values; 5 | size_t _size; 6 | } 7 | 8 | @property (nonatomic, assign) float *values; 9 | @property (nonatomic, assign) size_t size; 10 | 11 | - (instancetype)initWithFloatValues:(float *)values size:(size_t)size NS_DESIGNATED_INITIALIZER; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPFloatTuple.m: -------------------------------------------------------------------------------- 1 | #import "EXPFloatTuple.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPFloatTuple 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize values = _values, size = _size; 9 | 10 | - (instancetype)initWithFloatValues:(float *)values size:(size_t)size { 11 | if ((self = [super init])) { 12 | self.values = malloc(sizeof(float) * size); 13 | memcpy(self.values, values, sizeof(float) * size); 14 | self.size = size; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)dealloc { 20 | free(self.values); 21 | [super dealloc]; 22 | } 23 | 24 | - (BOOL)isEqual:(id)object { 25 | if (![object isKindOfClass:[EXPFloatTuple class]]) return NO; 26 | EXPFloatTuple *other = (EXPFloatTuple *)object; 27 | if (self.size == other.size) { 28 | for (int i = 0; i < self.size; ++i) { 29 | if (self.values[i] != other.values[i]) return NO; 30 | } 31 | return YES; 32 | } 33 | return NO; 34 | } 35 | 36 | - (NSUInteger)hash 37 | { 38 | NSUInteger prime = 31; 39 | NSUInteger hash = 0; 40 | for (int i=0; i 10 | 11 | @protocol EXPMatcher 12 | 13 | - (BOOL)matches:(id)actual; 14 | 15 | @optional 16 | - (BOOL)meetsPrerequesiteFor:(id)actual; 17 | - (NSString *)failureMessageForTo:(id)actual; 18 | - (NSString *)failureMessageForNotTo:(id)actual; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPUnsupportedObject.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPUnsupportedObject : NSObject { 4 | NSString *_type; 5 | } 6 | 7 | @property (nonatomic, retain) NSString *type; 8 | 9 | - (instancetype)initWithType:(NSString *)type NS_DESIGNATED_INITIALIZER; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/EXPUnsupportedObject.m: -------------------------------------------------------------------------------- 1 | #import "EXPUnsupportedObject.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPUnsupportedObject 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize type=_type; 9 | 10 | - (instancetype)initWithType:(NSString *)type { 11 | self = [super init]; 12 | if(self) { 13 | self.type = type; 14 | } 15 | return self; 16 | } 17 | 18 | - (void)dealloc { 19 | self.type = nil; 20 | [super dealloc]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for Expecta. 4 | FOUNDATION_EXPORT double ExpectaVersionNumber; 5 | 6 | //! Project version string for Expecta. 7 | FOUNDATION_EXPORT const unsigned char ExpectaVersionString[]; 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | // Enable shorthand by default 14 | #define expect(...) EXP_expect((__VA_ARGS__)) 15 | #define failure(...) EXP_failure((__VA_ARGS__)) 16 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/ExpectaObject.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #define EXPObjectify(value) _EXPObjectify(@encode(__typeof__((value))), (value)) 4 | #define EXP_expect(actual) _EXP_expect(self, __LINE__, __FILE__, ^id{ __typeof__((actual)) strongActual = (actual); return EXPObjectify(strongActual); }) 5 | #define EXPMatcherInterface(matcherName, matcherArguments) _EXPMatcherInterface(matcherName, matcherArguments) 6 | #define EXPMatcherImplementationBegin(matcherName, matcherArguments) _EXPMatcherImplementationBegin(matcherName, matcherArguments) 7 | #define EXPMatcherImplementationEnd _EXPMatcherImplementationEnd 8 | #define EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) _EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) 9 | 10 | #define EXP_failure(message) EXPFail(self, __LINE__, __FILE__, message) 11 | 12 | 13 | @interface Expecta : NSObject 14 | 15 | + (NSTimeInterval)asynchronousTestTimeout; 16 | + (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/ExpectaObject.m: -------------------------------------------------------------------------------- 1 | #import "ExpectaObject.h" 2 | 3 | @implementation Expecta 4 | 5 | static NSTimeInterval _asynchronousTestTimeout = 1.0; 6 | 7 | + (NSTimeInterval)asynchronousTestTimeout { 8 | return _asynchronousTestTimeout; 9 | } 10 | 11 | + (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout { 12 | _asynchronousTestTimeout = timeout; 13 | } 14 | 15 | @end -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/ExpectaSupport.h: -------------------------------------------------------------------------------- 1 | #import "EXPExpect.h" 2 | #import "EXPBlockDefinedMatcher.h" 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | id _EXPObjectify(const char *type, ...); 9 | EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock); 10 | 11 | void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message); 12 | NSString *EXPDescribeObject(id obj); 13 | 14 | void EXP_prerequisite(EXPBoolBlock block); 15 | void EXP_match(EXPBoolBlock block); 16 | void EXP_failureMessageForTo(EXPStringBlock block); 17 | void EXP_failureMessageForNotTo(EXPStringBlock block); 18 | 19 | #if __has_feature(objc_arc) 20 | #define _EXP_release(x) 21 | #define _EXP_autorelease(x) (x) 22 | 23 | #else 24 | #define _EXP_release(x) [x release] 25 | #define _EXP_autorelease(x) [x autorelease] 26 | #endif 27 | 28 | // workaround for the categories bug: http://developer.apple.com/library/mac/#qa/qa1490/_index.html 29 | #define EXPFixCategoriesBug(name) \ 30 | __attribute__((constructor)) static void EXPFixCategoriesBug##name() {} 31 | 32 | #define _EXPMatcherInterface(matcherName, matcherArguments) \ 33 | @interface EXPExpect (matcherName##Matcher) \ 34 | @property (nonatomic, readonly) void(^ matcherName) matcherArguments; \ 35 | @end 36 | 37 | #define _EXPMatcherImplementationBegin(matcherName, matcherArguments) \ 38 | EXPFixCategoriesBug(EXPMatcher##matcherName##Matcher); \ 39 | @implementation EXPExpect (matcherName##Matcher) \ 40 | @dynamic matcherName;\ 41 | - (void(^) matcherArguments) matcherName { \ 42 | EXPBlockDefinedMatcher *matcher = [[EXPBlockDefinedMatcher alloc] init]; \ 43 | [[[NSThread currentThread] threadDictionary] setObject:matcher forKey:@"EXP_currentMatcher"]; \ 44 | __block id actual = self.actual; \ 45 | __block void (^prerequisite)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_prerequisite(block); }; \ 46 | __block void (^match)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_match(block); }; \ 47 | __block void (^failureMessageForTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForTo(block); }; \ 48 | __block void (^failureMessageForNotTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForNotTo(block); }; \ 49 | prerequisite(nil); match(nil); failureMessageForTo(nil); failureMessageForNotTo(nil); \ 50 | void (^matcherBlock) matcherArguments = [^ matcherArguments { \ 51 | { 52 | 53 | #define _EXPMatcherImplementationEnd \ 54 | } \ 55 | [self applyMatcher:matcher to:&actual]; \ 56 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:@"EXP_currentMatcher"]; \ 57 | } copy]; \ 58 | _EXP_release(matcher); \ 59 | return _EXP_autorelease(matcherBlock); \ 60 | } \ 61 | @end 62 | 63 | #define _EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) \ 64 | EXPFixCategoriesBug(EXPMatcher##newMatcherName##Matcher); \ 65 | @implementation EXPExpect (newMatcherName##Matcher) \ 66 | @dynamic newMatcherName;\ 67 | - (void(^) matcherArguments) newMatcherName { \ 68 | return [self oldMatcherName]; \ 69 | }\ 70 | @end 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatcherHelpers.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | BOOL EXPIsValuePointer(NSValue *value); 4 | BOOL EXPIsNumberFloat(NSNumber *number); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatcherHelpers.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatcherHelpers.h" 2 | 3 | BOOL EXPIsValuePointer(NSValue *value) { 4 | return [value objCType][0] == @encode(void *)[0]; 5 | } 6 | 7 | BOOL EXPIsNumberFloat(NSNumber *number) { 8 | return strcmp([number objCType], @encode(float)) == 0; 9 | } 10 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beCloseToWithin, (id expected, id within)); 4 | EXPMatcherInterface(beCloseToWithin, (id expected, id within)); 5 | 6 | #define beCloseTo(expected) _beCloseToWithin(EXPObjectify((expected)), nil) 7 | #define beCloseToWithin(expected, range) _beCloseToWithin(EXPObjectify((expected)), EXPObjectify((range))) 8 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beCloseTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beCloseToWithin, (id expected, id within)) { 5 | prerequisite(^BOOL{ 6 | return [actual isKindOfClass:[NSNumber class]] && 7 | [expected isKindOfClass:[NSNumber class]] && 8 | ([within isKindOfClass:[NSNumber class]] || (within == nil)); 9 | }); 10 | 11 | match(^BOOL{ 12 | double actualValue = [actual doubleValue]; 13 | double expectedValue = [expected doubleValue]; 14 | 15 | if (within != nil) { 16 | double withinValue = [within doubleValue]; 17 | double lowerBound = expectedValue - withinValue; 18 | double upperBound = expectedValue + withinValue; 19 | return (actualValue >= lowerBound) && (actualValue <= upperBound); 20 | } else { 21 | double diff = fabs(actualValue - expectedValue); 22 | actualValue = fabs(actualValue); 23 | expectedValue = fabs(expectedValue); 24 | double largest = (expectedValue > actualValue) ? expectedValue : actualValue; 25 | return (diff <= largest * FLT_EPSILON); 26 | } 27 | }); 28 | 29 | failureMessageForTo(^NSString *{ 30 | if (within) { 31 | return [NSString stringWithFormat:@"expected %@ to be close to %@ within %@", 32 | EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)]; 33 | } else { 34 | return [NSString stringWithFormat:@"expected %@ to be close to %@", 35 | EXPDescribeObject(actual), EXPDescribeObject(expected)]; 36 | } 37 | }); 38 | 39 | failureMessageForNotTo(^NSString *{ 40 | if (within) { 41 | return [NSString stringWithFormat:@"expected %@ not to be close to %@ within %@", 42 | EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)]; 43 | } else { 44 | return [NSString stringWithFormat:@"expected %@ not to be close to %@", 45 | EXPDescribeObject(actual), EXPDescribeObject(expected)]; 46 | } 47 | }); 48 | } 49 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beFalsy.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beFalsy, (void)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beFalsy.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beFalsy.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(beFalsy, (void)) { 5 | match(^BOOL{ 6 | if([actual isKindOfClass:[NSNumber class]]) { 7 | return ![(NSNumber *)actual boolValue]; 8 | } else if([actual isKindOfClass:[NSValue class]]) { 9 | if(EXPIsValuePointer((NSValue *)actual)) { 10 | return ![(NSValue *)actual pointerValue]; 11 | } 12 | } 13 | return !actual; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: a falsy value, got: %@, which is truthy", EXPDescribeObject(actual)]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: a non-falsy value, got: %@, which is falsy", EXPDescribeObject(actual)]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beGreaterThan, (id expected)); 4 | EXPMatcherInterface(beGreaterThan, (id expected)); 5 | 6 | #define beGreaterThan(expected) _beGreaterThan(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beGreaterThan.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beGreaterThan, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] == NSOrderedDescending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beGreaterThanOrEqualTo, (id expected)); 4 | EXPMatcherInterface(beGreaterThanOrEqualTo, (id expected)); 5 | 6 | #define beGreaterThanOrEqualTo(expected) _beGreaterThanOrEqualTo(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beGreaterThanOrEqualTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beGreaterThanOrEqualTo, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] != NSOrderedAscending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beIdenticalTo, (void *expected)); 4 | EXPMatcherInterface(beIdenticalTo, (void *expected)); // to aid code completion 5 | 6 | #if __has_feature(objc_arc) 7 | #define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected) 8 | #else 9 | #define beIdenticalTo(expected) _beIdenticalTo(expected) 10 | #endif 11 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+equal.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beIdenticalTo, (void *expected)) { 5 | match(^BOOL{ 6 | if(actual == expected) { 7 | return YES; 8 | } else if([actual isKindOfClass:[NSValue class]] && EXPIsValuePointer((NSValue *)actual)) { 9 | if([(NSValue *)actual pointerValue] == expected) { 10 | return YES; 11 | } 12 | } 13 | return NO; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: <%p>, got: <%p>", expected, actual]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: not <%p>, got: <%p>", expected, actual]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)); 4 | EXPMatcherInterface(beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)); 5 | 6 | #define beInTheRangeOf(expectedLowerBound, expectedUpperBound) _beInTheRangeOf(EXPObjectify((expectedLowerBound)), EXPObjectify((expectedUpperBound))) 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beInTheRangeOf.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | NSComparisonResult compareLowerBound = [expectedLowerBound compare: actual]; 8 | NSComparisonResult compareUpperBound = [expectedUpperBound compare: actual]; 9 | if (compareLowerBound == NSOrderedSame) { 10 | return YES; 11 | } 12 | if (compareUpperBound == NSOrderedSame) { 13 | return YES; 14 | } 15 | if ((compareLowerBound == NSOrderedAscending) && (compareUpperBound == NSOrderedDescending)) { 16 | return YES; 17 | } 18 | } 19 | return NO; 20 | }); 21 | 22 | failureMessageForTo(^NSString *{ 23 | return [NSString stringWithFormat:@"expected: %@ to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)]; 24 | }); 25 | 26 | failureMessageForNotTo(^NSString *{ 27 | return [NSString stringWithFormat:@"expected: %@ not to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)]; 28 | }); 29 | } 30 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beInstanceOf, (Class expected)); 4 | EXPMatcherInterface(beAnInstanceOf, (Class expected)); 5 | EXPMatcherInterface(beMemberOf, (Class expected)); 6 | EXPMatcherInterface(beAMemberOf, (Class expected)); 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beInstanceOf.h" 2 | 3 | EXPMatcherImplementationBegin(beInstanceOf, (Class expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return !(actualIsNil || expectedIsNil); 9 | }); 10 | 11 | match(^BOOL{ 12 | return [actual isMemberOfClass:expected]; 13 | }); 14 | 15 | failureMessageForTo(^NSString *{ 16 | if(actualIsNil) return @"the actual value is nil/null"; 17 | if(expectedIsNil) return @"the expected value is nil/null"; 18 | return [NSString stringWithFormat:@"expected: an instance of %@, got: an instance of %@", [expected class], [actual class]]; 19 | }); 20 | 21 | failureMessageForNotTo(^NSString *{ 22 | if(actualIsNil) return @"the actual value is nil/null"; 23 | if(expectedIsNil) return @"the expected value is nil/null"; 24 | return [NSString stringWithFormat:@"expected: not an instance of %@, got: an instance of %@", [expected class], [actual class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beAnInstanceOf, beInstanceOf, (Class expected)); 30 | EXPMatcherAliasImplementation(beMemberOf, beInstanceOf, (Class expected)); 31 | EXPMatcherAliasImplementation(beAMemberOf, beInstanceOf, (Class expected)); 32 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beKindOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beKindOf, (Class expected)); 4 | EXPMatcherInterface(beAKindOf, (Class expected)); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beKindOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beKindOf.h" 2 | 3 | EXPMatcherImplementationBegin(beKindOf, (Class expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return !(actualIsNil || expectedIsNil); 9 | }); 10 | 11 | match(^BOOL{ 12 | return [actual isKindOfClass:expected]; 13 | }); 14 | 15 | failureMessageForTo(^NSString *{ 16 | if(actualIsNil) return @"the actual value is nil/null"; 17 | if(expectedIsNil) return @"the expected value is nil/null"; 18 | return [NSString stringWithFormat:@"expected: a kind of %@, got: an instance of %@, which is not a kind of %@", [expected class], [actual class], [expected class]]; 19 | }); 20 | 21 | failureMessageForNotTo(^NSString *{ 22 | if(actualIsNil) return @"the actual value is nil/null"; 23 | if(expectedIsNil) return @"the expected value is nil/null"; 24 | return [NSString stringWithFormat:@"expected: not a kind of %@, got: an instance of %@, which is a kind of %@", [expected class], [actual class], [expected class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beAKindOf, beKindOf, (Class expected)); 30 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThan.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beLessThan, (id expected)); 4 | EXPMatcherInterface(beLessThan, (id expected)); 5 | 6 | #define beLessThan(expected) _beLessThan(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThan.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beLessThan.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beLessThan, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] == NSOrderedAscending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beLessThanOrEqualTo, (id expected)); 4 | EXPMatcherInterface(beLessThanOrEqualTo, (id expected)); 5 | 6 | #define beLessThanOrEqualTo(expected) _beLessThanOrEqualTo(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beLessThanOrEqualTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beLessThanOrEqualTo, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] != NSOrderedDescending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beNil.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beNil, (void)); 4 | EXPMatcherInterface(beNull, (void)); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beNil.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beNil.h" 2 | 3 | EXPMatcherImplementationBegin(beNil, (void)) { 4 | match(^BOOL{ 5 | return actual == nil; 6 | }); 7 | 8 | failureMessageForTo(^NSString *{ 9 | return [NSString stringWithFormat:@"expected: nil/null, got: %@", EXPDescribeObject(actual)]; 10 | }); 11 | 12 | failureMessageForNotTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: not nil/null, got: %@", EXPDescribeObject(actual)]; 14 | }); 15 | } 16 | EXPMatcherImplementationEnd 17 | 18 | EXPMatcherAliasImplementation(beNull, beNil, (void)); 19 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beSubclassOf, (Class expected)); 4 | EXPMatcherInterface(beASubclassOf, (Class expected)); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beSubclassOf.h" 2 | #import "NSValue+Expecta.h" 3 | #import 4 | 5 | EXPMatcherImplementationBegin(beSubclassOf, (Class expected)) { 6 | __block BOOL actualIsClass = YES; 7 | 8 | prerequisite(^BOOL { 9 | actualIsClass = class_isMetaClass(object_getClass(actual)); 10 | return actualIsClass; 11 | }); 12 | 13 | match(^BOOL{ 14 | return [actual isSubclassOfClass:expected]; 15 | }); 16 | 17 | failureMessageForTo(^NSString *{ 18 | if(!actualIsClass) return @"the actual value is not a Class"; 19 | return [NSString stringWithFormat:@"expected: a subclass of %@, got: a class %@, which is not a subclass of %@", [expected class], actual, [expected class]]; 20 | }); 21 | 22 | failureMessageForNotTo(^NSString *{ 23 | if(!actualIsClass) return @"the actual value is not a Class"; 24 | return [NSString stringWithFormat:@"expected: not a subclass of %@, got: a class %@, which is a subclass of %@", [expected class], actual, [expected class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beASubclassOf, beSubclassOf, (Class expected)); 30 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beSupersetOf, (id subset)); 4 | 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+contain.h" 2 | 3 | EXPMatcherImplementationBegin(beSupersetOf, (id subset)) { 4 | BOOL actualIsCompatible = [actual isKindOfClass:[NSDictionary class]] || [actual respondsToSelector:@selector(containsObject:)]; 5 | BOOL subsetIsNil = (subset == nil); 6 | 7 | // For some instances the isKindOfClass: method returns false, even though 8 | // they are both actually dictionaries. e.g. Comparing a NSCFDictionary and a 9 | // NSDictionary. 10 | // Or in cases when you compare NSMutableArray (which implementation is __NSArrayM:NSMutableArray:NSArray) 11 | // and NSArray (which implementation is __NSArrayI:NSArray) 12 | BOOL bothAreIdenticalCollectionClasses = ([actual isKindOfClass:[NSDictionary class]] && [subset isKindOfClass:[NSDictionary class]]) || 13 | ([actual isKindOfClass:[NSArray class]] && [subset isKindOfClass:[NSArray class]]) || 14 | ([actual isKindOfClass:[NSSet class]] && [subset isKindOfClass:[NSSet class]]) || 15 | ([actual isKindOfClass:[NSOrderedSet class]] && [subset isKindOfClass:[NSOrderedSet class]]); 16 | 17 | BOOL classMatches = bothAreIdenticalCollectionClasses || [subset isKindOfClass:[actual class]]; 18 | 19 | prerequisite(^BOOL{ 20 | return actualIsCompatible && !subsetIsNil && classMatches; 21 | }); 22 | 23 | match(^BOOL{ 24 | if(!actualIsCompatible) return NO; 25 | 26 | if([actual isKindOfClass:[NSDictionary class]]) { 27 | for (id key in subset) { 28 | id actualValue = [actual valueForKey:key]; 29 | id subsetValue = [subset valueForKey:key]; 30 | 31 | if (![subsetValue isEqual:actualValue]) return NO; 32 | } 33 | } else { 34 | for (id object in subset) { 35 | if (![actual containsObject:object]) return NO; 36 | } 37 | } 38 | 39 | return YES; 40 | }); 41 | 42 | failureMessageForTo(^NSString *{ 43 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)]; 44 | 45 | if(subsetIsNil) return @"the expected value is nil/null"; 46 | 47 | if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)]; 48 | 49 | return [NSString stringWithFormat:@"expected %@ to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)]; 50 | }); 51 | 52 | failureMessageForNotTo(^NSString *{ 53 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)]; 54 | 55 | if(subsetIsNil) return @"the expected value is nil/null"; 56 | 57 | if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)]; 58 | 59 | return [NSString stringWithFormat:@"expected %@ not to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)]; 60 | }); 61 | } 62 | EXPMatcherImplementationEnd 63 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beTruthy.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beTruthy, (void)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beTruthy.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beTruthy.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(beTruthy, (void)) { 5 | match(^BOOL{ 6 | if([actual isKindOfClass:[NSNumber class]]) { 7 | return !![(NSNumber *)actual boolValue]; 8 | } else if([actual isKindOfClass:[NSValue class]]) { 9 | if(EXPIsValuePointer((NSValue *)actual)) { 10 | return !![(NSValue *)actual pointerValue]; 11 | } 12 | } 13 | return !!actual; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: a truthy value, got: %@, which is falsy", EXPDescribeObject(actual)]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: a non-truthy value, got: %@, which is truthy", EXPDescribeObject(actual)]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beginWith.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beginWith, (id expected)); 4 | EXPMatcherInterface(startWith, (id expected)); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+beginWith.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beginWith.h" 2 | 3 | EXPMatcherImplementationBegin(beginWith, (id expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | //This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same 7 | BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]]) 8 | || ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]]) 9 | || ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]])); 10 | 11 | prerequisite(^BOOL { 12 | return actualAndExpectedAreCompatible; 13 | }); 14 | 15 | match(^BOOL { 16 | if ([actual isKindOfClass:[NSString class]]) { 17 | return [actual hasPrefix:expected]; 18 | } else if ([actual isKindOfClass:[NSArray class]]) { 19 | if ([expected count] > [actual count] || [expected count] == 0) { 20 | return NO; 21 | } 22 | NSArray *subArray = [actual subarrayWithRange:NSMakeRange(0, [expected count])]; 23 | return [subArray isEqualToArray:expected]; 24 | } else { 25 | if ([expected count] > [actual count] || [expected count] == 0) { 26 | return NO; 27 | } 28 | 29 | NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange(0, [expected count]) copyItems:NO]; 30 | return [subset isEqualToOrderedSet:expected]; 31 | } 32 | }); 33 | 34 | failureMessageForTo(^NSString *{ 35 | if (actualIsNil) return @"the object is nil/null"; 36 | if (expectedIsNil) return @"the expected value is nil/null"; 37 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 38 | return [NSString stringWithFormat:@"expected: %@ to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 39 | }); 40 | 41 | failureMessageForNotTo(^NSString *{ 42 | if (actualIsNil) return @"the object is nil/null"; 43 | if (expectedIsNil) return @"the expected value is nil/null"; 44 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 45 | 46 | return [NSString stringWithFormat:@"expected: %@ not to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 47 | }); 48 | } 49 | EXPMatcherImplementationEnd 50 | 51 | EXPMatcherAliasImplementation(startWith, beginWith, (id expected)); 52 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+conformTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(conformTo, (Protocol *expected)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+conformTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+conformTo.h" 2 | #import "NSValue+Expecta.h" 3 | #import 4 | 5 | EXPMatcherImplementationBegin(conformTo, (Protocol *expected)) { 6 | BOOL actualIsNil = (actual == nil); 7 | BOOL expectedIsNil = (expected == nil); 8 | 9 | prerequisite(^BOOL{ 10 | return !(actualIsNil || expectedIsNil); 11 | }); 12 | 13 | match(^BOOL{ 14 | return [actual conformsToProtocol:expected]; 15 | }); 16 | 17 | failureMessageForTo(^NSString *{ 18 | if(actualIsNil) return @"the object is nil/null"; 19 | if(expectedIsNil) return @"the protocol is nil/null"; 20 | 21 | NSString *name = NSStringFromProtocol(expected); 22 | return [NSString stringWithFormat:@"expected: %@ to conform to %@", actual, name]; 23 | }); 24 | 25 | failureMessageForNotTo(^NSString *{ 26 | if(actualIsNil) return @"the object is nil/null"; 27 | if(expectedIsNil) return @"the protocol is nil/null"; 28 | 29 | NSString *name = NSStringFromProtocol(expected); 30 | return [NSString stringWithFormat:@"expected: %@ not to conform to %@", actual, name]; 31 | }); 32 | } 33 | EXPMatcherImplementationEnd 34 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+contain.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_contain, (id expected)); 4 | EXPMatcherInterface(contain, (id expected)); // to aid code completion 5 | #define contain(expected) _contain(EXPObjectify((expected))) 6 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+contain.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+contain.h" 2 | 3 | EXPMatcherImplementationBegin(_contain, (id expected)) { 4 | BOOL actualIsCompatible = [actual isKindOfClass:[NSString class]] || [actual conformsToProtocol:@protocol(NSFastEnumeration)]; 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return actualIsCompatible && !expectedIsNil; 9 | }); 10 | 11 | match(^BOOL{ 12 | if(actualIsCompatible) { 13 | if([actual isKindOfClass:[NSString class]]) { 14 | return [(NSString *)actual rangeOfString:[expected description]].location != NSNotFound; 15 | } else { 16 | for (id object in actual) { 17 | if ([object isEqual:expected]) { 18 | return YES; 19 | } 20 | } 21 | } 22 | } 23 | return NO; 24 | }); 25 | 26 | failureMessageForTo(^NSString *{ 27 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)]; 28 | if(expectedIsNil) return @"the expected value is nil/null"; 29 | return [NSString stringWithFormat:@"expected %@ to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 30 | }); 31 | 32 | failureMessageForNotTo(^NSString *{ 33 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)]; 34 | if(expectedIsNil) return @"the expected value is nil/null"; 35 | return [NSString stringWithFormat:@"expected %@ not to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+endWith.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(endWith, (id expected)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+endWith.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+endWith.h" 2 | 3 | EXPMatcherImplementationBegin(endWith, (id expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | //This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same 7 | BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]]) 8 | || ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]]) 9 | || ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]])); 10 | 11 | prerequisite(^BOOL { 12 | return actualAndExpectedAreCompatible; 13 | }); 14 | 15 | match(^BOOL { 16 | if ([actual isKindOfClass:[NSString class]]) { 17 | return [actual hasSuffix:expected]; 18 | } else if ([actual isKindOfClass:[NSArray class]]) { 19 | if ([expected count] > [actual count] || [expected count] == 0) { 20 | return NO; 21 | } 22 | NSArray *subArray = [actual subarrayWithRange:NSMakeRange([actual count] - [expected count], [expected count])]; 23 | return [subArray isEqualToArray:expected]; 24 | } else { 25 | if ([expected count] > [actual count] || [expected count] == 0) { 26 | return NO; 27 | } 28 | 29 | NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange([actual count] - [expected count], [expected count]) copyItems:NO]; 30 | return [subset isEqualToOrderedSet:expected]; 31 | } 32 | }); 33 | 34 | failureMessageForTo(^NSString *{ 35 | if (actualIsNil) return @"the object is nil/null"; 36 | if (expectedIsNil) return @"the expected value is nil/null"; 37 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 38 | return [NSString stringWithFormat:@"expected: %@ to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 39 | }); 40 | 41 | failureMessageForNotTo(^NSString *{ 42 | if (actualIsNil) return @"the object is nil/null"; 43 | if (expectedIsNil) return @"the expected value is nil/null"; 44 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 45 | 46 | return [NSString stringWithFormat:@"expected: %@ not to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 47 | }); 48 | } 49 | EXPMatcherImplementationEnd 50 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+equal.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_equal, (id expected)); 4 | EXPMatcherInterface(equal, (id expected)); // to aid code completion 5 | #define equal(...) _equal(EXPObjectify((__VA_ARGS__))) 6 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+equal.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+equal.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_equal, (id expected)) { 5 | match(^BOOL{ 6 | if((actual == expected) || [actual isEqual:expected]) { 7 | return YES; 8 | } else if([actual isKindOfClass:[NSNumber class]] && [expected isKindOfClass:[NSNumber class]]) { 9 | if([actual isKindOfClass:[NSDecimalNumber class]] || [expected isKindOfClass:[NSDecimalNumber class]]) { 10 | NSDecimalNumber *actualDecimalNumber = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *) actual decimalValue]]; 11 | NSDecimalNumber *expectedDecimalNumber = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *) expected decimalValue]]; 12 | return [actualDecimalNumber isEqualToNumber:expectedDecimalNumber]; 13 | } 14 | else { 15 | if(EXPIsNumberFloat((NSNumber *)actual) || EXPIsNumberFloat((NSNumber *)expected)) { 16 | return [(NSNumber *)actual floatValue] == [(NSNumber *)expected floatValue]; 17 | } 18 | } 19 | } 20 | return NO; 21 | }); 22 | 23 | failureMessageForTo(^NSString *{ 24 | NSString *expectedDescription = EXPDescribeObject(expected); 25 | NSString *actualDescription = EXPDescribeObject(actual); 26 | 27 | if (![expectedDescription isEqualToString:actualDescription]) { 28 | return [NSString stringWithFormat:@"expected: %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)]; 29 | } else { 30 | return [NSString stringWithFormat:@"expected (%@): %@, got (%@): %@", NSStringFromClass([expected class]), EXPDescribeObject(expected), NSStringFromClass([actual class]), EXPDescribeObject(actual)]; 31 | } 32 | }); 33 | 34 | failureMessageForNotTo(^NSString *{ 35 | return [NSString stringWithFormat:@"expected: not %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(haveCountOf, (NSUInteger expected)); 4 | EXPMatcherInterface(haveCount, (NSUInteger expected)); 5 | EXPMatcherInterface(haveACountOf, (NSUInteger expected)); 6 | EXPMatcherInterface(haveLength, (NSUInteger expected)); 7 | EXPMatcherInterface(haveLengthOf, (NSUInteger expected)); 8 | EXPMatcherInterface(haveALengthOf, (NSUInteger expected)); 9 | 10 | #define beEmpty() haveCountOf(0) 11 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+haveCountOf.h" 2 | 3 | EXPMatcherImplementationBegin(haveCountOf, (NSUInteger expected)) { 4 | BOOL actualIsStringy = [actual isKindOfClass:[NSString class]] || [actual isKindOfClass:[NSAttributedString class]]; 5 | BOOL actualIsCompatible = actualIsStringy || [actual respondsToSelector:@selector(count)]; 6 | 7 | prerequisite(^BOOL{ 8 | return actualIsCompatible; 9 | }); 10 | 11 | NSUInteger (^count)(id) = ^(id actual) { 12 | if(actualIsStringy) { 13 | return [actual length]; 14 | } else { 15 | return [actual count]; 16 | } 17 | }; 18 | 19 | match(^BOOL{ 20 | if(actualIsCompatible) { 21 | return count(actual) == expected; 22 | } 23 | return NO; 24 | }); 25 | 26 | failureMessageForTo(^NSString *{ 27 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)]; 28 | return [NSString stringWithFormat:@"expected %@ to have a count of %zi but got %zi", EXPDescribeObject(actual), expected, count(actual)]; 29 | }); 30 | 31 | failureMessageForNotTo(^NSString *{ 32 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)]; 33 | return [NSString stringWithFormat:@"expected %@ not to have a count of %zi", EXPDescribeObject(actual), expected]; 34 | }); 35 | } 36 | EXPMatcherImplementationEnd 37 | 38 | EXPMatcherAliasImplementation(haveCount, haveCountOf, (NSUInteger expected)); 39 | EXPMatcherAliasImplementation(haveACountOf, haveCountOf, (NSUInteger expected)); 40 | EXPMatcherAliasImplementation(haveLength, haveCountOf, (NSUInteger expected)); 41 | EXPMatcherAliasImplementation(haveLengthOf, haveCountOf, (NSUInteger expected)); 42 | EXPMatcherAliasImplementation(haveALengthOf, haveCountOf, (NSUInteger expected)); 43 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+match.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(match, (NSString *expected)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+match.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+match.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(match, (NSString *expected)) { 5 | BOOL actualIsNil = (actual == nil); 6 | BOOL expectedIsNil = (expected == nil); 7 | 8 | __block NSRegularExpression *regex = nil; 9 | __block NSError *regexError = nil; 10 | 11 | prerequisite (^BOOL { 12 | BOOL nilInput = (actualIsNil || expectedIsNil); 13 | if (!nilInput) { 14 | regex = [NSRegularExpression regularExpressionWithPattern:expected options:0 error:®exError]; 15 | } 16 | return !nilInput && regex; 17 | }); 18 | 19 | match(^BOOL { 20 | NSRange range = [regex rangeOfFirstMatchInString:actual options:0 range:NSMakeRange(0, [actual length])]; 21 | return !NSEqualRanges(range, NSMakeRange(NSNotFound, 0)); 22 | }); 23 | 24 | failureMessageForTo(^NSString *{ 25 | if (actualIsNil) return @"the object is nil/null"; 26 | if (expectedIsNil) return @"the expression is nil/null"; 27 | if (regexError) return [NSString stringWithFormat:@"unable to create regular expression from given parameter: %@", [regexError localizedDescription]]; 28 | return [NSString stringWithFormat:@"expected: %@ to match to %@", EXPDescribeObject(actual), expected]; 29 | }); 30 | 31 | failureMessageForNotTo(^NSString *{ 32 | if (actualIsNil) return @"the object is nil/null"; 33 | if (expectedIsNil) return @"the expression is nil/null"; 34 | if (regexError) return [NSString stringWithFormat:@"unable to create regular expression from given parameter: %@", [regexError localizedDescription]]; 35 | return [NSString stringWithFormat:@"expected: %@ not to match to %@", EXPDescribeObject(actual), expected]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+postNotification.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(postNotification, (id expectedNotification)); 4 | EXPMatcherInterface(notify, (id expectedNotification)); 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+raise.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(raise, (NSString *expectedExceptionName)); 4 | #define raiseAny() raise(nil) 5 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+raise.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+raise.h" 2 | #import "EXPDefines.h" 3 | 4 | EXPMatcherImplementationBegin(raise, (NSString *expectedExceptionName)) { 5 | __block NSException *exceptionCaught = nil; 6 | 7 | match(^BOOL{ 8 | BOOL expectedExceptionCaught = NO; 9 | @try { 10 | ((EXPBasicBlock)actual)(); 11 | } @catch(NSException *e) { 12 | exceptionCaught = e; 13 | expectedExceptionCaught = (expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]; 14 | } 15 | return expectedExceptionCaught; 16 | }); 17 | 18 | failureMessageForTo(^NSString *{ 19 | return [NSString stringWithFormat:@"expected: %@, got: %@", 20 | expectedExceptionName ? expectedExceptionName : @"any exception", 21 | exceptionCaught ? [exceptionCaught name] : @"no exception"]; 22 | }); 23 | 24 | failureMessageForNotTo(^NSString *{ 25 | return [NSString stringWithFormat:@"expected: %@, got: %@", 26 | expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception", 27 | exceptionCaught ? [exceptionCaught name] : @"no exception"]; 28 | }); 29 | } 30 | EXPMatcherImplementationEnd 31 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+raiseWithReason.h" 2 | #import "EXPDefines.h" 3 | 4 | EXPMatcherImplementationBegin(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)) { 5 | __block NSException *exceptionCaught = nil; 6 | 7 | match(^BOOL{ 8 | BOOL expectedExceptionCaught = NO; 9 | @try { 10 | ((EXPBasicBlock)actual)(); 11 | } @catch(NSException *e) { 12 | exceptionCaught = e; 13 | expectedExceptionCaught = (((expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]) && 14 | ((expectedReason == nil) || ([[exceptionCaught reason] isEqualToString:expectedReason]))); 15 | } 16 | return expectedExceptionCaught; 17 | }); 18 | 19 | failureMessageForTo(^NSString *{ 20 | return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", 21 | expectedExceptionName ?: @"any exception", 22 | expectedReason ?: @"any reason", 23 | exceptionCaught ? [exceptionCaught name] : @"no exception", 24 | exceptionCaught ? [exceptionCaught reason] : @""]; 25 | }); 26 | 27 | failureMessageForNotTo(^NSString *{ 28 | return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", 29 | expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception", 30 | expectedReason ? [NSString stringWithFormat:@"not '%@'", expectedReason] : @"no reason", 31 | exceptionCaught ? [exceptionCaught name] : @"no exception", 32 | exceptionCaught ? [exceptionCaught reason] : @"no reason"]; 33 | }); 34 | } 35 | EXPMatcherImplementationEnd 36 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+respondTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(respondTo, (SEL expected)); 4 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers+respondTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+respondTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(respondTo, (SEL expected)) { 5 | BOOL actualIsNil = (actual == nil); 6 | BOOL expectedIsNull = (expected == NULL); 7 | 8 | prerequisite (^BOOL { 9 | return !(actualIsNil || expectedIsNull); 10 | }); 11 | 12 | match(^BOOL { 13 | return [actual respondsToSelector:expected]; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | if (actualIsNil) return @"the object is nil/null"; 18 | if (expectedIsNull) return @"the selector is null"; 19 | return [NSString stringWithFormat:@"expected: %@ to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)]; 20 | }); 21 | 22 | failureMessageForNotTo(^NSString *{ 23 | if (actualIsNil) return @"the object is nil/null"; 24 | if (expectedIsNull) return @"the selector is null"; 25 | return [NSString stringWithFormat:@"expected: %@ not to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)]; 26 | }); 27 | } 28 | EXPMatcherImplementationEnd 29 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/Matchers/EXPMatchers.h: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beNil.h" 2 | #import "EXPMatchers+equal.h" 3 | #import "EXPMatchers+beInstanceOf.h" 4 | #import "EXPMatchers+beKindOf.h" 5 | #import "EXPMatchers+beSubclassOf.h" 6 | #import "EXPMatchers+conformTo.h" 7 | #import "EXPMatchers+beTruthy.h" 8 | #import "EXPMatchers+beFalsy.h" 9 | #import "EXPMatchers+contain.h" 10 | #import "EXPMatchers+beSupersetOf.h" 11 | #import "EXPMatchers+haveCountOf.h" 12 | #import "EXPMatchers+beIdenticalTo.h" 13 | #import "EXPMatchers+beGreaterThan.h" 14 | #import "EXPMatchers+beGreaterThanOrEqualTo.h" 15 | #import "EXPMatchers+beLessThan.h" 16 | #import "EXPMatchers+beLessThanOrEqualTo.h" 17 | #import "EXPMatchers+beInTheRangeOf.h" 18 | #import "EXPMatchers+beCloseTo.h" 19 | #import "EXPMatchers+raise.h" 20 | #import "EXPMatchers+raiseWithReason.h" 21 | #import "EXPMatchers+respondTo.h" 22 | #import "EXPMatchers+postNotification.h" 23 | #import "EXPMatchers+beginWith.h" 24 | #import "EXPMatchers+endWith.h" 25 | #import "EXPMatchers+match.h" 26 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/NSObject+Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSObject (Expecta) 4 | 5 | - (void)recordFailureWithDescription:(NSString *)description 6 | inFile:(NSString *)filename 7 | atLine:(NSUInteger)lineNumber 8 | expected:(BOOL)expected; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/NSValue+Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSValue (Expecta) 4 | 5 | @property (nonatomic) const char *_EXP_objCType; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Pods/Expecta/Expecta/NSValue+Expecta.m: -------------------------------------------------------------------------------- 1 | #import "NSValue+Expecta.h" 2 | #import 3 | #import "Expecta.h" 4 | 5 | EXPFixCategoriesBug(NSValue_Expecta); 6 | 7 | @implementation NSValue (Expecta) 8 | 9 | static char _EXP_typeKey; 10 | 11 | - (const char *)_EXP_objCType { 12 | return [(NSString *)objc_getAssociatedObject(self, &_EXP_typeKey) cStringUsingEncoding:NSASCIIStringEncoding]; 13 | } 14 | 15 | - (void)set_EXP_objCType:(const char *)_EXP_objCType { 16 | objc_setAssociatedObject(self, &_EXP_typeKey, 17 | @(_EXP_objCType), 18 | OBJC_ASSOCIATION_COPY_NONATOMIC); 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/Expecta/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPBlockDefinedMatcher.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPBlockDefinedMatcher.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPDefines.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPDoubleTuple.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPDoubleTuple.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPExpect.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPExpect.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPFloatTuple.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPFloatTuple.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatcher.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPMatcher.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatcherHelpers.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatcherHelpers.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beCloseTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beFalsy.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beFalsy.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beGreaterThan.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beGreaterThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beIdenticalTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beInTheRangeOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beInstanceOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beKindOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beKindOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beLessThan.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beLessThan.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beLessThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beNil.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beNil.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beSubclassOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beSupersetOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beTruthy.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beTruthy.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+beginWith.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beginWith.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+conformTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+conformTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+contain.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+contain.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+endWith.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+endWith.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+equal.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+equal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+haveCountOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+match.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+match.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+postNotification.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+postNotification.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+raise.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+raise.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+raiseWithReason.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers+respondTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+respondTo.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPMatchers.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/EXPUnsupportedObject.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPUnsupportedObject.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/ExpectaObject.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/ExpectaObject.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/ExpectaSupport.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/ExpectaSupport.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/NSObject+Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/NSObject+Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Expecta/NSValue+Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/NSValue+Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPBlockDefinedMatcher.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPBlockDefinedMatcher.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPDefines.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPDoubleTuple.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPDoubleTuple.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPExpect.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPExpect.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPFloatTuple.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPFloatTuple.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatcher.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPMatcher.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatcherHelpers.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatcherHelpers.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beCloseTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beFalsy.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beFalsy.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beGreaterThan.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beGreaterThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beIdenticalTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beInTheRangeOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beInstanceOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beKindOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beKindOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beLessThan.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beLessThan.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beLessThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beNil.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beNil.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beSubclassOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beSupersetOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beTruthy.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beTruthy.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+beginWith.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+beginWith.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+conformTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+conformTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+contain.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+contain.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+endWith.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+endWith.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+equal.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+equal.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+haveCountOf.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+match.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+match.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+postNotification.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+postNotification.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+raise.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+raise.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+raiseWithReason.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers+respondTo.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers+respondTo.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPMatchers.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Matchers/EXPMatchers.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/EXPUnsupportedObject.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/EXPUnsupportedObject.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/ExpectaObject.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/ExpectaObject.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/ExpectaSupport.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/ExpectaSupport.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/NSObject+Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/NSObject+Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Expecta/NSValue+Expecta.h: -------------------------------------------------------------------------------- 1 | ../../../Expecta/Expecta/NSValue+Expecta.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../../Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Local Podspecs/Masonry.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Masonry", 3 | "version": "1.1.0", 4 | "license": "MIT", 5 | "summary": "Harness the power of Auto Layout NSLayoutConstraints with a simplified, chainable and expressive syntax.", 6 | "homepage": "https://github.com/cloudkite/Masonry", 7 | "authors": { 8 | "Jonas Budelmann": "jonas.budelmann@gmail.com" 9 | }, 10 | "social_media_url": "http://twitter.com/cloudkite", 11 | "source": { 12 | "git": "https://github.com/cloudkite/Masonry.git", 13 | "tag": "v1.1.0" 14 | }, 15 | "description": "Masonry is a light-weight layout framework which wraps AutoLayout with a nicer syntax.\nMasonry has its own layout DSL which provides a chainable way of describing your\nNSLayoutConstraints which results in layout code which is more concise and readable.\n Masonry supports iOS and Mac OSX.", 16 | "source_files": "Masonry/*.{h,m}", 17 | "ios": { 18 | "frameworks": [ 19 | "Foundation", 20 | "UIKit" 21 | ] 22 | }, 23 | "tvos": { 24 | "frameworks": [ 25 | "Foundation", 26 | "UIKit" 27 | ] 28 | }, 29 | "osx": { 30 | "frameworks": [ 31 | "Foundation", 32 | "AppKit" 33 | ] 34 | }, 35 | "platforms": { 36 | "ios": "6.0", 37 | "osx": "10.7", 38 | "tvos": "9.0" 39 | }, 40 | "requires_arc": true 41 | } 42 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Expecta (1.0.5) 3 | - Masonry (1.1.0) 4 | 5 | DEPENDENCIES: 6 | - Expecta 7 | - Masonry (from `./`) 8 | 9 | EXTERNAL SOURCES: 10 | Masonry: 11 | :path: ./ 12 | 13 | SPEC CHECKSUMS: 14 | Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe 15 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 16 | 17 | PODFILE CHECKSUM: a30c350a250a8af6afde1caabae52ede1d76714b 18 | 19 | COCOAPODS: 1.3.0.beta.2 20 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Expecta/Expecta-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Expecta : NSObject 3 | @end 4 | @implementation PodsDummy_Expecta 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Expecta/Expecta-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Expecta/Expecta.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Expecta 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Expecta" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 6 | OTHER_LDFLAGS = -framework "Foundation" -framework "XCTest" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Expecta 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Masonry" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 4 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Examples/Pods-Masonry iOS Examples-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Masonry 5 | 6 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | Generated by CocoaPods - https://cocoapods.org 26 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Examples/Pods-Masonry iOS Examples-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | License 37 | MIT 38 | Title 39 | Masonry 40 | Type 41 | PSGroupSpecifier 42 | 43 | 44 | FooterText 45 | Generated by CocoaPods - https://cocoapods.org 46 | Title 47 | 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | StringsTable 53 | Acknowledgements 54 | Title 55 | Acknowledgements 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Examples/Pods-Masonry iOS Examples-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Masonry_iOS_Examples : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Masonry_iOS_Examples 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Examples/Pods-Masonry iOS Examples.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 9 | PODS_ROOT = ${SRCROOT}/../Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Examples/Pods-Masonry iOS Examples.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 9 | PODS_ROOT = ${SRCROOT}/../Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Tests/Pods-Masonry iOS Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Expecta 5 | 6 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Tests/Pods-Masonry iOS Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | Expecta 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Tests/Pods-Masonry iOS Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Masonry_iOS_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Masonry_iOS_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Tests/Pods-Masonry iOS Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Expecta" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Expecta" -framework "Foundation" -framework "XCTest" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 10 | PODS_ROOT = ${SRCROOT}/../Pods 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Masonry iOS Tests/Pods-Masonry iOS Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Expecta" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Expecta" -framework "Foundation" -framework "XCTest" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 10 | PODS_ROOT = ${SRCROOT}/../Pods 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MasonryTestsLoader/Pods-MasonryTestsLoader-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Masonry 5 | 6 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | Generated by CocoaPods - https://cocoapods.org 26 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MasonryTestsLoader/Pods-MasonryTestsLoader-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | License 37 | MIT 38 | Title 39 | Masonry 40 | Type 41 | PSGroupSpecifier 42 | 43 | 44 | FooterText 45 | Generated by CocoaPods - https://cocoapods.org 46 | Title 47 | 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | StringsTable 53 | Acknowledgements 54 | Title 55 | Acknowledgements 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MasonryTestsLoader/Pods-MasonryTestsLoader-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_MasonryTestsLoader : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_MasonryTestsLoader 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MasonryTestsLoader/Pods-MasonryTestsLoader.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 9 | PODS_ROOT = ${SRCROOT}/../Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-MasonryTestsLoader/Pods-MasonryTestsLoader.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Expecta" "${PODS_ROOT}/Headers/Public/Masonry" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Expecta" -isystem "${PODS_ROOT}/Headers/Public/Masonry" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.. 9 | PODS_ROOT = ${SRCROOT}/../Pods 10 | -------------------------------------------------------------------------------- /Tests/GcovTestObserver.m: -------------------------------------------------------------------------------- 1 | // 2 | // GcovTestObserver.m 3 | // ClassyTests 4 | // 5 | // Created by Jonas Budelmann on 19/11/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GcovTestObserver : XCTestObserver 12 | @end 13 | 14 | @implementation GcovTestObserver 15 | 16 | - (void)stopObserving { 17 | [super stopObserving]; 18 | UIApplication* application = [UIApplication sharedApplication]; 19 | [application.delegate applicationWillTerminate:application]; 20 | } 21 | 22 | @end -------------------------------------------------------------------------------- /Tests/MasonryTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tests/MasonryTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MasonryTests' target in the 'Masonry' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | 8 | #define EXP_SHORTHAND 9 | #import "XCTest+Spec.h" 10 | 11 | #import "Expecta.h" 12 | 13 | #import "MASUtilities.h" 14 | 15 | #if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1070 16 | #import "NSObject+MASSubscriptSupport.h" 17 | #endif 18 | #endif -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/CASAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CASAppDelegate.h 3 | // MasonryTestsLoader 4 | // 5 | // Created by Jonas Budelmann on 26/11/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CASAppDelegate : UIResponder 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/CASAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CASAppDelegate.m 3 | // MasonryTestsLoader 4 | // 5 | // Created by Jonas Budelmann on 26/11/13. 6 | // 7 | // 8 | 9 | #import "CASAppDelegate.h" 10 | 11 | @implementation CASAppDelegate 12 | 13 | + (void)initialize { 14 | // https://github.com/fastlane/fastlane/issues/3886#issuecomment-224884332 15 | // XCode 7.3 introduced a bug where early registration of a test observer prevented 16 | // default XCTest test observer from being registered. That caused no logs being printed 17 | // onto console, which in result broke several tools that relied on this. 18 | // In order to go around the issue we're deferring registration to allow default 19 | // test observer to register first. 20 | dispatch_async(dispatch_get_main_queue(), ^{ 21 | [[NSUserDefaults standardUserDefaults] setValue:@"XCTestLog,GcovTestObserver" 22 | forKey:@"XCTestObserverClass"]; 23 | }); 24 | } 25 | 26 | - (void)applicationWillTerminate:(UIApplication *)application { 27 | extern void __gcov_flush(void); 28 | __gcov_flush(); 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/MasonryTestsLoader-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/MasonryTestsLoader-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Tests/MasonryTestsLoader/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MasonryTestsLoader 4 | // 5 | // Created by Jonas Budelmann on 26/11/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #import "CASAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CASAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Tests/NSObject+MASSubscriptSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MASSubscriptSupport.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 28/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (MASSubscriptSupport) 12 | 13 | - (id)objectAtIndexedSubscript:(NSUInteger)idx; 14 | - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx; 15 | - (void)setObject:(id)obj forKeyedSubscript:(id )key; 16 | - (id)objectForKeyedSubscript:(id)key; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Tests/Specs/MASConstraintDelegateMock.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraintDelegate.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 28/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint+Private.h" 10 | 11 | @interface MASConstraintDelegateMock : NSObject 12 | 13 | @property (nonatomic, strong) NSMutableArray *constraints; 14 | @property (nonatomic, strong) NSMutableArray *chainedConstraints; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Tests/Specs/MASConstraintDelegateMock.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraintDelegate.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 28/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASConstraintDelegateMock.h" 10 | #import "MASViewConstraint.h" 11 | 12 | @implementation MASConstraintDelegateMock 13 | 14 | - (id)init { 15 | self = [super init]; 16 | if (!self) return nil; 17 | 18 | self.constraints = NSMutableArray.new; 19 | self.chainedConstraints = NSMutableArray.new; 20 | 21 | return self; 22 | } 23 | 24 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { 25 | [self.constraints replaceObjectAtIndex:[self.constraints indexOfObject:constraint] withObject:replacementConstraint]; 26 | } 27 | 28 | - (id)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 29 | [self.chainedConstraints addObject:constraint]; 30 | 31 | MASViewConstraint *viewConstraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:[[MASViewAttribute alloc] initWithView:nil layoutAttribute:layoutAttribute]]; 32 | return viewConstraint; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Tests/Specs/MASViewAttributeSpec.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttributeSpec.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2013-10-09. 6 | // Copyright 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | SpecBegin(MASViewAttributeSpec){ 12 | MAS_VIEW *view; 13 | MASViewAttribute *viewAttribute; 14 | } 15 | 16 | - (void)setUp { 17 | view = [MAS_VIEW new]; 18 | viewAttribute = [[MASViewAttribute alloc] initWithView:view layoutAttribute:NSLayoutAttributeLeft]; 19 | } 20 | 21 | - (void)testIsEqual { 22 | //should return YES whe the view and layoutAttribute are the same 23 | MASViewAttribute *otherViewAttribute = [[MASViewAttribute alloc] initWithView:viewAttribute.view layoutAttribute:viewAttribute.layoutAttribute]; 24 | expect([viewAttribute isEqual:otherViewAttribute]).to.equal(YES); 25 | 26 | //should return NO when the view is different but the layoutAttribute is the same 27 | MAS_VIEW *otherView = [MAS_VIEW new]; 28 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:otherView layoutAttribute:viewAttribute.layoutAttribute]; 29 | expect([viewAttribute isEqual:otherViewAttribute]).to.equal(NO); 30 | 31 | 32 | //should return NO when the view is the same but the layoutAttribute is different 33 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:viewAttribute.view layoutAttribute:NSLayoutAttributeRight]; 34 | expect([viewAttribute isEqual:otherViewAttribute]).to.equal(NO); 35 | 36 | //should return NO when the view is different and the layoutAttribute is different 37 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:otherView layoutAttribute:NSLayoutAttributeRight]; 38 | expect([viewAttribute isEqual:otherViewAttribute]).to.equal(NO); 39 | 40 | //should return NO when non view attribute passed", ^{ 41 | expect([viewAttribute isEqual:NSArray.new]).to.equal(NO); 42 | } 43 | 44 | - (void)testHashing { 45 | //should return the same hash when the view and layoutAttribute are the same 46 | MASViewAttribute *otherViewAttribute = [[MASViewAttribute alloc] initWithView:viewAttribute.view layoutAttribute:viewAttribute.layoutAttribute]; 47 | expect([viewAttribute hash]).to.equal([otherViewAttribute hash]); 48 | 49 | //should return a different hash when the view is different but the layoutAttribute is the same 50 | MAS_VIEW *otherView = [MAS_VIEW new]; 51 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:otherView layoutAttribute:viewAttribute.layoutAttribute]; 52 | expect([viewAttribute hash]).toNot.equal([otherViewAttribute hash]); 53 | 54 | //should return a different hash when the view is the same but the layoutAttribute is different 55 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:viewAttribute.view layoutAttribute:NSLayoutAttributeRight]; 56 | expect([viewAttribute hash]).toNot.equal([otherViewAttribute hash]); 57 | 58 | //should return a different hash when the view is different and the layoutAttribute is different 59 | otherViewAttribute = [[MASViewAttribute alloc] initWithView:otherView layoutAttribute:NSLayoutAttributeRight]; 60 | expect([viewAttribute hash]).toNot.equal([otherViewAttribute hash]); 61 | } 62 | 63 | SpecEnd 64 | -------------------------------------------------------------------------------- /Tests/Specs/NSLayoutConstraint+MASDebugAdditionsSpec.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditionsSpec.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 8/09/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSLayoutConstraint+MASDebugAdditions.h" 10 | #import "View+MASAdditions.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASCompositeConstraint.h" 13 | #import "MASViewConstraint.h" 14 | 15 | SpecBegin(NSLayoutConstraint_MASDebugAdditions) 16 | 17 | - (void)testDisplayViewKey { 18 | MAS_VIEW *newView = MAS_VIEW.new; 19 | newView.mas_key = @"newView"; 20 | 21 | MASLayoutConstraint *layoutConstraint = [MASLayoutConstraint constraintWithItem:newView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:300]; 22 | 23 | layoutConstraint.priority = MASLayoutPriorityDefaultLow; 24 | 25 | NSString *description = [NSString stringWithFormat:@"= 300 ^low>", layoutConstraint, MAS_VIEW.class]; 26 | expect([layoutConstraint description]).to.equal(description); 27 | } 28 | 29 | - (void)testDisplayLayoutConstraintKey { 30 | MAS_VIEW *newView1 = MAS_VIEW.new; 31 | newView1.mas_key = @"newView1"; 32 | MAS_VIEW *newView2 = MAS_VIEW.new; 33 | newView2.mas_key = @"newView2"; 34 | 35 | MASLayoutConstraint *layoutConstraint = [MASLayoutConstraint constraintWithItem:newView1 attribute:NSLayoutAttributeBaseline relatedBy:NSLayoutRelationEqual toItem:newView2 attribute:NSLayoutAttributeTop multiplier:2 constant:300]; 36 | layoutConstraint.mas_key = @"helloConstraint"; 37 | 38 | NSString *description = [NSString stringWithFormat:@"", MAS_VIEW.class, MAS_VIEW.class]; 39 | expect([layoutConstraint description]).to.equal(description); 40 | } 41 | 42 | - (void)testDisplayConstraintKey { 43 | MAS_VIEW *superview = MAS_VIEW.new; 44 | MAS_VIEW *newView1 = MAS_VIEW.new; 45 | newView1.mas_key = @"newView1"; 46 | MAS_VIEW *newView2 = MAS_VIEW.new; 47 | newView2.mas_key = @"newView2"; 48 | [superview addSubview:newView1]; 49 | [superview addSubview:newView2]; 50 | 51 | [newView1 mas_makeConstraints:^(MASConstraintMaker *make) { 52 | make.left.greaterThanOrEqualTo(@[newView2, @10]).key(@"left"); 53 | }]; 54 | 55 | 56 | NSString *description = [NSString stringWithFormat:@"= %@:newView2.left>", MAS_VIEW.class, MAS_VIEW.class]; 57 | expect([superview.constraints[0] description]).to.equal(description); 58 | } 59 | 60 | SpecEnd -------------------------------------------------------------------------------- /Tests/Specs/View+MASAdditionsSpec.m: -------------------------------------------------------------------------------- 1 | // 2 | // View+MASAdditionsSpec.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 8/09/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | 11 | SpecBegin(View_MASAdditions) 12 | 13 | - (void)testSetTranslatesAutoresizingMaskIntoConstraints { 14 | MAS_VIEW *newView = MAS_VIEW.new; 15 | [newView mas_makeConstraints:^(MASConstraintMaker *make) { 16 | expect(make.updateExisting).to.beFalsy(); 17 | }]; 18 | 19 | expect(newView.translatesAutoresizingMaskIntoConstraints).to.beFalsy(); 20 | } 21 | 22 | - (void)testSetUpdateExisting { 23 | MAS_VIEW *newView = MAS_VIEW.new; 24 | [newView mas_updateConstraints:^(MASConstraintMaker *make) { 25 | expect(make.updateExisting).to.beTruthy(); 26 | }]; 27 | 28 | expect(newView.translatesAutoresizingMaskIntoConstraints).to.beFalsy(); 29 | } 30 | 31 | - (void)testSetRemoveExisting { 32 | MAS_VIEW *newView = MAS_VIEW.new; 33 | [newView mas_remakeConstraints:^(MASConstraintMaker *make) { 34 | expect(make.removeExisting).to.beTruthy(); 35 | }]; 36 | 37 | expect(newView.translatesAutoresizingMaskIntoConstraints).to.beFalsy(); 38 | } 39 | 40 | SpecEnd -------------------------------------------------------------------------------- /Tests/Specs/ViewController+MASAdditionsSpec.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+MASAdditionsSpec.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | #import "View+MASAdditions.h" 11 | 12 | SpecBegin(ViewController_MASAdditions) 13 | 14 | - (void)testLayoutGuideConstraints { 15 | #ifdef MAS_VIEW_CONTROLLER 16 | MAS_VIEW_CONTROLLER *vc = [MAS_VIEW_CONTROLLER new]; 17 | MAS_VIEW *view = [MAS_VIEW new]; 18 | 19 | [vc.view addSubview:view]; 20 | 21 | [view mas_makeConstraints:^(MASConstraintMaker *make) { 22 | make.top.equalTo(vc.mas_topLayoutGuide); 23 | make.bottom.equalTo(vc.mas_bottomLayoutGuide); 24 | }]; 25 | 26 | expect(vc.view.constraints).to.haveCountOf(6); 27 | #endif 28 | } 29 | 30 | SpecEnd -------------------------------------------------------------------------------- /Tests/XCTest+Spec.h: -------------------------------------------------------------------------------- 1 | // 2 | // Spec.h 3 | // ClassyTests 4 | // 5 | // Created by Jonas Budelmann on 18/10/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | // declare XCTestCase subclass interface and implementation 13 | #define SpecBegin(name) \ 14 | @interface name##Spec : XCTestCase @end \ 15 | @implementation name##Spec 16 | 17 | // close XCTestCase 18 | #define SpecEnd \ 19 | @end -------------------------------------------------------------------------------- /script/coveralls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source script/env.sh 4 | declare -r gcov_dir="${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/" 5 | 6 | ## ====== 7 | 8 | generateGcov() 9 | { 10 | # doesn't set output dir to gcov... 11 | cd "${gcov_dir}" 12 | for file in ${gcov_dir}/*.gcda 13 | do 14 | gcov-4.2 "${file}" -o "${gcov_dir}" 15 | done 16 | cd - 17 | } 18 | 19 | copyGcovToProjectDir() 20 | { 21 | cp -r "${gcov_dir}" gcov 22 | } 23 | 24 | removeGcov() 25 | { 26 | rm -r gcov 27 | } 28 | 29 | main() 30 | { 31 | # generate + copy 32 | generateGcov 33 | copyGcovToProjectDir 34 | # post 35 | coveralls ${@+"$@"} 36 | # clean up 37 | removeGcov 38 | } 39 | 40 | main ${@+"$@"} -------------------------------------------------------------------------------- /script/exportenv.sh: -------------------------------------------------------------------------------- 1 | export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > script/env.sh --------------------------------------------------------------------------------