├── .gitignore ├── AdaptiveAutoLayout.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AdaptiveAutoLayout.xcworkspace └── contents.xcworkspacedata ├── AdaptiveAutoLayout ├── AdaptiveAutoLayout-Bridging-Header.h ├── AppDelegate.swift ├── Base.lproj │ └── LaunchScreen.xib ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist └── ViewController.swift ├── AdaptiveAutoLayoutTests ├── AdaptiveAutoLayoutTests.swift └── Info.plist ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ └── Private │ │ └── PureLayout │ │ ├── ALView+PureLayout.h │ │ ├── NSArray+PureLayout.h │ │ ├── NSLayoutConstraint+PureLayout.h │ │ ├── PureLayout+Internal.h │ │ ├── PureLayout.h │ │ └── PureLayoutDefines.h ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj ├── PureLayout │ ├── LICENSE │ ├── PureLayout │ │ └── PureLayout │ │ │ ├── ALView+PureLayout.h │ │ │ ├── ALView+PureLayout.m │ │ │ ├── NSArray+PureLayout.h │ │ │ ├── NSArray+PureLayout.m │ │ │ ├── NSLayoutConstraint+PureLayout.h │ │ │ ├── NSLayoutConstraint+PureLayout.m │ │ │ ├── PureLayout+Internal.h │ │ │ ├── PureLayout.h │ │ │ └── PureLayoutDefines.h │ └── README.md └── Target Support Files │ ├── Pods │ ├── Info.plist │ ├── Pods-acknowledgements.markdown │ ├── Pods-acknowledgements.plist │ ├── Pods-dummy.m │ ├── Pods-frameworks.sh │ ├── Pods-resources.sh │ ├── Pods-umbrella.h │ ├── Pods.debug.xcconfig │ ├── Pods.modulemap │ └── Pods.release.xcconfig │ └── PureLayout │ ├── Info.plist │ ├── PureLayout-Private.xcconfig │ ├── PureLayout-dummy.m │ ├── PureLayout-prefix.pch │ ├── PureLayout-umbrella.h │ ├── PureLayout.modulemap │ └── PureLayout.xcconfig └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B10469FD1A7EFBF30017187F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10469FC1A7EFBF30017187F /* AppDelegate.swift */; }; 11 | B10469FF1A7EFBF30017187F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10469FE1A7EFBF30017187F /* ViewController.swift */; }; 12 | B1046A041A7EFBF30017187F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B1046A031A7EFBF30017187F /* Images.xcassets */; }; 13 | B1046A071A7EFBF30017187F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = B1046A051A7EFBF30017187F /* LaunchScreen.xib */; }; 14 | B1046A131A7EFBF30017187F /* AdaptiveAutoLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1046A121A7EFBF30017187F /* AdaptiveAutoLayoutTests.swift */; }; 15 | DA2CB4E18295184AEBC70D2D /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBEE6B5A2789C514B455E707 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | B1046A0D1A7EFBF30017187F /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = B10469EF1A7EFBF30017187F /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = B10469F61A7EFBF30017187F; 24 | remoteInfo = AdaptiveAutoLayout; 25 | }; 26 | /* End PBXContainerItemProxy section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 2D01FA5D08A78F8264E6854C /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 30 | B10469F71A7EFBF30017187F /* AdaptiveAutoLayout.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdaptiveAutoLayout.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | B10469FB1A7EFBF30017187F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | B10469FC1A7EFBF30017187F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | B10469FE1A7EFBF30017187F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | B1046A031A7EFBF30017187F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 35 | B1046A061A7EFBF30017187F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 36 | B1046A0C1A7EFBF30017187F /* AdaptiveAutoLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdaptiveAutoLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | B1046A111A7EFBF30017187F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | B1046A121A7EFBF30017187F /* AdaptiveAutoLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdaptiveAutoLayoutTests.swift; sourceTree = ""; }; 39 | B1046A3B1A7F02F00017187F /* AdaptiveAutoLayout-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AdaptiveAutoLayout-Bridging-Header.h"; sourceTree = ""; }; 40 | BBEE6B5A2789C514B455E707 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | E969F6494E6A3490355FC555 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | B10469F41A7EFBF30017187F /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | DA2CB4E18295184AEBC70D2D /* Pods.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | B1046A091A7EFBF30017187F /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 6DEFA24722800D0AAE06E630 /* Frameworks */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | BBEE6B5A2789C514B455E707 /* Pods.framework */, 67 | ); 68 | name = Frameworks; 69 | sourceTree = ""; 70 | }; 71 | A7EE20C354BD254FE187DDF6 /* Pods */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | E969F6494E6A3490355FC555 /* Pods.debug.xcconfig */, 75 | 2D01FA5D08A78F8264E6854C /* Pods.release.xcconfig */, 76 | ); 77 | name = Pods; 78 | sourceTree = ""; 79 | }; 80 | B10469EE1A7EFBF30017187F = { 81 | isa = PBXGroup; 82 | children = ( 83 | B10469F91A7EFBF30017187F /* AdaptiveAutoLayout */, 84 | B1046A0F1A7EFBF30017187F /* AdaptiveAutoLayoutTests */, 85 | B10469F81A7EFBF30017187F /* Products */, 86 | A7EE20C354BD254FE187DDF6 /* Pods */, 87 | 6DEFA24722800D0AAE06E630 /* Frameworks */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | B10469F81A7EFBF30017187F /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | B10469F71A7EFBF30017187F /* AdaptiveAutoLayout.app */, 95 | B1046A0C1A7EFBF30017187F /* AdaptiveAutoLayoutTests.xctest */, 96 | ); 97 | name = Products; 98 | sourceTree = ""; 99 | }; 100 | B10469F91A7EFBF30017187F /* AdaptiveAutoLayout */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | B10469FC1A7EFBF30017187F /* AppDelegate.swift */, 104 | B10469FE1A7EFBF30017187F /* ViewController.swift */, 105 | B1046A3B1A7F02F00017187F /* AdaptiveAutoLayout-Bridging-Header.h */, 106 | B1046A031A7EFBF30017187F /* Images.xcassets */, 107 | B1046A051A7EFBF30017187F /* LaunchScreen.xib */, 108 | B10469FA1A7EFBF30017187F /* Supporting Files */, 109 | ); 110 | path = AdaptiveAutoLayout; 111 | sourceTree = ""; 112 | }; 113 | B10469FA1A7EFBF30017187F /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | B10469FB1A7EFBF30017187F /* Info.plist */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | B1046A0F1A7EFBF30017187F /* AdaptiveAutoLayoutTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | B1046A121A7EFBF30017187F /* AdaptiveAutoLayoutTests.swift */, 125 | B1046A101A7EFBF30017187F /* Supporting Files */, 126 | ); 127 | path = AdaptiveAutoLayoutTests; 128 | sourceTree = ""; 129 | }; 130 | B1046A101A7EFBF30017187F /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | B1046A111A7EFBF30017187F /* Info.plist */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | B10469F61A7EFBF30017187F /* AdaptiveAutoLayout */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = B1046A161A7EFBF30017187F /* Build configuration list for PBXNativeTarget "AdaptiveAutoLayout" */; 144 | buildPhases = ( 145 | 37CB941D990C89783D9F1ACE /* Check Pods Manifest.lock */, 146 | B10469F31A7EFBF30017187F /* Sources */, 147 | B10469F41A7EFBF30017187F /* Frameworks */, 148 | B10469F51A7EFBF30017187F /* Resources */, 149 | EAE3E397FAC922DA7E0E014B /* Copy Pods Resources */, 150 | E7AC754B9C9E28166A6E2A40 /* Embed Pods Frameworks */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = AdaptiveAutoLayout; 157 | productName = AdaptiveAutoLayout; 158 | productReference = B10469F71A7EFBF30017187F /* AdaptiveAutoLayout.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | B1046A0B1A7EFBF30017187F /* AdaptiveAutoLayoutTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = B1046A191A7EFBF30017187F /* Build configuration list for PBXNativeTarget "AdaptiveAutoLayoutTests" */; 164 | buildPhases = ( 165 | B1046A081A7EFBF30017187F /* Sources */, 166 | B1046A091A7EFBF30017187F /* Frameworks */, 167 | B1046A0A1A7EFBF30017187F /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | B1046A0E1A7EFBF30017187F /* PBXTargetDependency */, 173 | ); 174 | name = AdaptiveAutoLayoutTests; 175 | productName = AdaptiveAutoLayoutTests; 176 | productReference = B1046A0C1A7EFBF30017187F /* AdaptiveAutoLayoutTests.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | B10469EF1A7EFBF30017187F /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastSwiftMigration = 0700; 186 | LastSwiftUpdateCheck = 0700; 187 | LastUpgradeCheck = 0610; 188 | TargetAttributes = { 189 | B10469F61A7EFBF30017187F = { 190 | CreatedOnToolsVersion = 6.1.1; 191 | }; 192 | B1046A0B1A7EFBF30017187F = { 193 | CreatedOnToolsVersion = 6.1.1; 194 | TestTargetID = B10469F61A7EFBF30017187F; 195 | }; 196 | }; 197 | }; 198 | buildConfigurationList = B10469F21A7EFBF30017187F /* Build configuration list for PBXProject "AdaptiveAutoLayout" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | en, 204 | Base, 205 | ); 206 | mainGroup = B10469EE1A7EFBF30017187F; 207 | productRefGroup = B10469F81A7EFBF30017187F /* Products */; 208 | projectDirPath = ""; 209 | projectRoot = ""; 210 | targets = ( 211 | B10469F61A7EFBF30017187F /* AdaptiveAutoLayout */, 212 | B1046A0B1A7EFBF30017187F /* AdaptiveAutoLayoutTests */, 213 | ); 214 | }; 215 | /* End PBXProject section */ 216 | 217 | /* Begin PBXResourcesBuildPhase section */ 218 | B10469F51A7EFBF30017187F /* Resources */ = { 219 | isa = PBXResourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | B1046A071A7EFBF30017187F /* LaunchScreen.xib in Resources */, 223 | B1046A041A7EFBF30017187F /* Images.xcassets in Resources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | B1046A0A1A7EFBF30017187F /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXResourcesBuildPhase section */ 235 | 236 | /* Begin PBXShellScriptBuildPhase section */ 237 | 37CB941D990C89783D9F1ACE /* Check Pods Manifest.lock */ = { 238 | isa = PBXShellScriptBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | inputPaths = ( 243 | ); 244 | name = "Check Pods Manifest.lock"; 245 | outputPaths = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | shellPath = /bin/sh; 249 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 250 | showEnvVarsInLog = 0; 251 | }; 252 | E7AC754B9C9E28166A6E2A40 /* Embed Pods Frameworks */ = { 253 | isa = PBXShellScriptBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | inputPaths = ( 258 | ); 259 | name = "Embed Pods Frameworks"; 260 | outputPaths = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | shellPath = /bin/sh; 264 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; 265 | showEnvVarsInLog = 0; 266 | }; 267 | EAE3E397FAC922DA7E0E014B /* Copy Pods Resources */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | inputPaths = ( 273 | ); 274 | name = "Copy Pods Resources"; 275 | outputPaths = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | shellPath = /bin/sh; 279 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 280 | showEnvVarsInLog = 0; 281 | }; 282 | /* End PBXShellScriptBuildPhase section */ 283 | 284 | /* Begin PBXSourcesBuildPhase section */ 285 | B10469F31A7EFBF30017187F /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | B10469FF1A7EFBF30017187F /* ViewController.swift in Sources */, 290 | B10469FD1A7EFBF30017187F /* AppDelegate.swift in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | B1046A081A7EFBF30017187F /* Sources */ = { 295 | isa = PBXSourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | B1046A131A7EFBF30017187F /* AdaptiveAutoLayoutTests.swift in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXTargetDependency section */ 305 | B1046A0E1A7EFBF30017187F /* PBXTargetDependency */ = { 306 | isa = PBXTargetDependency; 307 | target = B10469F61A7EFBF30017187F /* AdaptiveAutoLayout */; 308 | targetProxy = B1046A0D1A7EFBF30017187F /* PBXContainerItemProxy */; 309 | }; 310 | /* End PBXTargetDependency section */ 311 | 312 | /* Begin PBXVariantGroup section */ 313 | B1046A051A7EFBF30017187F /* LaunchScreen.xib */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | B1046A061A7EFBF30017187F /* Base */, 317 | ); 318 | name = LaunchScreen.xib; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | B1046A141A7EFBF30017187F /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | ENABLE_STRICT_OBJC_MSGSEND = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_DYNAMIC_NO_PIC = NO; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | GCC_PREPROCESSOR_DEFINITIONS = ( 348 | "DEBUG=1", 349 | "$(inherited)", 350 | ); 351 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 354 | GCC_WARN_UNDECLARED_SELECTOR = YES; 355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 356 | GCC_WARN_UNUSED_FUNCTION = YES; 357 | GCC_WARN_UNUSED_VARIABLE = YES; 358 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 359 | MTL_ENABLE_DEBUG_INFO = YES; 360 | ONLY_ACTIVE_ARCH = YES; 361 | SDKROOT = iphoneos; 362 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 363 | TARGETED_DEVICE_FAMILY = "1,2"; 364 | }; 365 | name = Debug; 366 | }; 367 | B1046A151A7EFBF30017187F /* Release */ = { 368 | isa = XCBuildConfiguration; 369 | buildSettings = { 370 | ALWAYS_SEARCH_USER_PATHS = NO; 371 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 372 | CLANG_CXX_LIBRARY = "libc++"; 373 | CLANG_ENABLE_MODULES = YES; 374 | CLANG_ENABLE_OBJC_ARC = YES; 375 | CLANG_WARN_BOOL_CONVERSION = YES; 376 | CLANG_WARN_CONSTANT_CONVERSION = YES; 377 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 378 | CLANG_WARN_EMPTY_BODY = YES; 379 | CLANG_WARN_ENUM_CONVERSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 385 | COPY_PHASE_STRIP = YES; 386 | ENABLE_NS_ASSERTIONS = NO; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | GCC_C_LANGUAGE_STANDARD = gnu99; 389 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 390 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 391 | GCC_WARN_UNDECLARED_SELECTOR = YES; 392 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 393 | GCC_WARN_UNUSED_FUNCTION = YES; 394 | GCC_WARN_UNUSED_VARIABLE = YES; 395 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 396 | MTL_ENABLE_DEBUG_INFO = NO; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | VALIDATE_PRODUCT = YES; 400 | }; 401 | name = Release; 402 | }; 403 | B1046A171A7EFBF30017187F /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | baseConfigurationReference = E969F6494E6A3490355FC555 /* Pods.debug.xcconfig */; 406 | buildSettings = { 407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 408 | CLANG_ENABLE_MODULES = YES; 409 | INFOPLIST_FILE = AdaptiveAutoLayout/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | SWIFT_OBJC_BRIDGING_HEADER = "AdaptiveAutoLayout/AdaptiveAutoLayout-Bridging-Header.h"; 413 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 414 | }; 415 | name = Debug; 416 | }; 417 | B1046A181A7EFBF30017187F /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | baseConfigurationReference = 2D01FA5D08A78F8264E6854C /* Pods.release.xcconfig */; 420 | buildSettings = { 421 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 422 | CLANG_ENABLE_MODULES = YES; 423 | INFOPLIST_FILE = AdaptiveAutoLayout/Info.plist; 424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | SWIFT_OBJC_BRIDGING_HEADER = "AdaptiveAutoLayout/AdaptiveAutoLayout-Bridging-Header.h"; 427 | }; 428 | name = Release; 429 | }; 430 | B1046A1A1A7EFBF30017187F /* Debug */ = { 431 | isa = XCBuildConfiguration; 432 | buildSettings = { 433 | BUNDLE_LOADER = "$(TEST_HOST)"; 434 | FRAMEWORK_SEARCH_PATHS = ( 435 | "$(SDKROOT)/Developer/Library/Frameworks", 436 | "$(inherited)", 437 | ); 438 | GCC_PREPROCESSOR_DEFINITIONS = ( 439 | "DEBUG=1", 440 | "$(inherited)", 441 | ); 442 | INFOPLIST_FILE = AdaptiveAutoLayoutTests/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdaptiveAutoLayout.app/AdaptiveAutoLayout"; 446 | }; 447 | name = Debug; 448 | }; 449 | B1046A1B1A7EFBF30017187F /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | BUNDLE_LOADER = "$(TEST_HOST)"; 453 | FRAMEWORK_SEARCH_PATHS = ( 454 | "$(SDKROOT)/Developer/Library/Frameworks", 455 | "$(inherited)", 456 | ); 457 | INFOPLIST_FILE = AdaptiveAutoLayoutTests/Info.plist; 458 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdaptiveAutoLayout.app/AdaptiveAutoLayout"; 461 | }; 462 | name = Release; 463 | }; 464 | /* End XCBuildConfiguration section */ 465 | 466 | /* Begin XCConfigurationList section */ 467 | B10469F21A7EFBF30017187F /* Build configuration list for PBXProject "AdaptiveAutoLayout" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | B1046A141A7EFBF30017187F /* Debug */, 471 | B1046A151A7EFBF30017187F /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | B1046A161A7EFBF30017187F /* Build configuration list for PBXNativeTarget "AdaptiveAutoLayout" */ = { 477 | isa = XCConfigurationList; 478 | buildConfigurations = ( 479 | B1046A171A7EFBF30017187F /* Debug */, 480 | B1046A181A7EFBF30017187F /* Release */, 481 | ); 482 | defaultConfigurationIsVisible = 0; 483 | defaultConfigurationName = Release; 484 | }; 485 | B1046A191A7EFBF30017187F /* Build configuration list for PBXNativeTarget "AdaptiveAutoLayoutTests" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | B1046A1A1A7EFBF30017187F /* Debug */, 489 | B1046A1B1A7EFBF30017187F /* Release */, 490 | ); 491 | defaultConfigurationIsVisible = 0; 492 | defaultConfigurationName = Release; 493 | }; 494 | /* End XCConfigurationList section */ 495 | }; 496 | rootObject = B10469EF1A7EFBF30017187F /* Project object */; 497 | } 498 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout/AdaptiveAutoLayout-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AdaptiveAutoLayout 4 | // 5 | // Copyright (c) 2015 Tyler Fox 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 16 | // Override point for customization after application launch. 17 | window = UIWindow(frame: UIScreen.mainScreen().bounds) 18 | window!.rootViewController = ViewController() 19 | window!.makeKeyAndVisible() 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(application: UIApplication) { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout/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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /AdaptiveAutoLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.smileyborg.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UIStatusBarStyle 34 | UIStatusBarStyleLightContent 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 | -------------------------------------------------------------------------------- /AdaptiveAutoLayout/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // AdaptiveAutoLayout 4 | // 5 | // Copyright (c) 2015 Tyler Fox 6 | // 7 | 8 | import UIKit 9 | import PureLayout 10 | 11 | /** A simple function that interpolates between two CGFloat values. */ 12 | func interpolateCGFloat(start start: CGFloat, end: CGFloat, progress: CGFloat) -> CGFloat { 13 | return start * (1.0 - progress) + end * progress 14 | } 15 | 16 | /** A simple function that interpolates between two CGRect values. */ 17 | func interpolateCGRect(start start: CGRect, end: CGRect, progress: CGFloat) -> CGRect { 18 | let x = interpolateCGFloat(start: start.origin.x, end: end.origin.x, progress: progress) 19 | let y = interpolateCGFloat(start: start.origin.y, end: end.origin.y, progress: progress) 20 | let width = interpolateCGFloat(start: start.size.width, end: end.size.width, progress: progress) 21 | let height = interpolateCGFloat(start: start.size.height, end: end.size.height, progress: progress) 22 | return CGRect(x: x, y: y, width: width, height: height) 23 | } 24 | 25 | 26 | class ViewController: UIViewController { 27 | 28 | let redView = UIView.newAutoLayoutView() 29 | let blueView = UIView.newAutoLayoutView() 30 | let greenView = UIView() 31 | 32 | override func loadView() { 33 | view = UIView() 34 | view.backgroundColor = UIColor(red: 30/255.0, green: 29/255.0, blue: 31/255.0, alpha: 1.0) 35 | redView.backgroundColor = UIColor(red: 255/255.0, green: 84/255.0, blue: 62/255.0, alpha: 1.0) 36 | blueView.backgroundColor = UIColor(red: 0/255.0, green: 145/255.0, blue: 255/255.0, alpha: 1.0) 37 | greenView.backgroundColor = UIColor(red: 87/255.0, green: 220/255.0, blue: 119/255.0, alpha: 1.0) 38 | greenView.layer.cornerRadius = 10 39 | view.addSubview(redView) 40 | view.addSubview(blueView) 41 | view.addSubview(greenView) 42 | view.setNeedsUpdateConstraints() // bootstrap the auto layout engine 43 | } 44 | 45 | override func viewDidLoad() { 46 | super.viewDidLoad() 47 | 48 | let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: "viewPanned:") 49 | view.addGestureRecognizer(panGestureRecognizer) 50 | } 51 | 52 | var didSetupConstraints = false 53 | 54 | override func updateViewConstraints() { 55 | if (!didSetupConstraints) { 56 | // Setup the "real" constraints for the views 57 | setupConstraintsForRedView(redView, blueView: blueView) 58 | didSetupConstraints = true 59 | } 60 | 61 | super.updateViewConstraints() 62 | } 63 | 64 | /** Creates and activates constraints for the red and blue views passed in. Note: both views must share a common superview. */ 65 | func setupConstraintsForRedView(redView: UIView, blueView: UIView) { 66 | let margin: CGFloat = 30.0 67 | 68 | redView.autoMatchDimension(.Width, toDimension: .Width, ofView: redView.superview!, withMultiplier: 0.5) 69 | redView.autoSetDimension(.Height, toSize: 60.0) 70 | redView.autoPinEdgeToSuperviewEdge(.Top, withInset: margin) 71 | redView.autoPinEdgeToSuperviewEdge(.Left, withInset: margin) 72 | 73 | blueView.autoSetDimensionsToSize(CGSize(width: 40.0, height: 120.0)) 74 | blueView.autoPinEdgeToSuperviewEdge(.Bottom, withInset: margin) 75 | blueView.autoPinEdgeToSuperviewEdge(.Right, withInset: margin) 76 | } 77 | 78 | /** A tuple that stores the start & end frames for the green view. */ 79 | var greenViewFrames: (start: CGRect, end: CGRect)! 80 | /** Flag used to do one initial calculation of the green view's frame after the first load, as viewWillTransitionToSize... is not called at this time. */ 81 | var didInitialCalculation = false 82 | 83 | override func viewDidLayoutSubviews() { 84 | super.viewDidLayoutSubviews() 85 | 86 | if (!didInitialCalculation) { 87 | greenViewFrames = calculateGreenViewFramesWithViewBounds(view.bounds) 88 | updateGreenView() 89 | didInitialCalculation = true 90 | } 91 | } 92 | 93 | override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { 94 | super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) 95 | 96 | coordinator.animateAlongsideTransition( 97 | { [unowned self] (context) -> Void in 98 | self.greenViewFrames = self.calculateGreenViewFramesWithViewBounds(self.view.bounds) 99 | self.updateGreenView() 100 | }, 101 | completion: nil) 102 | } 103 | 104 | /** Calculates the start & end frames of the green view based on the given bounds for the view controller's view. Returns a tuple containing the start and end frames. 105 | Utilizes transient offscreen views for layout calculation purposes. */ 106 | func calculateGreenViewFramesWithViewBounds(bounds: CGRect) -> (start: CGRect, end: CGRect) { 107 | let offscreenContainer = UIView() // need a root-level view in the offscreen hierarchy to contain the views we are interested in 108 | let oVCView = UIView() // this is an offscreen view that represents this view controller's (onscreen) view 109 | // Create the offscreen versions of the other onscreen views (the `o` prefix is for offscreen) 110 | let oRedView = UIView.newAutoLayoutView() 111 | let oBlueView = UIView.newAutoLayoutView() 112 | let oGreenView = UIView.newAutoLayoutView() 113 | 114 | offscreenContainer.addSubview(oVCView) 115 | oVCView.frame = bounds 116 | 117 | oVCView.addSubview(oRedView) 118 | oVCView.addSubview(oBlueView) 119 | setupConstraintsForRedView(oRedView, blueView: oBlueView) 120 | 121 | oRedView.addSubview(oGreenView) 122 | oGreenView.autoPinEdgesToSuperviewMargins() 123 | oVCView.setNeedsLayout() 124 | oVCView.layoutIfNeeded() 125 | let greenViewFrameStart = oVCView.convertRect(oGreenView.bounds, fromView: oGreenView) 126 | 127 | oBlueView.addSubview(oGreenView) // implictly removes oGreenView from its superview, as well as its constraints 128 | oGreenView.autoPinEdgesToSuperviewMargins() 129 | oVCView.setNeedsLayout() 130 | oVCView.layoutIfNeeded() 131 | let greenViewFrameEnd = oVCView.convertRect(oGreenView.bounds, fromView: oGreenView) 132 | 133 | return (start: greenViewFrameStart, end: greenViewFrameEnd) 134 | } 135 | 136 | /** Indicates the interpolation progress of the greenView, from the red view (0.0) to the blue view (1.0). */ 137 | var currentProgress: CGFloat = 0.0 138 | 139 | /** Sets the frame of the onscreen green view by interpolating between the start and end frames based on the current progress. */ 140 | func updateGreenView() { 141 | greenView.frame = interpolateCGRect(start: greenViewFrames.start, end: greenViewFrames.end, progress: currentProgress) 142 | } 143 | 144 | func viewPanned(panGestureRecognizer: UIPanGestureRecognizer) { 145 | let xTranslation = panGestureRecognizer.translationInView(view).x 146 | let xRange = 0.7 * CGRectGetWidth(view.bounds) 147 | let newProgress = max(0.0, min(1.0, currentProgress + xTranslation / xRange)) 148 | greenView.frame = interpolateCGRect(start: greenViewFrames.start, end: greenViewFrames.end, progress: newProgress) 149 | if (panGestureRecognizer.state == .Ended) { 150 | currentProgress = newProgress 151 | } 152 | } 153 | 154 | override func prefersStatusBarHidden() -> Bool { 155 | return true 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /AdaptiveAutoLayoutTests/AdaptiveAutoLayoutTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AdaptiveAutoLayoutTests.swift 3 | // AdaptiveAutoLayoutTests 4 | // 5 | // Copyright (c) 2015 Tyler Fox 6 | // 7 | 8 | import UIKit 9 | import XCTest 10 | 11 | class AdaptiveAutoLayoutTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /AdaptiveAutoLayoutTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.smileyborg.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tyler Fox 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | pod 'PureLayout' 4 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PureLayout (3.0.0) 3 | 4 | DEPENDENCIES: 5 | - PureLayout 6 | 7 | SPEC CHECKSUMS: 8 | PureLayout: 270dfee2236f697ab1d5e2771c2e5c248495fa0d 9 | 10 | COCOAPODS: 0.38.2 11 | -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/ALView+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/ALView+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/NSArray+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSArray+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/NSLayoutConstraint+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayout+Internal.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout+Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayoutDefines.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayoutDefines.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PureLayout (3.0.0) 3 | 4 | DEPENDENCIES: 5 | - PureLayout 6 | 7 | SPEC CHECKSUMS: 8 | PureLayout: 270dfee2236f697ab1d5e2771c2e5c248495fa0d 9 | 10 | COCOAPODS: 0.38.2 11 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2241ABC30538E46F17BC59AFC645B6C5 /* NSArray+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 191E1C6095DA6537B3B9AD63F2DABA12 /* NSArray+PureLayout.m */; }; 11 | 38792B4D4276C59B21ACF9B4DE6ED4F5 /* PureLayout+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DAFA4BCE4B185A782DD016F84B3BE0CF /* PureLayout+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 40C283F04408D7C74CB6D9966B4CE10E /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FDCF9208FAF09CC79F2DA4FA5683C82 /* ALView+PureLayout.m */; }; 13 | 5EFAEC887045E3038CBA406FC9C48C82 /* Pods-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B8F899423E15C997E14FB2404791C6 /* Pods-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 6354BF1C514445C33F9B65DD18205535 /* NSArray+PureLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 913E7306AD4E255661D418473382CF54 /* NSArray+PureLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | 6837A6326B4A297F0F37B60F67C0706B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9011C520EFA96D78421817354D237D35 /* Foundation.framework */; }; 16 | 7C6672FF5BC14E5A632F38FBCF4D84F6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9011C520EFA96D78421817354D237D35 /* Foundation.framework */; }; 17 | 8A42E3EC15CA6EFC7A14FF66419B4E0A /* NSLayoutConstraint+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 97F5A0160929E8154C67BBC4B5A91B5C /* NSLayoutConstraint+PureLayout.m */; }; 18 | 8FB29797E35802BE65A888432368F471 /* PureLayout-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 17DA7E900B1E7945C8B8CE59D225F706 /* PureLayout-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 | 98DE61629DE81688A6D460FF03DD172A /* PureLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E05779740DB7A4882324BB0CC77FE83 /* PureLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20 | A9DC2F99B25B83F8896D0DEF1D5709D0 /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B29C2EEF0D874EC57444010B89A6DD3 /* Pods-dummy.m */; }; 21 | BEEF2FF4434A311B51CCAEA2D0BC4167 /* PureLayout-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ADC5572B76BA1CB325993B5EB36DD36 /* PureLayout-dummy.m */; }; 22 | C07804D5CAE775845193B0BDEAE8153A /* ALView+PureLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 13DC162AF7BEBCA584CAF9D9CEAD8319 /* ALView+PureLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 23 | E822E9813D45FF34F11862731B65F4D7 /* NSLayoutConstraint+PureLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CD3AB8195F74BFC43D6997F61F6F298 /* NSLayoutConstraint+PureLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 24 | F9A3864238BEAF7F67E75EF7417D7AF4 /* PureLayoutDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC3E333821E19620FAC1463F61C533 /* PureLayoutDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 5CE1A17C66006F2933DE0F5A5EEA12F8 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 8240A687A12B3496C485DFBEB80E79E2; 33 | remoteInfo = PureLayout; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 0FBC3E333821E19620FAC1463F61C533 /* PureLayoutDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PureLayoutDefines.h; path = PureLayout/PureLayout/PureLayoutDefines.h; sourceTree = ""; }; 39 | 13DC162AF7BEBCA584CAF9D9CEAD8319 /* ALView+PureLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ALView+PureLayout.h"; path = "PureLayout/PureLayout/ALView+PureLayout.h"; sourceTree = ""; }; 40 | 1741EF18EDC8E39FA1766213DE77C8CF /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; 41 | 17DA7E900B1E7945C8B8CE59D225F706 /* PureLayout-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PureLayout-umbrella.h"; sourceTree = ""; }; 42 | 191E1C6095DA6537B3B9AD63F2DABA12 /* NSArray+PureLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSArray+PureLayout.m"; path = "PureLayout/PureLayout/NSArray+PureLayout.m"; sourceTree = ""; }; 43 | 220202063F3D0DD071975654EB75DC54 /* PureLayout-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "PureLayout-Private.xcconfig"; sourceTree = ""; }; 44 | 2B98C72313E9B08E15E4970F6A8BB5B6 /* PureLayout.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PureLayout.xcconfig; sourceTree = ""; }; 45 | 34BE0BA12096455AB6760CFDF1005D58 /* PureLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PureLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 37B11DEC4162936E069BC7FEF119B09C /* PureLayout.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = PureLayout.modulemap; sourceTree = ""; }; 47 | 4B29C2EEF0D874EC57444010B89A6DD3 /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; 48 | 59D9DEAEBEB4B4AE79B77C4D1EEF3DAE /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 6E05779740DB7A4882324BB0CC77FE83 /* PureLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PureLayout.h; path = PureLayout/PureLayout/PureLayout.h; sourceTree = ""; }; 50 | 6FDCF9208FAF09CC79F2DA4FA5683C82 /* ALView+PureLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "ALView+PureLayout.m"; path = "PureLayout/PureLayout/ALView+PureLayout.m"; sourceTree = ""; }; 51 | 79A9DEDC89FE8336BF5FEDAAF75BF7FC /* Pods.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Pods.modulemap; sourceTree = ""; }; 52 | 7ADC5572B76BA1CB325993B5EB36DD36 /* PureLayout-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PureLayout-dummy.m"; sourceTree = ""; }; 53 | 87B213035BAC5F75386F62D3C75D2342 /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; 54 | 9011C520EFA96D78421817354D237D35 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 55 | 913E7306AD4E255661D418473382CF54 /* NSArray+PureLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSArray+PureLayout.h"; path = "PureLayout/PureLayout/NSArray+PureLayout.h"; sourceTree = ""; }; 56 | 97F5A0160929E8154C67BBC4B5A91B5C /* NSLayoutConstraint+PureLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSLayoutConstraint+PureLayout.m"; path = "PureLayout/PureLayout/NSLayoutConstraint+PureLayout.m"; sourceTree = ""; }; 57 | 9CD3AB8195F74BFC43D6997F61F6F298 /* NSLayoutConstraint+PureLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSLayoutConstraint+PureLayout.h"; path = "PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h"; sourceTree = ""; }; 58 | B870EF585C629C2B8EFC01EFA066E0AC /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 60 | C58DDFF92794887B30EA6F4C2BD2A069 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; 61 | CBC0F7C552B739C909B650A0F42F7F38 /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; 62 | D0405803033A2A777B8E4DFA0C1800ED /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; 63 | D3B8F899423E15C997E14FB2404791C6 /* Pods-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-umbrella.h"; sourceTree = ""; }; 64 | DAFA4BCE4B185A782DD016F84B3BE0CF /* PureLayout+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PureLayout+Internal.h"; path = "PureLayout/PureLayout/PureLayout+Internal.h"; sourceTree = ""; }; 65 | E608DBDD091C6DAAF7133EFDA8960D3A /* PureLayout-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PureLayout-prefix.pch"; sourceTree = ""; }; 66 | E7F21354943D9F42A70697D5A5EF72E9 /* Pods-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-frameworks.sh"; sourceTree = ""; }; 67 | E8446514FBAD26C0E18F24A5715AEF67 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 52E761D0B069DCD4C6E2F74FA447C130 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | 6837A6326B4A297F0F37B60F67C0706B /* Foundation.framework in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 8D982826564F33040944F955F4866DBD /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 7C6672FF5BC14E5A632F38FBCF4D84F6 /* Foundation.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 9011C520EFA96D78421817354D237D35 /* Foundation.framework */, 94 | ); 95 | name = iOS; 96 | sourceTree = ""; 97 | }; 98 | 56E5F5118E3951F2C822D54DF77B17DB /* Support Files */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 59D9DEAEBEB4B4AE79B77C4D1EEF3DAE /* Info.plist */, 102 | 37B11DEC4162936E069BC7FEF119B09C /* PureLayout.modulemap */, 103 | 2B98C72313E9B08E15E4970F6A8BB5B6 /* PureLayout.xcconfig */, 104 | 220202063F3D0DD071975654EB75DC54 /* PureLayout-Private.xcconfig */, 105 | 7ADC5572B76BA1CB325993B5EB36DD36 /* PureLayout-dummy.m */, 106 | E608DBDD091C6DAAF7133EFDA8960D3A /* PureLayout-prefix.pch */, 107 | 17DA7E900B1E7945C8B8CE59D225F706 /* PureLayout-umbrella.h */, 108 | ); 109 | name = "Support Files"; 110 | path = "../Target Support Files/PureLayout"; 111 | sourceTree = ""; 112 | }; 113 | 75D98FF52E597A11900E131B6C4E1ADA /* Pods */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | E8446514FBAD26C0E18F24A5715AEF67 /* Info.plist */, 117 | 79A9DEDC89FE8336BF5FEDAAF75BF7FC /* Pods.modulemap */, 118 | D0405803033A2A777B8E4DFA0C1800ED /* Pods-acknowledgements.markdown */, 119 | 87B213035BAC5F75386F62D3C75D2342 /* Pods-acknowledgements.plist */, 120 | 4B29C2EEF0D874EC57444010B89A6DD3 /* Pods-dummy.m */, 121 | E7F21354943D9F42A70697D5A5EF72E9 /* Pods-frameworks.sh */, 122 | CBC0F7C552B739C909B650A0F42F7F38 /* Pods-resources.sh */, 123 | D3B8F899423E15C997E14FB2404791C6 /* Pods-umbrella.h */, 124 | C58DDFF92794887B30EA6F4C2BD2A069 /* Pods.debug.xcconfig */, 125 | 1741EF18EDC8E39FA1766213DE77C8CF /* Pods.release.xcconfig */, 126 | ); 127 | name = Pods; 128 | path = "Target Support Files/Pods"; 129 | sourceTree = ""; 130 | }; 131 | 7DB346D0F39D3F0E887471402A8071AB = { 132 | isa = PBXGroup; 133 | children = ( 134 | BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */, 135 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 136 | A2FDD832DA64F35B104DD4C55A31BF8E /* Pods */, 137 | CCA510CFBEA2D207524CDA0D73C3B561 /* Products */, 138 | B7B80995527643776607AFFA75B91E24 /* Targets Support Files */, 139 | ); 140 | sourceTree = ""; 141 | }; 142 | A2FDD832DA64F35B104DD4C55A31BF8E /* Pods */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | FB712A69E0D41FEA99EB1907FFD5357A /* PureLayout */, 146 | ); 147 | name = Pods; 148 | sourceTree = ""; 149 | }; 150 | B7B80995527643776607AFFA75B91E24 /* Targets Support Files */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 75D98FF52E597A11900E131B6C4E1ADA /* Pods */, 154 | ); 155 | name = "Targets Support Files"; 156 | sourceTree = ""; 157 | }; 158 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */, 162 | ); 163 | name = Frameworks; 164 | sourceTree = ""; 165 | }; 166 | CCA510CFBEA2D207524CDA0D73C3B561 /* Products */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | B870EF585C629C2B8EFC01EFA066E0AC /* Pods.framework */, 170 | 34BE0BA12096455AB6760CFDF1005D58 /* PureLayout.framework */, 171 | ); 172 | name = Products; 173 | sourceTree = ""; 174 | }; 175 | FB712A69E0D41FEA99EB1907FFD5357A /* PureLayout */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 13DC162AF7BEBCA584CAF9D9CEAD8319 /* ALView+PureLayout.h */, 179 | 6FDCF9208FAF09CC79F2DA4FA5683C82 /* ALView+PureLayout.m */, 180 | 913E7306AD4E255661D418473382CF54 /* NSArray+PureLayout.h */, 181 | 191E1C6095DA6537B3B9AD63F2DABA12 /* NSArray+PureLayout.m */, 182 | 9CD3AB8195F74BFC43D6997F61F6F298 /* NSLayoutConstraint+PureLayout.h */, 183 | 97F5A0160929E8154C67BBC4B5A91B5C /* NSLayoutConstraint+PureLayout.m */, 184 | 6E05779740DB7A4882324BB0CC77FE83 /* PureLayout.h */, 185 | DAFA4BCE4B185A782DD016F84B3BE0CF /* PureLayout+Internal.h */, 186 | 0FBC3E333821E19620FAC1463F61C533 /* PureLayoutDefines.h */, 187 | 56E5F5118E3951F2C822D54DF77B17DB /* Support Files */, 188 | ); 189 | path = PureLayout; 190 | sourceTree = ""; 191 | }; 192 | /* End PBXGroup section */ 193 | 194 | /* Begin PBXHeadersBuildPhase section */ 195 | 0C97D2361202E0C0803501F6EFE50376 /* Headers */ = { 196 | isa = PBXHeadersBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | 5EFAEC887045E3038CBA406FC9C48C82 /* Pods-umbrella.h in Headers */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | D6A8EB0B19838A8E6F05524B3A33BF15 /* Headers */ = { 204 | isa = PBXHeadersBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | C07804D5CAE775845193B0BDEAE8153A /* ALView+PureLayout.h in Headers */, 208 | 6354BF1C514445C33F9B65DD18205535 /* NSArray+PureLayout.h in Headers */, 209 | E822E9813D45FF34F11862731B65F4D7 /* NSLayoutConstraint+PureLayout.h in Headers */, 210 | 38792B4D4276C59B21ACF9B4DE6ED4F5 /* PureLayout+Internal.h in Headers */, 211 | 8FB29797E35802BE65A888432368F471 /* PureLayout-umbrella.h in Headers */, 212 | 98DE61629DE81688A6D460FF03DD172A /* PureLayout.h in Headers */, 213 | F9A3864238BEAF7F67E75EF7417D7AF4 /* PureLayoutDefines.h in Headers */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | /* End PBXHeadersBuildPhase section */ 218 | 219 | /* Begin PBXNativeTarget section */ 220 | 057BC0C6AD434A55BEB3F883C422AF4B /* Pods */ = { 221 | isa = PBXNativeTarget; 222 | buildConfigurationList = D2FB98E34FE23B33951F2DB1E322484F /* Build configuration list for PBXNativeTarget "Pods" */; 223 | buildPhases = ( 224 | 3BBEA412E86660B28BB741848540178E /* Sources */, 225 | 52E761D0B069DCD4C6E2F74FA447C130 /* Frameworks */, 226 | 0C97D2361202E0C0803501F6EFE50376 /* Headers */, 227 | ); 228 | buildRules = ( 229 | ); 230 | dependencies = ( 231 | 6AD3152D5C0508C7A73A0A3DB528E406 /* PBXTargetDependency */, 232 | ); 233 | name = Pods; 234 | productName = Pods; 235 | productReference = B870EF585C629C2B8EFC01EFA066E0AC /* Pods.framework */; 236 | productType = "com.apple.product-type.framework"; 237 | }; 238 | 8240A687A12B3496C485DFBEB80E79E2 /* PureLayout */ = { 239 | isa = PBXNativeTarget; 240 | buildConfigurationList = 29946541803109559D5B69F86E5F2398 /* Build configuration list for PBXNativeTarget "PureLayout" */; 241 | buildPhases = ( 242 | ABBB6E4260C5266FB8BA4EC731A8D281 /* Sources */, 243 | 8D982826564F33040944F955F4866DBD /* Frameworks */, 244 | D6A8EB0B19838A8E6F05524B3A33BF15 /* Headers */, 245 | ); 246 | buildRules = ( 247 | ); 248 | dependencies = ( 249 | ); 250 | name = PureLayout; 251 | productName = PureLayout; 252 | productReference = 34BE0BA12096455AB6760CFDF1005D58 /* PureLayout.framework */; 253 | productType = "com.apple.product-type.framework"; 254 | }; 255 | /* End PBXNativeTarget section */ 256 | 257 | /* Begin PBXProject section */ 258 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 259 | isa = PBXProject; 260 | attributes = { 261 | LastSwiftUpdateCheck = 0700; 262 | LastUpgradeCheck = 0700; 263 | }; 264 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 265 | compatibilityVersion = "Xcode 3.2"; 266 | developmentRegion = English; 267 | hasScannedForEncodings = 0; 268 | knownRegions = ( 269 | en, 270 | ); 271 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 272 | productRefGroup = CCA510CFBEA2D207524CDA0D73C3B561 /* Products */; 273 | projectDirPath = ""; 274 | projectRoot = ""; 275 | targets = ( 276 | 057BC0C6AD434A55BEB3F883C422AF4B /* Pods */, 277 | 8240A687A12B3496C485DFBEB80E79E2 /* PureLayout */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXSourcesBuildPhase section */ 283 | 3BBEA412E86660B28BB741848540178E /* Sources */ = { 284 | isa = PBXSourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | A9DC2F99B25B83F8896D0DEF1D5709D0 /* Pods-dummy.m in Sources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | ABBB6E4260C5266FB8BA4EC731A8D281 /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | 40C283F04408D7C74CB6D9966B4CE10E /* ALView+PureLayout.m in Sources */, 296 | 2241ABC30538E46F17BC59AFC645B6C5 /* NSArray+PureLayout.m in Sources */, 297 | 8A42E3EC15CA6EFC7A14FF66419B4E0A /* NSLayoutConstraint+PureLayout.m in Sources */, 298 | BEEF2FF4434A311B51CCAEA2D0BC4167 /* PureLayout-dummy.m in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXTargetDependency section */ 305 | 6AD3152D5C0508C7A73A0A3DB528E406 /* PBXTargetDependency */ = { 306 | isa = PBXTargetDependency; 307 | name = PureLayout; 308 | target = 8240A687A12B3496C485DFBEB80E79E2 /* PureLayout */; 309 | targetProxy = 5CE1A17C66006F2933DE0F5A5EEA12F8 /* PBXContainerItemProxy */; 310 | }; 311 | /* End PBXTargetDependency section */ 312 | 313 | /* Begin XCBuildConfiguration section */ 314 | 0C6B6DDF0A0513A885FE77A4C0AEC920 /* Debug */ = { 315 | isa = XCBuildConfiguration; 316 | baseConfigurationReference = 220202063F3D0DD071975654EB75DC54 /* PureLayout-Private.xcconfig */; 317 | buildSettings = { 318 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 319 | CURRENT_PROJECT_VERSION = 3.0.0; 320 | DEFINES_MODULE = YES; 321 | DYLIB_COMPATIBILITY_VERSION = 3; 322 | DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)"; 323 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | GCC_PREFIX_HEADER = "Target Support Files/PureLayout/PureLayout-prefix.pch"; 326 | INFOPLIST_FILE = "Target Support Files/PureLayout/Info.plist"; 327 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 328 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 330 | MODULEMAP_FILE = "Target Support Files/PureLayout/PureLayout.modulemap"; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | PRODUCT_NAME = PureLayout; 333 | SDKROOT = iphoneos; 334 | SKIP_INSTALL = YES; 335 | TARGETED_DEVICE_FAMILY = "1,2"; 336 | VERSIONING_SYSTEM = "apple-generic"; 337 | VERSION_INFO_PREFIX = ""; 338 | }; 339 | name = Debug; 340 | }; 341 | 1F8CABB697C1906B3BDA698AB6EF0EEC /* Release */ = { 342 | isa = XCBuildConfiguration; 343 | baseConfigurationReference = 1741EF18EDC8E39FA1766213DE77C8CF /* Pods.release.xcconfig */; 344 | buildSettings = { 345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 346 | CURRENT_PROJECT_VERSION = 1; 347 | DEFINES_MODULE = YES; 348 | DYLIB_COMPATIBILITY_VERSION = 1; 349 | DYLIB_CURRENT_VERSION = 1; 350 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | INFOPLIST_FILE = "Target Support Files/Pods/Info.plist"; 353 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 355 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 356 | MODULEMAP_FILE = "Target Support Files/Pods/Pods.modulemap"; 357 | MTL_ENABLE_DEBUG_INFO = NO; 358 | OTHER_LDFLAGS = ""; 359 | OTHER_LIBTOOLFLAGS = ""; 360 | PODS_ROOT = "$(SRCROOT)"; 361 | PRODUCT_NAME = Pods; 362 | SDKROOT = iphoneos; 363 | SKIP_INSTALL = YES; 364 | TARGETED_DEVICE_FAMILY = "1,2"; 365 | VERSIONING_SYSTEM = "apple-generic"; 366 | VERSION_INFO_PREFIX = ""; 367 | }; 368 | name = Release; 369 | }; 370 | 219410C3F7650077BD94C50BF035FA5D /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | baseConfigurationReference = C58DDFF92794887B30EA6F4C2BD2A069 /* Pods.debug.xcconfig */; 373 | buildSettings = { 374 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 375 | CURRENT_PROJECT_VERSION = 1; 376 | DEFINES_MODULE = YES; 377 | DYLIB_COMPATIBILITY_VERSION = 1; 378 | DYLIB_CURRENT_VERSION = 1; 379 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 380 | ENABLE_STRICT_OBJC_MSGSEND = YES; 381 | INFOPLIST_FILE = "Target Support Files/Pods/Info.plist"; 382 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 383 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 385 | MODULEMAP_FILE = "Target Support Files/Pods/Pods.modulemap"; 386 | MTL_ENABLE_DEBUG_INFO = YES; 387 | OTHER_LDFLAGS = ""; 388 | OTHER_LIBTOOLFLAGS = ""; 389 | PODS_ROOT = "$(SRCROOT)"; 390 | PRODUCT_NAME = Pods; 391 | SDKROOT = iphoneos; 392 | SKIP_INSTALL = YES; 393 | TARGETED_DEVICE_FAMILY = "1,2"; 394 | VERSIONING_SYSTEM = "apple-generic"; 395 | VERSION_INFO_PREFIX = ""; 396 | }; 397 | name = Debug; 398 | }; 399 | 372EB7AD79F4028D6E153B7672B0C190 /* Release */ = { 400 | isa = XCBuildConfiguration; 401 | baseConfigurationReference = 220202063F3D0DD071975654EB75DC54 /* PureLayout-Private.xcconfig */; 402 | buildSettings = { 403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 404 | CURRENT_PROJECT_VERSION = 3.0.0; 405 | DEFINES_MODULE = YES; 406 | DYLIB_COMPATIBILITY_VERSION = 3; 407 | DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)"; 408 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 409 | ENABLE_STRICT_OBJC_MSGSEND = YES; 410 | GCC_PREFIX_HEADER = "Target Support Files/PureLayout/PureLayout-prefix.pch"; 411 | INFOPLIST_FILE = "Target Support Files/PureLayout/Info.plist"; 412 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 413 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 415 | MODULEMAP_FILE = "Target Support Files/PureLayout/PureLayout.modulemap"; 416 | MTL_ENABLE_DEBUG_INFO = NO; 417 | PRODUCT_NAME = PureLayout; 418 | SDKROOT = iphoneos; 419 | SKIP_INSTALL = YES; 420 | TARGETED_DEVICE_FAMILY = "1,2"; 421 | VERSIONING_SYSTEM = "apple-generic"; 422 | VERSION_INFO_PREFIX = ""; 423 | }; 424 | name = Release; 425 | }; 426 | 9EB645C612834738B99727720210C23E /* Debug */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | ALWAYS_SEARCH_USER_PATHS = NO; 430 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 431 | CLANG_CXX_LIBRARY = "libc++"; 432 | CLANG_ENABLE_MODULES = YES; 433 | CLANG_ENABLE_OBJC_ARC = YES; 434 | CLANG_WARN_BOOL_CONVERSION = YES; 435 | CLANG_WARN_CONSTANT_CONVERSION = YES; 436 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 437 | CLANG_WARN_EMPTY_BODY = YES; 438 | CLANG_WARN_ENUM_CONVERSION = YES; 439 | CLANG_WARN_INT_CONVERSION = YES; 440 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 441 | CLANG_WARN_UNREACHABLE_CODE = YES; 442 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 443 | COPY_PHASE_STRIP = NO; 444 | GCC_C_LANGUAGE_STANDARD = gnu99; 445 | GCC_DYNAMIC_NO_PIC = NO; 446 | GCC_OPTIMIZATION_LEVEL = 0; 447 | GCC_PREPROCESSOR_DEFINITIONS = ( 448 | "DEBUG=1", 449 | "$(inherited)", 450 | ); 451 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 452 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 453 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 454 | GCC_WARN_UNDECLARED_SELECTOR = YES; 455 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 456 | GCC_WARN_UNUSED_FUNCTION = YES; 457 | GCC_WARN_UNUSED_VARIABLE = YES; 458 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 459 | ONLY_ACTIVE_ARCH = YES; 460 | STRIP_INSTALLED_PRODUCT = NO; 461 | SYMROOT = "${SRCROOT}/../build"; 462 | }; 463 | name = Debug; 464 | }; 465 | E39CD1E764776175CB82EEC82A6C9948 /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ALWAYS_SEARCH_USER_PATHS = NO; 469 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 470 | CLANG_CXX_LIBRARY = "libc++"; 471 | CLANG_ENABLE_MODULES = YES; 472 | CLANG_ENABLE_OBJC_ARC = YES; 473 | CLANG_WARN_BOOL_CONVERSION = YES; 474 | CLANG_WARN_CONSTANT_CONVERSION = YES; 475 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 476 | CLANG_WARN_EMPTY_BODY = YES; 477 | CLANG_WARN_ENUM_CONVERSION = YES; 478 | CLANG_WARN_INT_CONVERSION = YES; 479 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 480 | CLANG_WARN_UNREACHABLE_CODE = YES; 481 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 482 | COPY_PHASE_STRIP = YES; 483 | ENABLE_NS_ASSERTIONS = NO; 484 | GCC_C_LANGUAGE_STANDARD = gnu99; 485 | GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; 486 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 487 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 488 | GCC_WARN_UNDECLARED_SELECTOR = YES; 489 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 490 | GCC_WARN_UNUSED_FUNCTION = YES; 491 | GCC_WARN_UNUSED_VARIABLE = YES; 492 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 493 | STRIP_INSTALLED_PRODUCT = NO; 494 | SYMROOT = "${SRCROOT}/../build"; 495 | VALIDATE_PRODUCT = YES; 496 | }; 497 | name = Release; 498 | }; 499 | /* End XCBuildConfiguration section */ 500 | 501 | /* Begin XCConfigurationList section */ 502 | 29946541803109559D5B69F86E5F2398 /* Build configuration list for PBXNativeTarget "PureLayout" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 0C6B6DDF0A0513A885FE77A4C0AEC920 /* Debug */, 506 | 372EB7AD79F4028D6E153B7672B0C190 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 512 | isa = XCConfigurationList; 513 | buildConfigurations = ( 514 | 9EB645C612834738B99727720210C23E /* Debug */, 515 | E39CD1E764776175CB82EEC82A6C9948 /* Release */, 516 | ); 517 | defaultConfigurationIsVisible = 0; 518 | defaultConfigurationName = Release; 519 | }; 520 | D2FB98E34FE23B33951F2DB1E322484F /* Build configuration list for PBXNativeTarget "Pods" */ = { 521 | isa = XCConfigurationList; 522 | buildConfigurations = ( 523 | 219410C3F7650077BD94C50BF035FA5D /* Debug */, 524 | 1F8CABB697C1906B3BDA698AB6EF0EEC /* Release */, 525 | ); 526 | defaultConfigurationIsVisible = 0; 527 | defaultConfigurationName = Release; 528 | }; 529 | /* End XCConfigurationList section */ 530 | }; 531 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 532 | } 533 | -------------------------------------------------------------------------------- /Pods/PureLayout/LICENSE: -------------------------------------------------------------------------------- 1 | This code is distributed under the terms and conditions of the MIT license. 2 | 3 | Copyright (c) 2014-2015 Tyler Fox 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/ALView+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALView+PureLayout.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2012 Richard Turton 6 | // Copyright (c) 2013-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "PureLayoutDefines.h" 30 | 31 | 32 | __PL_ASSUME_NONNULL_BEGIN 33 | 34 | #pragma mark ALView+PureLayout 35 | 36 | /** 37 | A category on UIView/NSView that provides a simple yet powerful interface for creating Auto Layout constraints. 38 | */ 39 | @interface ALView (PureLayout) 40 | 41 | 42 | #pragma mark Factory & Initializer Methods 43 | 44 | /** Creates and returns a new view that does not convert the autoresizing mask into constraints. */ 45 | + (instancetype)newAutoLayoutView; 46 | 47 | /** Initializes and returns a new view that does not convert the autoresizing mask into constraints. */ 48 | - (instancetype)initForAutoLayout; 49 | 50 | /** Configures an existing view to not convert the autoresizing mask into constraints and returns the view. */ 51 | - (instancetype)configureForAutoLayout; 52 | 53 | 54 | #pragma mark Center & Align in Superview 55 | 56 | /** Centers the view in its superview. */ 57 | - (__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperview; 58 | 59 | /** Aligns the view to the same axis of its superview. */ 60 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis; 61 | 62 | #if __PureLayout_MinBaseSDK_iOS_8_0 63 | 64 | /** Centers the view in its superview's margins. Available in iOS 8.0 and later. */ 65 | - (__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperviewMargins; 66 | 67 | /** Aligns the view to the corresponding margin axis of its superview. Available in iOS 8.0 and later. */ 68 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewMarginAxis:(ALAxis)axis; 69 | 70 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 71 | 72 | 73 | #pragma mark Pin Edges to Superview 74 | 75 | /** Pins the given edge of the view to the same edge of its superview. */ 76 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge; 77 | 78 | /** Pins the given edge of the view to the same edge of its superview with an inset. */ 79 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset; 80 | 81 | /** Pins the given edge of the view to the same edge of its superview with an inset as a maximum or minimum. */ 82 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 83 | 84 | /** Pins the edges of the view to the edges of its superview. */ 85 | - (__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdges; 86 | 87 | /** Pins the edges of the view to the edges of its superview with the given edge insets. */ 88 | - (__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets; 89 | 90 | /** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */ 91 | - (__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets excludingEdge:(ALEdge)edge; 92 | 93 | #if __PureLayout_MinBaseSDK_iOS_8_0 94 | 95 | /** Pins the given edge of the view to the corresponding margin of its superview. Available in iOS 8.0 and later. */ 96 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge; 97 | 98 | /** Pins the given edge of the view to the corresponding margin of its superview as a maximum or minimum. Available in iOS 8.0 and later. */ 99 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge relation:(NSLayoutRelation)relation; 100 | 101 | /** Pins the edges of the view to the margins of its superview. Available in iOS 8.0 and later. */ 102 | - (__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMargins; 103 | 104 | /** Pins 3 of the 4 edges of the view to the margins of its superview excluding one edge. Available in iOS 8.0 and later. */ 105 | - (__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMarginsExcludingEdge:(ALEdge)edge; 106 | 107 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 108 | 109 | 110 | #pragma mark Pin Edges 111 | 112 | /** Pins an edge of the view to a given edge of another view. */ 113 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView; 114 | 115 | /** Pins an edge of the view to a given edge of another view with an offset. */ 116 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset; 117 | 118 | /** Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum. */ 119 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 120 | 121 | 122 | #pragma mark Align Axes 123 | 124 | /** Aligns an axis of the view to the same axis of another view. */ 125 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView; 126 | 127 | /** Aligns an axis of the view to the same axis of another view with an offset. */ 128 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withOffset:(CGFloat)offset; 129 | 130 | /** Aligns an axis of the view to the same axis of another view with a multiplier. */ 131 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withMultiplier:(CGFloat)multiplier; 132 | 133 | 134 | #pragma mark Match Dimensions 135 | 136 | /** Matches a dimension of the view to a given dimension of another view. */ 137 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView; 138 | 139 | /** Matches a dimension of the view to a given dimension of another view with an offset. */ 140 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset; 141 | 142 | /** Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum. */ 143 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 144 | 145 | /** Matches a dimension of the view to a multiple of a given dimension of another view. */ 146 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier; 147 | 148 | /** Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum. */ 149 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 150 | 151 | 152 | #pragma mark Set Dimensions 153 | 154 | /** Sets the view to a specific size. */ 155 | - (__NSArray_of(NSLayoutConstraint *) *)autoSetDimensionsToSize:(CGSize)size; 156 | 157 | /** Sets the given dimension of the view to a specific size. */ 158 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size; 159 | 160 | /** Sets the given dimension of the view to a specific size as a maximum or minimum. */ 161 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation; 162 | 163 | 164 | #pragma mark Set Content Compression Resistance & Hugging 165 | 166 | /** Sets the priority of content compression resistance for an axis. 167 | NOTE: This method must be called from within the block passed into the method +[NSLayoutConstraint autoSetPriority:forConstraints:] */ 168 | - (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis; 169 | 170 | /** Sets the priority of content hugging for an axis. 171 | NOTE: This method must be called from within the block passed into the method +[NSLayoutConstraint autoSetPriority:forConstraints:] */ 172 | - (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis; 173 | 174 | 175 | #pragma mark Constrain Any Attributes 176 | 177 | /** Constrains an attribute of the view to a given attribute of another view. */ 178 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView; 179 | 180 | /** Constrains an attribute of the view to a given attribute of another view with an offset. */ 181 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset; 182 | 183 | /** Constrains an attribute of the view to a given attribute of another view with an offset as a maximum or minimum. */ 184 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 185 | 186 | /** Constrains an attribute of the view to a given attribute of another view with a multiplier. */ 187 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier; 188 | 189 | /** Constrains an attribute of the view to a given attribute of another view with a multiplier as a maximum or minimum. */ 190 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 191 | 192 | 193 | #pragma mark Pin to Layout Guides (iOS only) 194 | 195 | #if TARGET_OS_IPHONE 196 | 197 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset. Available on iOS only. */ 198 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 199 | 200 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */ 201 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 202 | 203 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. Available on iOS only. */ 204 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 205 | 206 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */ 207 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 208 | 209 | #endif /* TARGET_OS_IPHONE */ 210 | 211 | @end 212 | 213 | __PL_ASSUME_NONNULL_END 214 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSArray+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+PureLayout.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2012 Richard Turton 6 | // Copyright (c) 2013-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "PureLayoutDefines.h" 30 | 31 | 32 | __PL_ASSUME_NONNULL_BEGIN 33 | 34 | #pragma mark NSArray+PureLayout 35 | 36 | /** 37 | A category on NSArray that provides a simple yet powerful interface to: 38 | - Manage an array of Auto Layout constraints 39 | - Apply constraints to an array of views 40 | */ 41 | @interface NSArray (PureLayout) 42 | 43 | 44 | #pragma mark Array of Constraints 45 | 46 | /** Activates the constraints in this array. */ 47 | - (void)autoInstallConstraints; 48 | 49 | /** Deactivates the constraints in this array. */ 50 | - (void)autoRemoveConstraints; 51 | 52 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 53 | 54 | /** Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later. */ 55 | - (instancetype)autoIdentifyConstraints:(NSString *)identifier; 56 | 57 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 58 | 59 | 60 | #pragma mark Array of Views 61 | 62 | /** Aligns views in this array to one another along a given edge. */ 63 | - (__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToEdge:(ALEdge)edge; 64 | 65 | /** Aligns views in this array to one another along a given axis. */ 66 | - (__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToAxis:(ALAxis)axis; 67 | 68 | /** Matches a given dimension of all the views in this array. */ 69 | - (__NSArray_of(NSLayoutConstraint *) *)autoMatchViewsDimension:(ALDimension)dimension; 70 | 71 | /** Sets the given dimension of all the views in this array to a given size. */ 72 | - (__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size; 73 | 74 | /** Sets all of the views in this array to a given size. */ 75 | - (__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimensionsToSize:(CGSize)size; 76 | 77 | 78 | /** Distributes the views in this array equally along the selected axis in their superview. 79 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */ 80 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 81 | alignedTo:(ALAttribute)alignment 82 | withFixedSpacing:(CGFloat)spacing; 83 | 84 | /** Distributes the views in this array equally along the selected axis in their superview. 85 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */ 86 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 87 | alignedTo:(ALAttribute)alignment 88 | withFixedSpacing:(CGFloat)spacing 89 | insetSpacing:(BOOL)shouldSpaceInsets; 90 | 91 | /** Distributes the views in this array equally along the selected axis in their superview. 92 | Views will have spacing (fixed) between them, with optional insets from the first and last views to their superview, and optionally constrained to the same size in the dimension along the axis. */ 93 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 94 | alignedTo:(ALAttribute)alignment 95 | withFixedSpacing:(CGFloat)spacing 96 | insetSpacing:(BOOL)shouldSpaceInsets 97 | matchedSizes:(BOOL)shouldMatchSizes; 98 | 99 | 100 | /** Distributes the views in this array equally along the selected axis in their superview. 101 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */ 102 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 103 | alignedTo:(ALAttribute)alignment 104 | withFixedSize:(CGFloat)size; 105 | 106 | /** Distributes the views in this array equally along the selected axis in their superview. 107 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */ 108 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 109 | alignedTo:(ALAttribute)alignment 110 | withFixedSize:(CGFloat)size 111 | insetSpacing:(BOOL)shouldSpaceInsets; 112 | 113 | @end 114 | 115 | __PL_ASSUME_NONNULL_END 116 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSArray+PureLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+PureLayout.m 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2012 Richard Turton 6 | // Copyright (c) 2013-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "NSArray+PureLayout.h" 30 | #import "ALView+PureLayout.h" 31 | #import "NSLayoutConstraint+PureLayout.h" 32 | #import "PureLayout+Internal.h" 33 | 34 | 35 | #pragma mark - NSArray+PureLayout 36 | 37 | @implementation NSArray (PureLayout) 38 | 39 | 40 | #pragma mark Array of Constraints 41 | 42 | /** 43 | Activates the constraints in this array. 44 | */ 45 | - (void)autoInstallConstraints 46 | { 47 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 48 | if ([NSLayoutConstraint respondsToSelector:@selector(activateConstraints:)]) { 49 | for (id object in self) { 50 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 51 | [NSLayoutConstraint al_applyGlobalStateToConstraint:object]; 52 | } 53 | } 54 | if ([NSLayoutConstraint al_preventAutomaticConstraintInstallation]) { 55 | [[NSLayoutConstraint al_currentArrayOfCreatedConstraints] addObjectsFromArray:self]; 56 | } else { 57 | [NSLayoutConstraint activateConstraints:self]; 58 | } 59 | return; 60 | } 61 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 62 | 63 | for (id object in self) { 64 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 65 | [((NSLayoutConstraint *)object) autoInstall]; 66 | } 67 | } 68 | } 69 | 70 | /** 71 | Deactivates the constraints in this array. 72 | */ 73 | - (void)autoRemoveConstraints 74 | { 75 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 76 | if ([NSLayoutConstraint respondsToSelector:@selector(deactivateConstraints:)]) { 77 | [NSLayoutConstraint deactivateConstraints:self]; 78 | return; 79 | } 80 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 81 | 82 | for (id object in self) { 83 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 84 | [((NSLayoutConstraint *)object) autoRemove]; 85 | } 86 | } 87 | } 88 | 89 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 90 | 91 | /** 92 | Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later. 93 | The identifier will be printed along with each constraint's description. 94 | This is helpful to document the constraints' purpose and aid in debugging. 95 | 96 | @param identifier A string used to identify the constraints in this array. 97 | @return This array. 98 | */ 99 | - (instancetype)autoIdentifyConstraints:(NSString *)identifier 100 | { 101 | for (id object in self) { 102 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 103 | [((NSLayoutConstraint *)object) autoIdentify:identifier]; 104 | } 105 | } 106 | return self; 107 | } 108 | 109 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 110 | 111 | 112 | #pragma mark Array of Views 113 | 114 | /** 115 | Aligns views in this array to one another along a given edge. 116 | Note: This array must contain at least 2 views, and all views must share a common superview. 117 | 118 | @param edge The edge to which the views will be aligned. 119 | @return An array of constraints added. 120 | */ 121 | - (__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToEdge:(ALEdge)edge 122 | { 123 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 124 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 125 | ALView *previousView = nil; 126 | for (id object in self) { 127 | if ([object isKindOfClass:[ALView class]]) { 128 | ALView *view = (ALView *)object; 129 | view.translatesAutoresizingMaskIntoConstraints = NO; 130 | if (previousView) { 131 | [constraints addObject:[view autoPinEdge:edge toEdge:edge ofView:previousView]]; 132 | } 133 | previousView = view; 134 | } 135 | } 136 | return constraints; 137 | } 138 | 139 | /** 140 | Aligns views in this array to one another along a given axis. 141 | Note: This array must contain at least 2 views, and all views must share a common superview. 142 | 143 | @param axis The axis to which the views will be aligned. 144 | @return An array of constraints added. 145 | */ 146 | - (__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToAxis:(ALAxis)axis 147 | { 148 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 149 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 150 | ALView *previousView = nil; 151 | for (id object in self) { 152 | if ([object isKindOfClass:[ALView class]]) { 153 | ALView *view = (ALView *)object; 154 | view.translatesAutoresizingMaskIntoConstraints = NO; 155 | if (previousView) { 156 | [constraints addObject:[view autoAlignAxis:axis toSameAxisOfView:previousView]]; 157 | } 158 | previousView = view; 159 | } 160 | } 161 | return constraints; 162 | } 163 | 164 | /** 165 | Matches a given dimension of all the views in this array. 166 | Note: This array must contain at least 2 views, and all views must share a common superview. 167 | 168 | @param dimension The dimension to match for all of the views. 169 | @return An array of constraints added. 170 | */ 171 | - (__NSArray_of(NSLayoutConstraint *) *)autoMatchViewsDimension:(ALDimension)dimension 172 | { 173 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 174 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 175 | ALView *previousView = nil; 176 | for (id object in self) { 177 | if ([object isKindOfClass:[ALView class]]) { 178 | ALView *view = (ALView *)object; 179 | view.translatesAutoresizingMaskIntoConstraints = NO; 180 | if (previousView) { 181 | [constraints addObject:[view autoMatchDimension:dimension toDimension:dimension ofView:previousView]]; 182 | } 183 | previousView = view; 184 | } 185 | } 186 | return constraints; 187 | } 188 | 189 | /** 190 | Sets the given dimension of all the views in this array to a given size. 191 | Note: This array must contain at least 1 view. 192 | 193 | @param dimension The dimension of each of the views to set. 194 | @param size The size to set the given dimension of each view to. 195 | @return An array of constraints added. 196 | */ 197 | - (__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size 198 | { 199 | NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view."); 200 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 201 | for (id object in self) { 202 | if ([object isKindOfClass:[ALView class]]) { 203 | ALView *view = (ALView *)object; 204 | view.translatesAutoresizingMaskIntoConstraints = NO; 205 | [constraints addObject:[view autoSetDimension:dimension toSize:size]]; 206 | } 207 | } 208 | return constraints; 209 | } 210 | 211 | /** 212 | Sets all of the views in this array to a given size. 213 | Note: This array must contain at least 1 view. 214 | 215 | @param size The size to set each view's dimensions to. 216 | @return An array of constraints added. 217 | */ 218 | - (__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimensionsToSize:(CGSize)size 219 | { 220 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 221 | [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionWidth toSize:size.width]]; 222 | [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionHeight toSize:size.height]]; 223 | return constraints; 224 | } 225 | 226 | 227 | /** 228 | Distributes the views in this array equally along the selected axis in their superview. 229 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, 230 | including from the first and last views to their superview. 231 | 232 | @param axis The axis along which to distribute the views. 233 | @param alignment The attribute to use to align all the views to one another. 234 | @param spacing The fixed amount of spacing between each view. 235 | @return An array of constraints added. 236 | */ 237 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 238 | alignedTo:(ALAttribute)alignment 239 | withFixedSpacing:(CGFloat)spacing 240 | { 241 | return [self autoDistributeViewsAlongAxis:axis 242 | alignedTo:alignment 243 | withFixedSpacing:spacing 244 | insetSpacing:YES]; 245 | } 246 | 247 | /** 248 | Distributes the views in this array equally along the selected axis in their superview. 249 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. 250 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 251 | 252 | @param axis The axis along which to distribute the views. 253 | @param alignment The attribute to use to align all the views to one another. 254 | @param spacing The fixed amount of spacing between each view. 255 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 256 | @return An array of constraints added. 257 | */ 258 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 259 | alignedTo:(ALAttribute)alignment 260 | withFixedSpacing:(CGFloat)spacing 261 | insetSpacing:(BOOL)shouldSpaceInsets 262 | { 263 | return [self autoDistributeViewsAlongAxis:axis 264 | alignedTo:alignment 265 | withFixedSpacing:spacing 266 | insetSpacing:shouldSpaceInsets 267 | matchedSizes:YES]; 268 | } 269 | 270 | /** 271 | Distributes the views in this array equally along the selected axis in their superview. 272 | Views will have fixed spacing between them, and can optionally be constrained to the same size in the dimension along the axis. 273 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 274 | 275 | @param axis The axis along which to distribute the views. 276 | @param alignment The attribute to use to align all the views to one another. 277 | @param spacing The fixed amount of spacing between each view. 278 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 279 | @param shouldMatchSizes Whether all views will be constrained to be the same size in the dimension along the axis. 280 | NOTE: All views must specify an intrinsic content size if passing NO, otherwise the layout will be ambiguous! 281 | @return An array of constraints added. 282 | */ 283 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 284 | alignedTo:(ALAttribute)alignment 285 | withFixedSpacing:(CGFloat)spacing 286 | insetSpacing:(BOOL)shouldSpaceInsets 287 | matchedSizes:(BOOL)shouldMatchSizes 288 | { 289 | NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view to distribute."); 290 | ALDimension matchedDimension; 291 | ALEdge firstEdge, lastEdge; 292 | switch (axis) { 293 | case ALAxisHorizontal: 294 | case ALAxisBaseline: // same value as ALAxisLastBaseline 295 | #if __PureLayout_MinBaseSDK_iOS_8_0 296 | case ALAxisFirstBaseline: 297 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 298 | matchedDimension = ALDimensionWidth; 299 | firstEdge = ALEdgeLeading; 300 | lastEdge = ALEdgeTrailing; 301 | break; 302 | case ALAxisVertical: 303 | matchedDimension = ALDimensionHeight; 304 | firstEdge = ALEdgeTop; 305 | lastEdge = ALEdgeBottom; 306 | break; 307 | default: 308 | NSAssert(nil, @"Not a valid ALAxis."); 309 | return nil; 310 | } 311 | CGFloat leadingSpacing = shouldSpaceInsets ? spacing : 0.0; 312 | CGFloat trailingSpacing = shouldSpaceInsets ? spacing : 0.0; 313 | 314 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 315 | ALView *previousView = nil; 316 | for (id object in self) { 317 | if ([object isKindOfClass:[ALView class]]) { 318 | ALView *view = (ALView *)object; 319 | view.translatesAutoresizingMaskIntoConstraints = NO; 320 | if (previousView) { 321 | // Second, Third, ... View 322 | [constraints addObject:[view autoPinEdge:firstEdge toEdge:lastEdge ofView:previousView withOffset:spacing]]; 323 | if (shouldMatchSizes) { 324 | [constraints addObject:[view autoMatchDimension:matchedDimension toDimension:matchedDimension ofView:previousView]]; 325 | } 326 | [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]]; 327 | } 328 | else { 329 | // First view 330 | [constraints addObject:[view autoPinEdgeToSuperviewEdge:firstEdge withInset:leadingSpacing]]; 331 | } 332 | previousView = view; 333 | } 334 | } 335 | if (previousView) { 336 | // Last View 337 | [constraints addObject:[previousView autoPinEdgeToSuperviewEdge:lastEdge withInset:trailingSpacing]]; 338 | } 339 | return constraints; 340 | } 341 | 342 | /** 343 | Distributes the views in this array equally along the selected axis in their superview. 344 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, 345 | including from the first and last views to their superview. 346 | 347 | @param axis The axis along which to distribute the views. 348 | @param alignment The attribute to use to align all the views to one another. 349 | @param size The fixed size of each view in the dimension along the given axis. 350 | @return An array of constraints added. 351 | */ 352 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 353 | alignedTo:(ALAttribute)alignment 354 | withFixedSize:(CGFloat)size 355 | { 356 | return [self autoDistributeViewsAlongAxis:axis 357 | alignedTo:alignment 358 | withFixedSize:size 359 | insetSpacing:YES]; 360 | } 361 | 362 | /** 363 | Distributes the views in this array equally along the selected axis in their superview. 364 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. 365 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 366 | 367 | @param axis The axis along which to distribute the views. 368 | @param alignment The attribute to use to align all the views to one another. 369 | @param size The fixed size of each view in the dimension along the given axis. 370 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 371 | @return An array of constraints added. 372 | */ 373 | - (__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis 374 | alignedTo:(ALAttribute)alignment 375 | withFixedSize:(CGFloat)size 376 | insetSpacing:(BOOL)shouldSpaceInsets 377 | { 378 | NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view to distribute."); 379 | ALDimension fixedDimension; 380 | NSLayoutAttribute attribute; 381 | switch (axis) { 382 | case ALAxisHorizontal: 383 | case ALAxisBaseline: // same value as ALAxisLastBaseline 384 | #if __PureLayout_MinBaseSDK_iOS_8_0 385 | case ALAxisFirstBaseline: 386 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 387 | fixedDimension = ALDimensionWidth; 388 | attribute = NSLayoutAttributeCenterX; 389 | break; 390 | case ALAxisVertical: 391 | fixedDimension = ALDimensionHeight; 392 | attribute = NSLayoutAttributeCenterY; 393 | break; 394 | default: 395 | NSAssert(nil, @"Not a valid ALAxis."); 396 | return nil; 397 | } 398 | #if TARGET_OS_IPHONE 399 | # if !defined(PURELAYOUT_APP_EXTENSIONS) 400 | BOOL isRightToLeftLayout = [[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft; 401 | # else 402 | // App Extensions may not access -[UIApplication sharedApplication]; fall back to checking the bundle's preferred localization character direction 403 | BOOL isRightToLeftLayout = [NSLocale characterDirectionForLanguage:[[NSBundle mainBundle] preferredLocalizations][0]] == NSLocaleLanguageDirectionRightToLeft; 404 | # endif /* !defined(PURELAYOUT_APP_EXTENSIONS) */ 405 | #else 406 | BOOL isRightToLeftLayout = [[NSApplication sharedApplication] userInterfaceLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft; 407 | #endif /* TARGET_OS_IPHONE */ 408 | BOOL shouldFlipOrder = isRightToLeftLayout && (axis != ALAxisVertical); // imitate the effect of leading/trailing when distributing horizontally 409 | 410 | __NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new]; 411 | __NSArray_of(ALView *) *views = [self al_copyViewsOnly]; 412 | NSUInteger numberOfViews = [views count]; 413 | ALView *commonSuperview = [views al_commonSuperviewOfViews]; 414 | ALView *previousView = nil; 415 | for (NSUInteger i = 0; i < numberOfViews; i++) { 416 | ALView *view = shouldFlipOrder ? views[numberOfViews - i - 1] : views[i]; 417 | view.translatesAutoresizingMaskIntoConstraints = NO; 418 | [constraints addObject:[view autoSetDimension:fixedDimension toSize:size]]; 419 | CGFloat multiplier, constant; 420 | if (shouldSpaceInsets) { 421 | multiplier = (i * 2.0 + 2.0) / (numberOfViews + 1.0); 422 | constant = (multiplier - 1.0) * size / 2.0; 423 | } else { 424 | multiplier = (i * 2.0) / (numberOfViews - 1.0); 425 | constant = (-multiplier + 1.0) * size / 2.0; 426 | } 427 | // If the multiplier is very close to 0, set it to the minimum value to prevent the second item in the constraint from being lost. Filed as rdar://19168380 428 | if (fabs(multiplier) < kMULTIPLIER_MIN_VALUE) { 429 | multiplier = kMULTIPLIER_MIN_VALUE; 430 | } 431 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:NSLayoutRelationEqual toItem:commonSuperview attribute:attribute multiplier:multiplier constant:constant]; 432 | [constraint autoInstall]; 433 | [constraints addObject:constraint]; 434 | if (previousView) { 435 | [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]]; 436 | } 437 | previousView = view; 438 | } 439 | return constraints; 440 | } 441 | 442 | #pragma mark Internal Helper Methods 443 | 444 | /** 445 | Returns the common superview for the views in this array. If there is only one view in the array, its superview will be returned. 446 | Raises an exception if the views in this array do not share a common superview. 447 | 448 | @return The common superview for the views in this array. 449 | */ 450 | - (ALView *)al_commonSuperviewOfViews 451 | { 452 | ALView *commonSuperview = nil; 453 | ALView *previousView = nil; 454 | for (id object in self) { 455 | if ([object isKindOfClass:[ALView class]]) { 456 | ALView *view = (ALView *)object; 457 | if (previousView) { 458 | commonSuperview = [view al_commonSuperviewWithView:commonSuperview]; 459 | } else { 460 | commonSuperview = view.superview; 461 | } 462 | previousView = view; 463 | } 464 | } 465 | NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); 466 | return commonSuperview; 467 | } 468 | 469 | /** 470 | Determines whether this array contains a minimum number of views. 471 | 472 | @param minimumNumberOfViews The minimum number of views to check for. 473 | @return YES if this array contains at least the minimum number of views, NO otherwise. 474 | */ 475 | - (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews 476 | { 477 | NSUInteger numberOfViews = 0; 478 | for (id object in self) { 479 | if ([object isKindOfClass:[ALView class]]) { 480 | numberOfViews++; 481 | if (numberOfViews >= minimumNumberOfViews) { 482 | return YES; 483 | } 484 | } 485 | } 486 | return numberOfViews >= minimumNumberOfViews; 487 | } 488 | 489 | /** 490 | Creates a copy of this array containing only the view objects in it. 491 | 492 | @return A new array containing only the views that are in this array. 493 | */ 494 | - (__NSArray_of(ALView *) *)al_copyViewsOnly 495 | { 496 | __NSMutableArray_of(ALView *) *viewsOnlyArray = [NSMutableArray arrayWithCapacity:[self count]]; 497 | for (id object in self) { 498 | if ([object isKindOfClass:[ALView class]]) { 499 | [viewsOnlyArray addObject:object]; 500 | } 501 | } 502 | return viewsOnlyArray; 503 | } 504 | 505 | @end 506 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+PureLayout.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2013-2015 Tyler Fox 6 | // 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to 11 | // deal in the Software without restriction, including without limitation the 12 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25 | // IN THE SOFTWARE. 26 | // 27 | 28 | #import "PureLayoutDefines.h" 29 | 30 | 31 | __PL_ASSUME_NONNULL_BEGIN 32 | 33 | #pragma mark NSLayoutConstraint+PureLayout 34 | 35 | /** 36 | A category on NSLayoutConstraint that allows constraints to be easily installed & removed. 37 | */ 38 | @interface NSLayoutConstraint (PureLayout) 39 | 40 | 41 | #pragma mark Batch Constraint Creation 42 | 43 | /** Creates all of the constraints in the block, then installs (activates) them all at once. 44 | All constraints created from calls to the PureLayout API in the block are returned in a single array. 45 | This may be more efficient than installing (activating) each constraint one-by-one. */ 46 | + (__NSArray_of(NSLayoutConstraint *) *)autoCreateAndInstallConstraints:(ALConstraintsBlock)block; 47 | 48 | /** Creates all of the constraints in the block but prevents them from being automatically installed (activated). 49 | All constraints created from calls to the PureLayout API in the block are returned in a single array. */ 50 | + (__NSArray_of(NSLayoutConstraint *) *)autoCreateConstraintsWithoutInstalling:(ALConstraintsBlock)block; 51 | 52 | 53 | #pragma mark Set Priority For Constraints 54 | 55 | /** Sets the constraint priority to the given value for all constraints created using the PureLayout API within the given constraints block. 56 | NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added without using the PureLayout API! */ 57 | + (void)autoSetPriority:(ALLayoutPriority)priority forConstraints:(ALConstraintsBlock)block; 58 | 59 | 60 | #pragma mark Identify Constraints 61 | 62 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 63 | 64 | /** Sets the identifier for all constraints created using the PureLayout API within the given constraints block. 65 | NOTE: This method will have no effect (and will NOT set the identifier) on constraints created or added without using the PureLayout API! */ 66 | + (void)autoSetIdentifier:(NSString *)identifier forConstraints:(ALConstraintsBlock)block; 67 | 68 | /** Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later. */ 69 | - (instancetype)autoIdentify:(NSString *)identifier; 70 | 71 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 72 | 73 | 74 | #pragma mark Install & Remove Constraints 75 | 76 | /** Activates the the constraint. */ 77 | - (void)autoInstall; 78 | 79 | /** Deactivates the constraint. */ 80 | - (void)autoRemove; 81 | 82 | @end 83 | 84 | __PL_ASSUME_NONNULL_END 85 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+PureLayout.m 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2013-2015 Tyler Fox 6 | // 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to 11 | // deal in the Software without restriction, including without limitation the 12 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25 | // IN THE SOFTWARE. 26 | // 27 | 28 | #import "NSLayoutConstraint+PureLayout.h" 29 | #import "ALView+PureLayout.h" 30 | #import "NSArray+PureLayout.h" 31 | #import "PureLayout+Internal.h" 32 | 33 | 34 | #pragma mark - NSLayoutConstraint+PureLayout 35 | 36 | @implementation NSLayoutConstraint (PureLayout) 37 | 38 | #pragma mark Batch Constraint Creation 39 | 40 | /** 41 | A global variable that stores a stack of arrays of constraints created without being immediately installed. 42 | When executing a constraints block passed into the +[autoCreateConstraintsWithoutInstalling:] method, a new 43 | mutable array is pushed onto this stack, and all constraints created with PureLayout in the block are added 44 | to this array. When the block finishes executing, the array is popped off this stack. Automatic constraint 45 | installation is prevented if this stack contains at least 1 array. 46 | 47 | NOTE: Access to this variable is not synchronized (and should only be done on the main thread). 48 | */ 49 | static __NSMutableArray_of(__NSMutableArray_of(NSLayoutConstraint *) *) *_al_arraysOfCreatedConstraints = nil; 50 | 51 | /** 52 | A global variable that is set to YES when installing a batch of constraints collected from a call to +[autoCreateAndInstallConstraints]. 53 | When this flag is YES, constraints are installed immediately without checking for or adding to the +[al_currentArrayOfCreatedConstraints]. 54 | This is necessary to properly handle nested calls to +[autoCreateAndInstallConstraints], where calls whose block contains other call(s) 55 | should not return constraints from within the blocks of nested call(s). 56 | */ 57 | static BOOL _al_isInstallingCreatedConstraints = NO; 58 | 59 | /** 60 | Accessor for the global state that stores arrays of constraints created without being installed. 61 | */ 62 | + (__NSMutableArray_of(__NSMutableArray_of(NSLayoutConstraint *) *) *)al_arraysOfCreatedConstraints 63 | { 64 | NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread."); 65 | if (!_al_arraysOfCreatedConstraints) { 66 | _al_arraysOfCreatedConstraints = [NSMutableArray new]; 67 | } 68 | return _al_arraysOfCreatedConstraints; 69 | } 70 | 71 | /** 72 | Accessor for the current mutable array of constraints created without being immediately installed. 73 | */ 74 | + (__NSMutableArray_of(NSLayoutConstraint *) *)al_currentArrayOfCreatedConstraints 75 | { 76 | return [[self al_arraysOfCreatedConstraints] lastObject]; 77 | } 78 | 79 | /** 80 | Accessor for the global state that determines whether automatic constraint installation should be prevented. 81 | */ 82 | + (BOOL)al_preventAutomaticConstraintInstallation 83 | { 84 | return (_al_isInstallingCreatedConstraints == NO) && ([[self al_arraysOfCreatedConstraints] count] > 0); 85 | } 86 | 87 | /** 88 | Creates all of the constraints in the block, then installs (activates) them all at once. 89 | All constraints created from calls to the PureLayout API in the block are returned in a single array. 90 | This may be more efficient than installing (activating) each constraint one-by-one. 91 | 92 | Note: calls to this method may be nested. The constraints returned from a call will NOT include constraints 93 | created in nested calls; constraints are only returned from the inner-most call they are created within. 94 | 95 | @param block A block of method calls to the PureLayout API that create constraints. 96 | @return An array of the constraints that were created from calls to the PureLayout API inside the block. 97 | */ 98 | + (__NSArray_of(NSLayoutConstraint *) *)autoCreateAndInstallConstraints:(ALConstraintsBlock)block 99 | { 100 | NSArray *createdConstraints = [self autoCreateConstraintsWithoutInstalling:block]; 101 | _al_isInstallingCreatedConstraints = YES; 102 | [createdConstraints autoInstallConstraints]; 103 | _al_isInstallingCreatedConstraints = NO; 104 | return createdConstraints; 105 | } 106 | 107 | /** 108 | Creates all of the constraints in the block but prevents them from being automatically installed (activated). 109 | All constraints created from calls to the PureLayout API in the block are returned in a single array. 110 | 111 | Note: calls to this method may be nested. The constraints returned from a call will NOT include constraints 112 | created in nested calls; constraints are only returned from the inner-most call they are created within. 113 | 114 | @param block A block of method calls to the PureLayout API that create constraints. 115 | @return An array of the constraints that were created from calls to the PureLayout API inside the block. 116 | */ 117 | + (__NSArray_of(NSLayoutConstraint *) *)autoCreateConstraintsWithoutInstalling:(ALConstraintsBlock)block 118 | { 119 | NSAssert(block, @"The constraints block cannot be nil."); 120 | NSArray *createdConstraints = nil; 121 | if (block) { 122 | [[self al_arraysOfCreatedConstraints] addObject:[NSMutableArray new]]; 123 | block(); 124 | createdConstraints = [self al_currentArrayOfCreatedConstraints]; 125 | [[self al_arraysOfCreatedConstraints] removeLastObject]; 126 | } 127 | return createdConstraints; 128 | } 129 | 130 | 131 | #pragma mark Set Priority For Constraints 132 | 133 | /** 134 | A global variable that stores a stack of layout priorities to set on constraints. 135 | When executing a constraints block passed into the +[autoSetPriority:forConstraints:] method, the priority for 136 | that call is pushed onto this stack, and when the block finishes executing, that priority is popped off this 137 | stack. If this stack contains at least 1 priority, the priority at the top of the stack will be set for all 138 | constraints created by this library (even if automatic constraint installation is being prevented). 139 | NOTE: Access to this variable is not synchronized (and should only be done on the main thread). 140 | */ 141 | static __NSMutableArray_of(NSNumber *) *_al_globalConstraintPriorities = nil; 142 | 143 | /** 144 | Accessor for the global stack of layout priorities. 145 | */ 146 | + (__NSMutableArray_of(NSNumber *) *)al_globalConstraintPriorities 147 | { 148 | NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread."); 149 | if (!_al_globalConstraintPriorities) { 150 | _al_globalConstraintPriorities = [NSMutableArray new]; 151 | } 152 | return _al_globalConstraintPriorities; 153 | } 154 | 155 | /** 156 | Returns the current layout priority to use for constraints. 157 | When executing a constraints block passed into +[autoSetPriority:forConstraints:], this will return 158 | the priority for the current block. Otherwise, the default Required priority is returned. 159 | */ 160 | + (ALLayoutPriority)al_currentGlobalConstraintPriority 161 | { 162 | __NSMutableArray_of(NSNumber *) *globalConstraintPriorities = [self al_globalConstraintPriorities]; 163 | if ([globalConstraintPriorities count] == 0) { 164 | return ALLayoutPriorityRequired; 165 | } 166 | return [[globalConstraintPriorities lastObject] floatValue]; 167 | } 168 | 169 | /** 170 | Accessor for the global state that determines if we're currently in the scope of a priority constraints block. 171 | */ 172 | + (BOOL)al_isExecutingPriorityConstraintsBlock 173 | { 174 | return [[self al_globalConstraintPriorities] count] > 0; 175 | } 176 | 177 | /** 178 | Sets the constraint priority to the given value for all constraints created using the PureLayout 179 | API within the given constraints block. 180 | 181 | NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added 182 | without using the PureLayout API! 183 | 184 | @param priority The layout priority to be set on all constraints created in the constraints block. 185 | @param block A block of method calls to the PureLayout API that create and install constraints. 186 | */ 187 | + (void)autoSetPriority:(ALLayoutPriority)priority forConstraints:(ALConstraintsBlock)block 188 | { 189 | NSAssert(block, @"The constraints block cannot be nil."); 190 | if (block) { 191 | [[self al_globalConstraintPriorities] addObject:@(priority)]; 192 | block(); 193 | [[self al_globalConstraintPriorities] removeLastObject]; 194 | } 195 | } 196 | 197 | 198 | #pragma mark Identify Constraints 199 | 200 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 201 | 202 | /** 203 | A global variable that stores a stack of identifier strings to set on constraints. 204 | When executing a constraints block passed into the +[autoSetIdentifier:forConstraints:] method, the identifier for 205 | that call is pushed onto this stack, and when the block finishes executing, that identifier is popped off this 206 | stack. If this stack contains at least 1 identifier, the identifier at the top of the stack will be set for all 207 | constraints created by this library (even if automatic constraint installation is being prevented). 208 | NOTE: Access to this variable is not synchronized (and should only be done on the main thread). 209 | */ 210 | static __NSMutableArray_of(NSString *) *_al_globalConstraintIdentifiers = nil; 211 | 212 | /** 213 | Accessor for the global state of constraint identifiers. 214 | */ 215 | + (__NSMutableArray_of(NSString *) *)al_globalConstraintIdentifiers 216 | { 217 | NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread."); 218 | if (!_al_globalConstraintIdentifiers) { 219 | _al_globalConstraintIdentifiers = [NSMutableArray new]; 220 | } 221 | return _al_globalConstraintIdentifiers; 222 | } 223 | 224 | /** 225 | Returns the current identifier string to use for constraints. 226 | When executing a constraints block passed into +[autoSetIdentifier:forConstraints:], this will return 227 | the identifier for the current block. Otherwise, nil is returned. 228 | */ 229 | + (NSString *)al_currentGlobalConstraintIdentifier 230 | { 231 | __NSMutableArray_of(NSString *) *globalConstraintIdentifiers = [self al_globalConstraintIdentifiers]; 232 | if ([globalConstraintIdentifiers count] == 0) { 233 | return nil; 234 | } 235 | return [globalConstraintIdentifiers lastObject]; 236 | } 237 | 238 | /** 239 | Sets the identifier for all constraints created using the PureLayout API within the given constraints block. 240 | 241 | NOTE: This method will have no effect (and will NOT set the identifier) on constraints created or added 242 | without using the PureLayout API! 243 | 244 | @param identifier A string used to identify all constraints created in the constraints block. 245 | @param block A block of method calls to the PureLayout API that create and install constraints. 246 | */ 247 | + (void)autoSetIdentifier:(NSString *)identifier forConstraints:(ALConstraintsBlock)block 248 | { 249 | NSAssert(block, @"The constraints block cannot be nil."); 250 | NSAssert(identifier, @"The identifier string cannot be nil."); 251 | if (block) { 252 | if (identifier) { 253 | [[self al_globalConstraintIdentifiers] addObject:identifier]; 254 | } 255 | block(); 256 | if (identifier) { 257 | [[self al_globalConstraintIdentifiers] removeLastObject]; 258 | } 259 | } 260 | } 261 | 262 | /** 263 | Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later. 264 | The identifier will be printed along with the constraint's description. 265 | This is helpful to document a constraint's purpose and aid in debugging. 266 | 267 | @param identifier A string used to identify this constraint. 268 | @return This constraint. 269 | */ 270 | - (instancetype)autoIdentify:(NSString *)identifier 271 | { 272 | if ([self respondsToSelector:@selector(setIdentifier:)]) { 273 | self.identifier = identifier; 274 | } 275 | return self; 276 | } 277 | 278 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 279 | 280 | 281 | #pragma mark Install & Remove Constraints 282 | 283 | /** 284 | Activates the constraint. 285 | */ 286 | - (void)autoInstall 287 | { 288 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 289 | if ([self respondsToSelector:@selector(setActive:)]) { 290 | [NSLayoutConstraint al_applyGlobalStateToConstraint:self]; 291 | if ([NSLayoutConstraint al_preventAutomaticConstraintInstallation]) { 292 | [[NSLayoutConstraint al_currentArrayOfCreatedConstraints] addObject:self]; 293 | } else { 294 | self.active = YES; 295 | } 296 | return; 297 | } 298 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 299 | 300 | NSAssert(self.firstItem || self.secondItem, @"Can't install a constraint with nil firstItem and secondItem."); 301 | if (self.firstItem) { 302 | if (self.secondItem) { 303 | NSAssert([self.firstItem isKindOfClass:[ALView class]] && [self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if both items are views."); 304 | ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem]; 305 | [commonSuperview al_addConstraint:self]; 306 | } else { 307 | NSAssert([self.firstItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view."); 308 | [self.firstItem al_addConstraint:self]; 309 | } 310 | } else { 311 | NSAssert([self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view."); 312 | [self.secondItem al_addConstraint:self]; 313 | } 314 | } 315 | 316 | /** 317 | Deactivates the constraint. 318 | */ 319 | - (void)autoRemove 320 | { 321 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 322 | if ([self respondsToSelector:@selector(setActive:)]) { 323 | self.active = NO; 324 | return; 325 | } 326 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 327 | 328 | if (self.secondItem) { 329 | ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem]; 330 | while (commonSuperview) { 331 | if ([commonSuperview.constraints containsObject:self]) { 332 | [commonSuperview removeConstraint:self]; 333 | return; 334 | } 335 | commonSuperview = commonSuperview.superview; 336 | } 337 | } 338 | else { 339 | [self.firstItem removeConstraint:self]; 340 | return; 341 | } 342 | NSAssert(nil, @"Failed to remove constraint: %@", self); 343 | } 344 | 345 | 346 | #pragma mark Internal Methods 347 | 348 | /** 349 | Applies the global constraint priority and identifier to the given constraint. 350 | This should be done before installing all constraints. 351 | 352 | @param constraint The constraint to set the global priority and identifier on. 353 | */ 354 | + (void)al_applyGlobalStateToConstraint:(NSLayoutConstraint *)constraint 355 | { 356 | if ([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock]) { 357 | constraint.priority = [NSLayoutConstraint al_currentGlobalConstraintPriority]; 358 | } 359 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 360 | NSString *globalConstraintIdentifier = [NSLayoutConstraint al_currentGlobalConstraintIdentifier]; 361 | if (globalConstraintIdentifier) { 362 | [constraint autoIdentify:globalConstraintIdentifier]; 363 | } 364 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 365 | } 366 | 367 | /** 368 | Returns the corresponding NSLayoutAttribute for the given ALAttribute. 369 | 370 | @return The layout attribute for the given ALAttribute. 371 | */ 372 | + (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute 373 | { 374 | NSLayoutAttribute layoutAttribute = NSLayoutAttributeNotAnAttribute; 375 | switch (attribute) { 376 | case ALEdgeLeft: 377 | layoutAttribute = NSLayoutAttributeLeft; 378 | break; 379 | case ALEdgeRight: 380 | layoutAttribute = NSLayoutAttributeRight; 381 | break; 382 | case ALEdgeTop: 383 | layoutAttribute = NSLayoutAttributeTop; 384 | break; 385 | case ALEdgeBottom: 386 | layoutAttribute = NSLayoutAttributeBottom; 387 | break; 388 | case ALEdgeLeading: 389 | layoutAttribute = NSLayoutAttributeLeading; 390 | break; 391 | case ALEdgeTrailing: 392 | layoutAttribute = NSLayoutAttributeTrailing; 393 | break; 394 | case ALDimensionWidth: 395 | layoutAttribute = NSLayoutAttributeWidth; 396 | break; 397 | case ALDimensionHeight: 398 | layoutAttribute = NSLayoutAttributeHeight; 399 | break; 400 | case ALAxisVertical: 401 | layoutAttribute = NSLayoutAttributeCenterX; 402 | break; 403 | case ALAxisHorizontal: 404 | layoutAttribute = NSLayoutAttributeCenterY; 405 | break; 406 | case ALAxisBaseline: // same value as ALAxisLastBaseline 407 | layoutAttribute = NSLayoutAttributeBaseline; 408 | break; 409 | #if __PureLayout_MinBaseSDK_iOS_8_0 410 | case ALAxisFirstBaseline: 411 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisFirstBaseline is only supported on iOS 8.0 or higher."); 412 | layoutAttribute = NSLayoutAttributeFirstBaseline; 413 | break; 414 | case ALMarginLeft: 415 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeftMargin is only supported on iOS 8.0 or higher."); 416 | layoutAttribute = NSLayoutAttributeLeftMargin; 417 | break; 418 | case ALMarginRight: 419 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeRightMargin is only supported on iOS 8.0 or higher."); 420 | layoutAttribute = NSLayoutAttributeRightMargin; 421 | break; 422 | case ALMarginTop: 423 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTopMargin is only supported on iOS 8.0 or higher."); 424 | layoutAttribute = NSLayoutAttributeTopMargin; 425 | break; 426 | case ALMarginBottom: 427 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeBottomMargin is only supported on iOS 8.0 or higher."); 428 | layoutAttribute = NSLayoutAttributeBottomMargin; 429 | break; 430 | case ALMarginLeading: 431 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeadingMargin is only supported on iOS 8.0 or higher."); 432 | layoutAttribute = NSLayoutAttributeLeadingMargin; 433 | break; 434 | case ALMarginTrailing: 435 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTrailingMargin is only supported on iOS 8.0 or higher."); 436 | layoutAttribute = NSLayoutAttributeTrailingMargin; 437 | break; 438 | case ALMarginAxisVertical: 439 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisVerticalMargin is only supported on iOS 8.0 or higher."); 440 | layoutAttribute = NSLayoutAttributeCenterXWithinMargins; 441 | break; 442 | case ALMarginAxisHorizontal: 443 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisHorizontalMargin is only supported on iOS 8.0 or higher."); 444 | layoutAttribute = NSLayoutAttributeCenterYWithinMargins; 445 | break; 446 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 447 | default: 448 | NSAssert(nil, @"Not a valid ALAttribute."); 449 | break; 450 | } 451 | return layoutAttribute; 452 | } 453 | 454 | /** 455 | Returns the corresponding ALLayoutConstraintAxis for the given ALAxis. 456 | 457 | @return The constraint axis for the given axis. 458 | */ 459 | + (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis 460 | { 461 | ALLayoutConstraintAxis constraintAxis; 462 | switch (axis) { 463 | case ALAxisVertical: 464 | constraintAxis = ALLayoutConstraintAxisVertical; 465 | break; 466 | case ALAxisHorizontal: 467 | case ALAxisBaseline: // same value as ALAxisLastBaseline 468 | #if __PureLayout_MinBaseSDK_iOS_8_0 469 | case ALAxisFirstBaseline: 470 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 471 | constraintAxis = ALLayoutConstraintAxisHorizontal; 472 | break; 473 | default: 474 | NSAssert(nil, @"Not a valid ALAxis."); 475 | constraintAxis = ALLayoutConstraintAxisHorizontal; // default to an arbitrary value to satisfy the compiler 476 | break; 477 | } 478 | return constraintAxis; 479 | } 480 | 481 | #if __PureLayout_MinBaseSDK_iOS_8_0 482 | 483 | /** 484 | Returns the corresponding margin for the given edge. 485 | 486 | @param edge The edge to convert to the corresponding margin. 487 | @return The margin for the given edge. 488 | */ 489 | + (ALMargin)al_marginForEdge:(ALEdge)edge 490 | { 491 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher."); 492 | ALMargin margin; 493 | switch (edge) { 494 | case ALEdgeLeft: 495 | margin = ALMarginLeft; 496 | break; 497 | case ALEdgeRight: 498 | margin = ALMarginRight; 499 | break; 500 | case ALEdgeTop: 501 | margin = ALMarginTop; 502 | break; 503 | case ALEdgeBottom: 504 | margin = ALMarginBottom; 505 | break; 506 | case ALEdgeLeading: 507 | margin = ALMarginLeading; 508 | break; 509 | case ALEdgeTrailing: 510 | margin = ALMarginTrailing; 511 | break; 512 | default: 513 | NSAssert(nil, @"Not a valid ALEdge."); 514 | margin = ALMarginLeft; // default to an arbitrary value to satisfy the compiler 515 | break; 516 | } 517 | return margin; 518 | } 519 | 520 | /** 521 | Returns the corresponding margin axis for the given axis. 522 | 523 | @param axis The axis to convert to the corresponding margin axis. 524 | @return The margin axis for the given axis. 525 | */ 526 | + (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis 527 | { 528 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher."); 529 | ALMarginAxis marginAxis; 530 | switch (axis) { 531 | case ALAxisVertical: 532 | marginAxis = ALMarginAxisVertical; 533 | break; 534 | case ALAxisHorizontal: 535 | marginAxis = ALMarginAxisHorizontal; 536 | break; 537 | case ALAxisBaseline: 538 | case ALAxisFirstBaseline: 539 | NSAssert(nil, @"The baseline axis attributes do not have corresponding margin axis attributes."); 540 | marginAxis = ALMarginAxisVertical; // default to an arbitrary value to satisfy the compiler 541 | break; 542 | default: 543 | NSAssert(nil, @"Not a valid ALAxis."); 544 | marginAxis = ALMarginAxisVertical; // default to an arbitrary value to satisfy the compiler 545 | break; 546 | } 547 | return marginAxis; 548 | } 549 | 550 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 551 | 552 | @end 553 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayout+Internal.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayout+Internal.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2014-2015 Tyler Fox 6 | // 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to 11 | // deal in the Software without restriction, including without limitation the 12 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25 | // IN THE SOFTWARE. 26 | // 27 | 28 | #import "PureLayoutDefines.h" 29 | 30 | 31 | // Using generics with NSMutableArray is so common in the internal implementation of PureLayout that it gets a dedicated preprocessor macro for better readability. 32 | #define __NSMutableArray_of(type) __PL_GENERICS(NSMutableArray, type) 33 | 34 | __PL_ASSUME_NONNULL_BEGIN 35 | 36 | /** A constant that represents the smallest valid positive value for the multiplier of a constraint, 37 | since a value of 0 will cause the second item to be lost in the internal auto layout engine. */ 38 | static const CGFloat kMULTIPLIER_MIN_VALUE = (CGFloat)0.00001; // very small floating point numbers (e.g. CGFLOAT_MIN) can cause problems 39 | 40 | 41 | /** 42 | A category that exposes the internal (private) helper methods of the ALView+PureLayout category. 43 | */ 44 | @interface ALView (PureLayoutInternal) 45 | 46 | - (void)al_addConstraint:(NSLayoutConstraint *)constraint; 47 | - (ALView *)al_commonSuperviewWithView:(ALView *)otherView; 48 | - (NSLayoutConstraint *)al_alignAttribute:(ALAttribute)attribute toView:(ALView *)otherView forAxis:(ALAxis)axis; 49 | 50 | @end 51 | 52 | 53 | /** 54 | A category that exposes the internal (private) helper methods of the NSArray+PureLayout category. 55 | */ 56 | @interface NSArray (PureLayoutInternal) 57 | 58 | - (ALView *)al_commonSuperviewOfViews; 59 | - (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews; 60 | - (__NSArray_of(ALView *) *)al_copyViewsOnly; 61 | 62 | @end 63 | 64 | 65 | /** 66 | A category that exposes the internal (private) helper methods of the NSLayoutConstraint+PureLayout category. 67 | */ 68 | @interface NSLayoutConstraint (PureLayoutInternal) 69 | 70 | + (BOOL)al_preventAutomaticConstraintInstallation; 71 | + (__NSMutableArray_of(NSLayoutConstraint *) *)al_currentArrayOfCreatedConstraints; 72 | + (BOOL)al_isExecutingPriorityConstraintsBlock; 73 | + (ALLayoutPriority)al_currentGlobalConstraintPriority; 74 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 75 | + (NSString *)al_currentGlobalConstraintIdentifier; 76 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 77 | + (void)al_applyGlobalStateToConstraint:(NSLayoutConstraint *)constraint; 78 | + (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute; 79 | + (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis; 80 | #if __PureLayout_MinBaseSDK_iOS_8_0 81 | + (ALMargin)al_marginForEdge:(ALEdge)edge; 82 | + (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis; 83 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 84 | 85 | @end 86 | 87 | __PL_ASSUME_NONNULL_END 88 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayout.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2014-2015 Tyler Fox 6 | // 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to 11 | // deal in the Software without restriction, including without limitation the 12 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25 | // IN THE SOFTWARE. 26 | // 27 | 28 | #ifndef PureLayout_h 29 | #define PureLayout_h 30 | 31 | #import 32 | 33 | //! Project version number for PureLayout. 34 | FOUNDATION_EXPORT double PureLayoutVersionNumber; 35 | 36 | //! Project version string for PureLayout. 37 | FOUNDATION_EXPORT const unsigned char PureLayoutVersionString[]; 38 | 39 | #import "ALView+PureLayout.h" 40 | #import "NSArray+PureLayout.h" 41 | #import "NSLayoutConstraint+PureLayout.h" 42 | 43 | #endif /* PureLayout_h */ 44 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayoutDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayoutDefines.h 3 | // https://github.com/smileyborg/PureLayout 4 | // 5 | // Copyright (c) 2014-2015 Tyler Fox 6 | // 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to 11 | // deal in the Software without restriction, including without limitation the 12 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | // sell copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25 | // IN THE SOFTWARE. 26 | // 27 | 28 | #ifndef PureLayoutDefines_h 29 | #define PureLayoutDefines_h 30 | 31 | #import 32 | 33 | // Define some preprocessor macros to check for a minimum Base SDK. These are used to prevent compile-time errors in older versions of Xcode. 34 | #define __PureLayout_MinBaseSDK_iOS_8_0 (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1) 35 | #define __PureLayout_MinBaseSDK_OSX_10_10 (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9) 36 | 37 | // Define some preprocessor macros to check for a minimum System Version. These are used to prevent runtime crashes on older versions of iOS/OS X. 38 | #define __PureLayout_MinSysVer_iOS_7_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) 39 | #define __PureLayout_MinSysVer_iOS_8_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) 40 | #define __PureLayout_MinSysVer_OSX_10_9 (!TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8_4) 41 | 42 | // Define some preprocessor macros that allow nullability annotations to be adopted in a backwards-compatible manner. 43 | #if __has_feature(nullability) 44 | # define __PL_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN 45 | # define __PL_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END 46 | #else 47 | # define __PL_ASSUME_NONNULL_BEGIN 48 | # define __PL_ASSUME_NONNULL_END 49 | #endif 50 | 51 | // Define some preprocessor macros that allow generics to be adopted in a backwards-compatible manner. 52 | #if __has_feature(objc_generics) 53 | # define __PL_GENERICS(class, ...) class<__VA_ARGS__> 54 | #else 55 | # define __PL_GENERICS(class, ...) class 56 | #endif 57 | 58 | // Using generics with NSArray is so common in PureLayout that it gets a dedicated preprocessor macro for better readability. 59 | #define __NSArray_of(type) __PL_GENERICS(NSArray, type) 60 | 61 | // Define generic AL-prefixed macros for the types/constants/etc that have slight naming variations across iOS and OS X, which allows the same code to be platform-independent. 62 | #if TARGET_OS_IPHONE 63 | # import 64 | # define ALView UIView 65 | # define ALEdgeInsets UIEdgeInsets 66 | # define ALEdgeInsetsZero UIEdgeInsetsZero 67 | # define ALEdgeInsetsMake UIEdgeInsetsMake 68 | # define ALLayoutConstraintAxis UILayoutConstraintAxis 69 | # define ALLayoutConstraintOrientation ALLayoutConstraintAxis 70 | # define ALLayoutConstraintAxisHorizontal UILayoutConstraintAxisHorizontal 71 | # define ALLayoutConstraintAxisVertical UILayoutConstraintAxisVertical 72 | # define ALLayoutConstraintOrientationHorizontal ALLayoutConstraintAxisHorizontal 73 | # define ALLayoutConstraintOrientationVertical ALLayoutConstraintAxisVertical 74 | # define ALLayoutPriority UILayoutPriority 75 | # define ALLayoutPriorityRequired UILayoutPriorityRequired 76 | # define ALLayoutPriorityDefaultHigh UILayoutPriorityDefaultHigh 77 | # define ALLayoutPriorityDefaultLow UILayoutPriorityDefaultLow 78 | # define ALLayoutPriorityFittingSizeLevel UILayoutPriorityFittingSizeLevel 79 | # define ALLayoutPriorityFittingSizeCompression ALLayoutPriorityFittingSizeLevel 80 | #else 81 | # import 82 | # define ALView NSView 83 | # define ALEdgeInsets NSEdgeInsets 84 | # define ALEdgeInsetsZero NSEdgeInsetsMake(0, 0, 0, 0) 85 | # define ALEdgeInsetsMake NSEdgeInsetsMake 86 | # define ALLayoutConstraintOrientation NSLayoutConstraintOrientation 87 | # define ALLayoutConstraintAxis ALLayoutConstraintOrientation 88 | # define ALLayoutConstraintOrientationHorizontal NSLayoutConstraintOrientationHorizontal 89 | # define ALLayoutConstraintOrientationVertical NSLayoutConstraintOrientationVertical 90 | # define ALLayoutConstraintAxisHorizontal ALLayoutConstraintOrientationHorizontal 91 | # define ALLayoutConstraintAxisVertical ALLayoutConstraintOrientationVertical 92 | # define ALLayoutPriority NSLayoutPriority 93 | # define ALLayoutPriorityRequired NSLayoutPriorityRequired 94 | # define ALLayoutPriorityDefaultHigh NSLayoutPriorityDefaultHigh 95 | # define ALLayoutPriorityDefaultLow NSLayoutPriorityDefaultLow 96 | # define ALLayoutPriorityFittingSizeCompression NSLayoutPriorityFittingSizeCompression 97 | # define ALLayoutPriorityFittingSizeLevel ALLayoutPriorityFittingSizeCompression 98 | #endif /* TARGET_OS_IPHONE */ 99 | 100 | 101 | #pragma mark PureLayout Attributes 102 | 103 | /** Constants that represent edges of a view. */ 104 | typedef NS_ENUM(NSInteger, ALEdge) { 105 | /** The left edge of the view. */ 106 | ALEdgeLeft = NSLayoutAttributeLeft, 107 | /** The right edge of the view. */ 108 | ALEdgeRight = NSLayoutAttributeRight, 109 | /** The top edge of the view. */ 110 | ALEdgeTop = NSLayoutAttributeTop, 111 | /** The bottom edge of the view. */ 112 | ALEdgeBottom = NSLayoutAttributeBottom, 113 | /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */ 114 | ALEdgeLeading = NSLayoutAttributeLeading, 115 | /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */ 116 | ALEdgeTrailing = NSLayoutAttributeTrailing 117 | }; 118 | 119 | /** Constants that represent dimensions of a view. */ 120 | typedef NS_ENUM(NSInteger, ALDimension) { 121 | /** The width of the view. */ 122 | ALDimensionWidth = NSLayoutAttributeWidth, 123 | /** The height of the view. */ 124 | ALDimensionHeight = NSLayoutAttributeHeight 125 | }; 126 | 127 | /** Constants that represent axes of a view. */ 128 | typedef NS_ENUM(NSInteger, ALAxis) { 129 | /** A vertical line equidistant from the view's left and right edges. */ 130 | ALAxisVertical = NSLayoutAttributeCenterX, 131 | /** A horizontal line equidistant from the view's top and bottom edges. */ 132 | ALAxisHorizontal = NSLayoutAttributeCenterY, 133 | 134 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */ 135 | ALAxisBaseline = NSLayoutAttributeBaseline, 136 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */ 137 | ALAxisLastBaseline = ALAxisBaseline, 138 | #if __PureLayout_MinBaseSDK_iOS_8_0 139 | /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */ 140 | ALAxisFirstBaseline = NSLayoutAttributeFirstBaseline 141 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 142 | }; 143 | 144 | #if __PureLayout_MinBaseSDK_iOS_8_0 145 | 146 | /** Constants that represent layout margins of a view. Available in iOS 8.0 and later. */ 147 | typedef NS_ENUM(NSInteger, ALMargin) { 148 | /** The left margin of the view, based on the view's layoutMargins left inset. */ 149 | ALMarginLeft = NSLayoutAttributeLeftMargin, 150 | /** The right margin of the view, based on the view's layoutMargins right inset. */ 151 | ALMarginRight = NSLayoutAttributeRightMargin, 152 | /** The top margin of the view, based on the view's layoutMargins top inset. */ 153 | ALMarginTop = NSLayoutAttributeTopMargin, 154 | /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */ 155 | ALMarginBottom = NSLayoutAttributeBottomMargin, 156 | /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 157 | ALMarginLeading = NSLayoutAttributeLeadingMargin, 158 | /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 159 | ALMarginTrailing = NSLayoutAttributeTrailingMargin 160 | }; 161 | 162 | /** Constants that represent axes of the layout margins of a view. Available in iOS 8.0 and later. */ 163 | typedef NS_ENUM(NSInteger, ALMarginAxis) { 164 | /** A vertical line equidistant from the view's left and right margins. */ 165 | ALMarginAxisVertical = NSLayoutAttributeCenterXWithinMargins, 166 | /** A horizontal line equidistant from the view's top and bottom margins. */ 167 | ALMarginAxisHorizontal = NSLayoutAttributeCenterYWithinMargins 168 | }; 169 | 170 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 171 | 172 | /** An attribute of a view that can be used in auto layout constraints. These constants are identical to the more specific enum types: 173 | ALEdge, ALAxis, ALDimension, ALMargin, ALMarginAxis. It is safe to cast a more specific enum type to the ALAttribute type. */ 174 | typedef NS_ENUM(NSInteger, ALAttribute) { 175 | /** The left edge of the view. */ 176 | ALAttributeLeft = ALEdgeLeft, 177 | /** The right edge of the view. */ 178 | ALAttributeRight = ALEdgeRight, 179 | /** The top edge of the view. */ 180 | ALAttributeTop = ALEdgeTop, 181 | /** The bottom edge of the view. */ 182 | ALAttributeBottom = ALEdgeBottom, 183 | /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */ 184 | ALAttributeLeading = ALEdgeLeading, 185 | /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */ 186 | ALAttributeTrailing = ALEdgeTrailing, 187 | /** The width of the view. */ 188 | ALAttributeWidth = ALDimensionWidth, 189 | /** The height of the view. */ 190 | ALAttributeHeight = ALDimensionHeight, 191 | /** A vertical line equidistant from the view's left and right edges. */ 192 | ALAttributeVertical = ALAxisVertical, 193 | /** A horizontal line equidistant from the view's top and bottom edges. */ 194 | ALAttributeHorizontal = ALAxisHorizontal, 195 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */ 196 | ALAttributeBaseline = ALAxisBaseline, 197 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */ 198 | ALAttributeLastBaseline = ALAxisLastBaseline, 199 | #if __PureLayout_MinBaseSDK_iOS_8_0 200 | /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */ 201 | ALAttributeFirstBaseline = ALAxisFirstBaseline, 202 | /** The left margin of the view, based on the view's layoutMargins left inset. */ 203 | ALAttributeMarginLeft = ALMarginLeft, 204 | /** The right margin of the view, based on the view's layoutMargins right inset. */ 205 | ALAttributeMarginRight = ALMarginRight, 206 | /** The top margin of the view, based on the view's layoutMargins top inset. */ 207 | ALAttributeMarginTop = ALMarginTop, 208 | /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */ 209 | ALAttributeMarginBottom = ALMarginBottom, 210 | /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 211 | ALAttributeMarginLeading = ALMarginLeading, 212 | /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 213 | ALAttributeMarginTrailing = ALMarginTrailing, 214 | /** A vertical line equidistant from the view's left and right margins. */ 215 | ALAttributeMarginAxisVertical = ALMarginAxisVertical, 216 | /** A horizontal line equidistant from the view's top and bottom margins. */ 217 | ALAttributeMarginAxisHorizontal = ALMarginAxisHorizontal 218 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 219 | }; 220 | 221 | /** A block containing method calls to the PureLayout API. Takes no arguments and has no return value. */ 222 | typedef void(^ALConstraintsBlock)(void); 223 | 224 | #endif /* PureLayoutDefines_h */ 225 | -------------------------------------------------------------------------------- /Pods/PureLayout/README.md: -------------------------------------------------------------------------------- 1 | # [![PureLayout](https://github.com/smileyborg/PureLayout/blob/master/Images/PureLayout.png?raw=true)](#) 2 | [![Build Status](http://img.shields.io/travis/smileyborg/PureLayout.svg?style=flat)](https://travis-ci.org/smileyborg/PureLayout) [![Test Coverage](http://img.shields.io/coveralls/smileyborg/PureLayout.svg?style=flat)](https://coveralls.io/r/smileyborg/PureLayout) [![Version](http://img.shields.io/cocoapods/v/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![Platform](http://img.shields.io/cocoapods/p/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![License](http://img.shields.io/cocoapods/l/PureLayout.svg?style=flat)](LICENSE) 3 | 4 | The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. PureLayout extends `UIView`/`NSView`, `NSArray`, and `NSLayoutConstraint` with a comprehensive Auto Layout API that is modeled after Apple's own frameworks. PureLayout is a cross-platform Objective-C library that works (and looks!) great in Swift. It is fully backwards-compatible with all versions of iOS and OS X that support Auto Layout. 5 | 6 | Writing Auto Layout code from scratch isn't easy. PureLayout provides a fully capable and developer-friendly interface for Auto Layout. It is designed for clarity and simplicity, and takes inspiration from the AutoLayout UI options available in Interface Builder while delivering far more flexibility. The API is also highly efficient, as it adds only a thin layer of third party code and is engineered for maximum performance. 7 | 8 | ### Table of Contents 9 | 1. [Setup](#setup) 10 | 1. [API Cheat Sheet](#api-cheat-sheet) 11 | 1. [Usage](#usage) 12 | * [Sample Code](#sample-code-swift) 13 | * [Example Apps](#example-apps) 14 | 1. [PureLayout vs. the rest](#purelayout-vs-the-rest) 15 | 1. [Problems, Suggestions, Pull Requests?](#problems-suggestions-pull-requests) 16 | 17 | ## Setup 18 | ### Compatibility 19 | The current release of PureLayout supports all versions of iOS and OS X since the introduction of Auto Layout on each platform, in both Swift and Objective-C, with a single codebase! 20 | 21 | * Xcode 22 | * Language Support: **Swift** *(any version)*, **Objective-C** 23 | * Fully Compatible With: **Xcode 7.0** 24 | * Minimum Supported Version: **Xcode 5.0** 25 | * iOS 26 | * Fully Compatible With: **iOS 9.0** 27 | * Minimum Deployment Target: **iOS 6.0** 28 | * OS X 29 | * Fully Compatible With: **OS X 10.11** 30 | * Minimum Deployment Target: **OS X 10.7** 31 | 32 | ### Using [CocoaPods](http://cocoapods.org) 33 | 1. Add the pod `PureLayout` to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html). 34 | 35 | ```ruby 36 | pod 'PureLayout' 37 | ``` 38 | 39 | 1. Run `pod install` from Terminal, then open your app's `.xcworkspace` file to launch Xcode. 40 | 1. Import the `PureLayout.h` umbrella header. 41 | * With `use_frameworks!` in your Podfile 42 | * Swift: `import PureLayout` 43 | * Objective-C: `#import ` (or with Modules enabled: `@import PureLayout;`) 44 | * Without `use_frameworks!` in your Podfile 45 | * Swift: Add `#import "PureLayout.h"` to your bridging header. 46 | * Objective-C: `#import "PureLayout.h"` 47 | 48 | That's it - now go write some beautiful Auto Layout code! 49 | 50 | ### Using [Carthage](https://github.com/Carthage/Carthage) 51 | 1. Add the `smileyborg/PureLayout` project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). 52 | 53 | ```ogdl 54 | github "smileyborg/PureLayout" 55 | ``` 56 | 57 | 1. Run `carthage update`, then follow the [additional steps required](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add the framework into your project. 58 | 1. Import the PureLayout framework/module. 59 | * Swift: `import PureLayout` 60 | * Objective-C: `#import ` (or with Modules enabled: `@import PureLayout;`) 61 | 62 | That's it - now go write some beautiful Auto Layout code! 63 | 64 | ### Manually from GitHub 65 | 1. Download the source files in the [PureLayout subdirectory](PureLayout/PureLayout). 66 | 1. Add the source files to your Xcode project. 67 | 1. Import the `PureLayout.h` header. 68 | * Swift: Add `#import "PureLayout.h"` to your bridging header. 69 | * Objective-C: `#import "PureLayout.h"` 70 | 71 | That's it - now go write some beautiful Auto Layout code! 72 | 73 | ### App Extensions 74 | To use PureLayout in an App Extension, you need to do a bit of extra configuration to prevent usage of unavailable APIs. [Click here](https://github.com/smileyborg/PureLayout/wiki/App-Extensions) for more info. 75 | 76 | ### Releases 77 | Releases are tagged in the git commit history using [semantic versioning](http://semver.org). Check out the [releases and release notes](https://github.com/smileyborg/PureLayout/releases) for each version. 78 | 79 | ## API Cheat Sheet 80 | This is just a handy overview of the core API methods. Explore the [header files](PureLayout/PureLayout) for the full API, and find the complete documentation above the implementation of each method in the corresponding .m file. A couple of notes: 81 | 82 | * All of the public API methods are namespaced with the prefix `auto...`, which also makes it easy for Xcode to autocomplete as you type. 83 | * Methods that create constraints also automatically install (activate) the constraint(s), then return the new constraint(s) for you to optionally store for later adjustment or removal. 84 | * Many methods below also have a variant which includes a `relation:` parameter to make the constraint an inequality. 85 | 86 | ### Attributes 87 | 88 | PureLayout defines view attributes that are used to create auto layout constraints. Here is an [illustration of the most common attributes](Images/PureLayout-CommonAttributes.png). 89 | 90 | There are 5 specific attribute types, which are used throughout most of the API: 91 | 92 | * `ALEdge` 93 | * `ALDimension` 94 | * `ALAxis` 95 | * `ALMargin` *available in iOS 8.0 and higher only* 96 | * `ALMarginAxis` *available in iOS 8.0 and higher only* 97 | 98 | Additionally, there is one generic attribute type, `ALAttribute`, which is effectively a union of all the specific types. You can think of this as the "supertype" of all of the specific attribute types, which means that it is always safe to cast a specific type to the generic `ALAttribute` type. (Note that the reverse is not true -- casting a generic ALAttribute to a specific attribute type is unsafe!) 99 | 100 | ### [`UIView`/`NSView`](PureLayout/PureLayout/ALView%2BPureLayout.h) 101 | ``` 102 | - autoSetContent(CompressionResistance|Hugging)PriorityForAxis: 103 | - autoCenterInSuperview(Margins): // Margins variant iOS 8.0+ only 104 | - autoAlignAxisToSuperview(Margin)Axis: // Margin variant iOS 8.0+ only 105 | - autoPinEdgeToSuperview(Edge:|Margin:)(withInset:) // Margin variant iOS 8.0+ only 106 | - autoPinEdgesToSuperview(Edges|Margins)(WithInsets:)(excludingEdge:) // Margins variant iOS 8.0+ only 107 | - autoPinEdge:toEdge:ofView:(withOffset:) 108 | - autoAlignAxis:toSameAxisOfView:(withOffset:|withMultiplier:) 109 | - autoMatchDimension:toDimension:ofView:(withOffset:|withMultiplier:) 110 | - autoSetDimension(s)ToSize: 111 | - autoConstrainAttribute:toAttribute:ofView:(withOffset:|withMultiplier:) 112 | - autoPinTo(Top|Bottom)LayoutGuideOfViewController:withInset: // iOS only 113 | ``` 114 | 115 | ### [`NSArray`](PureLayout/PureLayout/NSArray%2BPureLayout.h) 116 | ``` 117 | // Arrays of Constraints 118 | - autoInstallConstraints 119 | - autoRemoveConstraints 120 | - autoIdentifyConstraints: // iOS 7.0+, OS X 10.9+ only 121 | 122 | // Arrays of Views 123 | - autoAlignViewsToEdge: 124 | - autoAlignViewsToAxis: 125 | - autoMatchViewsDimension: 126 | - autoSetViewsDimension:toSize: 127 | - autoSetViewsDimensionsToSize: 128 | - autoDistributeViewsAlongAxis:alignedTo:withFixedSpacing:(insetSpacing:)(matchedSizes:) 129 | - autoDistributeViewsAlongAxis:alignedTo:withFixedSize:(insetSpacing:) 130 | ``` 131 | 132 | ### [`NSLayoutConstraint`](PureLayout/PureLayout/NSLayoutConstraint%2BPureLayout.h) 133 | ``` 134 | + autoCreateAndInstallConstraints: 135 | + autoCreateConstraintsWithoutInstalling: 136 | + autoSetPriority:forConstraints: 137 | + autoSetIdentifier:forConstraints: // iOS 7.0+, OS X 10.9+ only 138 | - autoIdentify: // iOS 7.0+, OS X 10.9+ only 139 | - autoInstall 140 | - autoRemove 141 | ``` 142 | 143 | ## Usage 144 | ### Sample Code (Swift) 145 | PureLayout dramatically simplifies writing Auto Layout code. Let's take a quick look at some examples, using PureLayout from Swift. 146 | 147 | Here's a constraint between two views created (and automatically activated) using PureLayout: 148 | 149 | ```swift 150 | view1.autoPinEdge(.Top, toEdge: .Bottom, ofView: view2) 151 | ``` 152 | 153 | Without PureLayout, here's the equivalent code you'd have to write using Apple's Foundation API directly: 154 | 155 | ```swift 156 | NSLayoutConstraint(item: view1, attribute: .Top, relatedBy: .Equal, toItem: view2, attribute: .Bottom, multiplier: 1.0, constant: 0.0).active = true 157 | ``` 158 | 159 | Many APIs of PureLayout create multiple constraints for you under the hood, letting you write highly readable layout code: 160 | 161 | ```swift 162 | // 2 constraints created & activated in one line! 163 | logoImageView.autoCenterInSuperview() 164 | 165 | // 4 constraints created & activated in one line! 166 | textContentView.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsets(top: 20.0, left: 5.0, bottom: 10.0, right: 5.0)) 167 | ``` 168 | 169 | PureLayout always returns the constraints it creates so you have full control: 170 | 171 | ```swift 172 | let constraint = skinnyView.autoMatchDimension(.Height, toDimension: .Width, ofView: tallView) 173 | ``` 174 | 175 | PureLayout supports all Auto Layout features including inequalities, priorities, layout margins, identifiers, and much more. It's a comprehensive, developer-friendly way to use Auto Layout. 176 | 177 | Check out the example apps below for many more demos of PureLayout in use. 178 | 179 | ### Example Apps 180 | Open the project included in the repository (requires Xcode 6 or higher). It contains [iOS](PureLayout/Example-iOS) (`Example-iOS` scheme) and [OS X](PureLayout/Example-Mac) (`Example-Mac` scheme) demos of the library being used in various scenarios. The demos in the iOS example app make a great introductory tutorial to PureLayout -- run each demo, review the code used to implement it, then practice by making some changes of your own to the demo code. 181 | 182 | Each demo in the iOS example app has a Swift and Objective-C version. **To compile & run the Swift demos, you must use Xcode 7.0 or higher (Swift 2.0) and choose the `Example-iOS-Xcode7` scheme.** When you run the example app, you can easily switch between using the Swift and Objective-C versions of the demos. To see the constraints in action while running the iOS demos, try using different device simulators, rotating the device to different orientations, as well as toggling the taller in-call status bar in the iOS Simulator. 183 | 184 | On OS X, while running the app, press any key to cycle through the demos. You can resize the window to see the constraints in action. 185 | 186 | ### Tips and Tricks 187 | Check out some [Tips and Tricks](https://github.com/smileyborg/PureLayout/wiki/Tips-and-Tricks) to keep in mind when using the API. 188 | 189 | ## PureLayout vs. the rest 190 | There are quite a few different ways to implement Auto Layout. Here is a quick overview of the available options: 191 | 192 | * Apple [NSLayoutConstraint SDK API](https://developer.apple.com/library/ios/documentation/AppKit/Reference/NSLayoutConstraint_Class/index.html#//apple_ref/occ/clm/NSLayoutConstraint/constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:) 193 | * Pros: Raw power 194 | * Cons: Extremely verbose; tedious to write; difficult to read 195 | * Apple [Visual Format Language](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage/VisualFormatLanguage.html) 196 | * Pros: Concise; convenient 197 | * Cons: Doesn't support some use cases; lacks compile-time checking and safety; must learn syntax; hard to debug 198 | * Apple Interface Builder 199 | * Pros: Visual; interactive; provides compile-time layout checking 200 | * Cons: Difficult for complex layouts; cannot dynamically set constraints at runtime; encourages hardcoded magic numbers; not always WYSIWYG 201 | * Apple [NSLayoutAnchor SDK API](https://developer.apple.com/library/prerelease/ios/documentation/AppKit/Reference/NSLayoutAnchor_ClassReference/index.html) 202 | * Pros: Clean, readable, and type-safe API for creating individual constraints 203 | * Cons: Only available in iOS 9.0 and OS X 10.11 and higher; requires manually activating each constraint; no API for creating multiple constraints at once 204 | * **PureLayout** 205 | * Pros: Compatible with Objective-C and Swift codebases; consistent with Cocoa API style; cross-platform API and implementation shared across iOS and OS X; fully backwards-compatible to iOS 6 & OS X 10.7; easy to use; type-safe; efficient 206 | * Cons: Not the most concise expression of layout code 207 | * High-level Auto Layout Libraries/DSLs ([Cartography](https://github.com/robb/Cartography), [SnapKit](https://github.com/SnapKit/SnapKit), [KeepLayout](https://github.com/iMartinKiss/KeepLayout)) 208 | * Pros: Very clean, concise, and convenient 209 | * Cons: Unique API style is foreign to Apple's APIs; mixed compatibility with Objective-C & Swift; greater dependency on third party code 210 | 211 | PureLayout takes a balanced approach to Auto Layout that makes it well suited for any project. 212 | 213 | ## Problems, Suggestions, Pull Requests? 214 | Please open a [new Issue here](https://github.com/smileyborg/PureLayout/issues/new) if you run into a problem specific to PureLayout, have a feature request, or want to share a comment. Note that general Auto Layout questions should be asked on [Stack Overflow](http://stackoverflow.com). 215 | 216 | Pull requests are encouraged and greatly appreciated! Please try to maintain consistency with the existing code style. If you're considering taking on significant changes or additions to the project, please communicate in advance by opening a new Issue. This allows everyone to get onboard with upcoming changes, ensures that changes align with the project's design philosophy, and avoids duplicated work. 217 | 218 | ## Meta 219 | Designed & maintained by Tyler Fox ([@smileyborg](https://twitter.com/smileyborg)). Distributed with the MIT license. 220 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PureLayout 5 | 6 | This code is distributed under the terms and conditions of the MIT license. 7 | 8 | Copyright (c) 2014-2015 Tyler Fox 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | Generated by CocoaPods - http://cocoapods.org 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-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 | This code is distributed under the terms and conditions of the MIT license. 18 | 19 | Copyright (c) 2014-2015 Tyler Fox 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | Title 28 | PureLayout 29 | Type 30 | PSGroupSpecifier 31 | 32 | 33 | FooterText 34 | Generated by CocoaPods - http://cocoapods.org 35 | Title 36 | 37 | Type 38 | PSGroupSpecifier 39 | 40 | 41 | StringsTable 42 | Acknowledgements 43 | Title 44 | Acknowledgements 45 | 46 | 47 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | else 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | fi 16 | 17 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | 19 | if [ -L "${source}" ]; then 20 | echo "Symlinked..." 21 | source="$(readlink "${source}")" 22 | fi 23 | 24 | # use filter instead of exclude so missing patterns dont' throw errors 25 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 26 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 27 | 28 | # Resign the code if required by the build settings to avoid unstable apps 29 | code_sign_if_enabled "${destination}/$(basename "$1")" 30 | 31 | # Embed linked Swift runtime libraries 32 | local basename 33 | basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})" 34 | local swift_runtime_libs 35 | swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 36 | for lib in $swift_runtime_libs; do 37 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 38 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 39 | code_sign_if_enabled "${destination}/${lib}" 40 | done 41 | } 42 | 43 | # Signs a framework with the provided identity 44 | code_sign_if_enabled() { 45 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 46 | # Use the current code_sign_identitiy 47 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 48 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 49 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 50 | fi 51 | } 52 | 53 | 54 | if [[ "$CONFIGURATION" == "Debug" ]]; then 55 | install_framework 'Pods/PureLayout.framework' 56 | fi 57 | if [[ "$CONFIGURATION" == "Release" ]]; then 58 | install_framework 'Pods/PureLayout.framework' 59 | fi 60 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double PodsVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char PodsVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "PureLayout" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods { 2 | umbrella header "Pods-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 3 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" 4 | OTHER_LDFLAGS = $(inherited) -framework "PureLayout" 5 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "PureLayout.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PureLayout" "${PODS_ROOT}/Headers/Public" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PureLayout : NSObject 3 | @end 4 | @implementation PodsDummy_PureLayout 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "ALView+PureLayout.h" 4 | #import "NSArray+PureLayout.h" 5 | #import "NSLayoutConstraint+PureLayout.h" 6 | #import "PureLayout+Internal.h" 7 | #import "PureLayout.h" 8 | #import "PureLayoutDefines.h" 9 | 10 | FOUNDATION_EXPORT double PureLayoutVersionNumber; 11 | FOUNDATION_EXPORT const unsigned char PureLayoutVersionString[]; 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout.modulemap: -------------------------------------------------------------------------------- 1 | framework module PureLayout { 2 | umbrella header "PureLayout-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/PureLayout/PureLayout.xcconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smileyborg/AdaptiveAutoLayout/f0dcf38402faf70047034d2ba3553b8a7ffdab98/Pods/Target Support Files/PureLayout/PureLayout.xcconfig -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AdaptiveAutoLayout 2 | 3 | A sample project demonstrating the Offscreen Layout technique, as introduced in my Adaptive Auto Layout talk: 4 | * [YouTube video](http://www.youtube.com/watch?v=taWaW2GzfCI) (relevant portion begins at [51m:39s](http://www.youtube.com/watch?v=taWaW2GzfCI&t=51m39s)) 5 | * [PDF slides](http://cl.ly/3D332n1l3O1s) 6 | 7 | Because this project uses CocoaPods to consume [PureLayout](https://github.com/smileyborg/PureLayout), you must open the `AdaptiveAutoLayout.xcworkspace` file in Xcode to build and run the project. 8 | 9 | ## Questions or comments? 10 | File a new issue here or hit me up on Twitter [@smileyborg](https://twitter.com/smileyborg) 11 | --------------------------------------------------------------------------------