├── .gitignore ├── AutoLayoutExtension.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── AutoLayoutExtension.xcscheme ├── AutoLayoutExtension ├── AutoLayoutExtension.h ├── Extension │ ├── Array.extension.swift │ ├── Extension.swift │ ├── Functions.swift │ ├── NSLayoutConstraint.extension.swift │ ├── UIView.extension.swift │ ├── UIViewController.extension.swift │ └── UIViewLayoutGuideProxy.swift └── Info.plist ├── Example ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/test_output 68 | -------------------------------------------------------------------------------- /AutoLayoutExtension.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FE2ED0611F6A7B2E0036A620 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE2ED0601F6A7B2E0036A620 /* Functions.swift */; }; 11 | FE5250F31FA994CA006B3DED /* UIViewLayoutGuideProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE5250F21FA994CA006B3DED /* UIViewLayoutGuideProxy.swift */; }; 12 | FE5EE8021F7A3D8100CF08F8 /* UIViewController.extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE5EE8011F7A3D8100CF08F8 /* UIViewController.extension.swift */; }; 13 | FE8C0A5E1EE12E54006C6118 /* AutoLayoutExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8C0A5C1EE12E54006C6118 /* AutoLayoutExtension.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | FE8C0A6A1EE12E70006C6118 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE8C0A661EE12E70006C6118 /* Extension.swift */; }; 15 | FE8C0A6B1EE12E70006C6118 /* NSLayoutConstraint.extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE8C0A671EE12E70006C6118 /* NSLayoutConstraint.extension.swift */; }; 16 | FE8C0A6C1EE12E70006C6118 /* UIView.extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE8C0A681EE12E70006C6118 /* UIView.extension.swift */; }; 17 | FE8C0A741EE12EAB006C6118 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE8C0A731EE12EAB006C6118 /* AppDelegate.swift */; }; 18 | FE8C0A761EE12EAB006C6118 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE8C0A751EE12EAB006C6118 /* ViewController.swift */; }; 19 | FE8C0A791EE12EAB006C6118 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FE8C0A771EE12EAB006C6118 /* Main.storyboard */; }; 20 | FE8C0A7B1EE12EAB006C6118 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FE8C0A7A1EE12EAB006C6118 /* Assets.xcassets */; }; 21 | FE8C0A7E1EE12EAB006C6118 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FE8C0A7C1EE12EAB006C6118 /* LaunchScreen.storyboard */; }; 22 | FEA8F06D1EE1797000FFEBA5 /* Array.extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEA8F06C1EE1797000FFEBA5 /* Array.extension.swift */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | FE8C0A831EE13105006C6118 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = FE8C0A501EE12E54006C6118 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = FE8C0A581EE12E54006C6118; 31 | remoteInfo = AutoLayoutExtension; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | FE2ED0601F6A7B2E0036A620 /* Functions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Functions.swift; sourceTree = ""; }; 37 | FE5250F21FA994CA006B3DED /* UIViewLayoutGuideProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewLayoutGuideProxy.swift; sourceTree = ""; }; 38 | FE5EE8011F7A3D8100CF08F8 /* UIViewController.extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewController.extension.swift; sourceTree = ""; }; 39 | FE8C0A591EE12E54006C6118 /* AutoLayoutExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AutoLayoutExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | FE8C0A5C1EE12E54006C6118 /* AutoLayoutExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutoLayoutExtension.h; sourceTree = ""; }; 41 | FE8C0A5D1EE12E54006C6118 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | FE8C0A661EE12E70006C6118 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; 43 | FE8C0A671EE12E70006C6118 /* NSLayoutConstraint.extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSLayoutConstraint.extension.swift; sourceTree = ""; }; 44 | FE8C0A681EE12E70006C6118 /* UIView.extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.extension.swift; sourceTree = ""; }; 45 | FE8C0A711EE12EAB006C6118 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | FE8C0A731EE12EAB006C6118 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | FE8C0A751EE12EAB006C6118 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 48 | FE8C0A781EE12EAB006C6118 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | FE8C0A7A1EE12EAB006C6118 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 50 | FE8C0A7D1EE12EAB006C6118 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 51 | FE8C0A7F1EE12EAB006C6118 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | FEA8F06C1EE1797000FFEBA5 /* Array.extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.extension.swift; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | FE8C0A551EE12E54006C6118 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | FE8C0A6E1EE12EAB006C6118 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | FE8C0A4F1EE12E54006C6118 = { 74 | isa = PBXGroup; 75 | children = ( 76 | FE8C0A5B1EE12E54006C6118 /* AutoLayoutExtension */, 77 | FE8C0A721EE12EAB006C6118 /* Example */, 78 | FE8C0A5A1EE12E54006C6118 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | FE8C0A5A1EE12E54006C6118 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | FE8C0A591EE12E54006C6118 /* AutoLayoutExtension.framework */, 86 | FE8C0A711EE12EAB006C6118 /* Example.app */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | FE8C0A5B1EE12E54006C6118 /* AutoLayoutExtension */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | FE8C0A641EE12E70006C6118 /* Extension */, 95 | FE8C0A5C1EE12E54006C6118 /* AutoLayoutExtension.h */, 96 | FE8C0A5D1EE12E54006C6118 /* Info.plist */, 97 | ); 98 | path = AutoLayoutExtension; 99 | sourceTree = ""; 100 | }; 101 | FE8C0A641EE12E70006C6118 /* Extension */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | FE8C0A661EE12E70006C6118 /* Extension.swift */, 105 | FE8C0A671EE12E70006C6118 /* NSLayoutConstraint.extension.swift */, 106 | FE8C0A681EE12E70006C6118 /* UIView.extension.swift */, 107 | FEA8F06C1EE1797000FFEBA5 /* Array.extension.swift */, 108 | FE2ED0601F6A7B2E0036A620 /* Functions.swift */, 109 | FE5EE8011F7A3D8100CF08F8 /* UIViewController.extension.swift */, 110 | FE5250F21FA994CA006B3DED /* UIViewLayoutGuideProxy.swift */, 111 | ); 112 | path = Extension; 113 | sourceTree = ""; 114 | }; 115 | FE8C0A721EE12EAB006C6118 /* Example */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | FE8C0A731EE12EAB006C6118 /* AppDelegate.swift */, 119 | FE8C0A751EE12EAB006C6118 /* ViewController.swift */, 120 | FE8C0A771EE12EAB006C6118 /* Main.storyboard */, 121 | FE8C0A7A1EE12EAB006C6118 /* Assets.xcassets */, 122 | FE8C0A7C1EE12EAB006C6118 /* LaunchScreen.storyboard */, 123 | FE8C0A7F1EE12EAB006C6118 /* Info.plist */, 124 | ); 125 | path = Example; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXHeadersBuildPhase section */ 131 | FE8C0A561EE12E54006C6118 /* Headers */ = { 132 | isa = PBXHeadersBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | FE8C0A5E1EE12E54006C6118 /* AutoLayoutExtension.h in Headers */, 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | /* End PBXHeadersBuildPhase section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | FE8C0A581EE12E54006C6118 /* AutoLayoutExtension */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = FE8C0A611EE12E54006C6118 /* Build configuration list for PBXNativeTarget "AutoLayoutExtension" */; 145 | buildPhases = ( 146 | FE8C0A541EE12E54006C6118 /* Sources */, 147 | FE8C0A551EE12E54006C6118 /* Frameworks */, 148 | FE8C0A561EE12E54006C6118 /* Headers */, 149 | FE8C0A571EE12E54006C6118 /* Resources */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = AutoLayoutExtension; 156 | productName = AutoLayoutExtension; 157 | productReference = FE8C0A591EE12E54006C6118 /* AutoLayoutExtension.framework */; 158 | productType = "com.apple.product-type.framework"; 159 | }; 160 | FE8C0A701EE12EAB006C6118 /* Example */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = FE8C0A801EE12EAB006C6118 /* Build configuration list for PBXNativeTarget "Example" */; 163 | buildPhases = ( 164 | FE8C0A6D1EE12EAB006C6118 /* Sources */, 165 | FE8C0A6E1EE12EAB006C6118 /* Frameworks */, 166 | FE8C0A6F1EE12EAB006C6118 /* Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | FE8C0A841EE13105006C6118 /* PBXTargetDependency */, 172 | ); 173 | name = Example; 174 | productName = Example; 175 | productReference = FE8C0A711EE12EAB006C6118 /* Example.app */; 176 | productType = "com.apple.product-type.application"; 177 | }; 178 | /* End PBXNativeTarget section */ 179 | 180 | /* Begin PBXProject section */ 181 | FE8C0A501EE12E54006C6118 /* Project object */ = { 182 | isa = PBXProject; 183 | attributes = { 184 | LastSwiftUpdateCheck = 0830; 185 | LastUpgradeCheck = 1010; 186 | ORGANIZATIONNAME = mono; 187 | TargetAttributes = { 188 | FE8C0A581EE12E54006C6118 = { 189 | CreatedOnToolsVersion = 8.3.2; 190 | LastSwiftMigration = 1010; 191 | ProvisioningStyle = Automatic; 192 | }; 193 | FE8C0A701EE12EAB006C6118 = { 194 | CreatedOnToolsVersion = 8.3.2; 195 | LastSwiftMigration = 1010; 196 | ProvisioningStyle = Automatic; 197 | }; 198 | }; 199 | }; 200 | buildConfigurationList = FE8C0A531EE12E54006C6118 /* Build configuration list for PBXProject "AutoLayoutExtension" */; 201 | compatibilityVersion = "Xcode 3.2"; 202 | developmentRegion = English; 203 | hasScannedForEncodings = 0; 204 | knownRegions = ( 205 | en, 206 | Base, 207 | ); 208 | mainGroup = FE8C0A4F1EE12E54006C6118; 209 | productRefGroup = FE8C0A5A1EE12E54006C6118 /* Products */; 210 | projectDirPath = ""; 211 | projectRoot = ""; 212 | targets = ( 213 | FE8C0A581EE12E54006C6118 /* AutoLayoutExtension */, 214 | FE8C0A701EE12EAB006C6118 /* Example */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | FE8C0A571EE12E54006C6118 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | FE8C0A6F1EE12EAB006C6118 /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | FE8C0A7E1EE12EAB006C6118 /* LaunchScreen.storyboard in Resources */, 232 | FE8C0A7B1EE12EAB006C6118 /* Assets.xcassets in Resources */, 233 | FE8C0A791EE12EAB006C6118 /* Main.storyboard in Resources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | /* End PBXResourcesBuildPhase section */ 238 | 239 | /* Begin PBXSourcesBuildPhase section */ 240 | FE8C0A541EE12E54006C6118 /* Sources */ = { 241 | isa = PBXSourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | FE5EE8021F7A3D8100CF08F8 /* UIViewController.extension.swift in Sources */, 245 | FE8C0A6B1EE12E70006C6118 /* NSLayoutConstraint.extension.swift in Sources */, 246 | FE8C0A6C1EE12E70006C6118 /* UIView.extension.swift in Sources */, 247 | FEA8F06D1EE1797000FFEBA5 /* Array.extension.swift in Sources */, 248 | FE2ED0611F6A7B2E0036A620 /* Functions.swift in Sources */, 249 | FE5250F31FA994CA006B3DED /* UIViewLayoutGuideProxy.swift in Sources */, 250 | FE8C0A6A1EE12E70006C6118 /* Extension.swift in Sources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | FE8C0A6D1EE12EAB006C6118 /* Sources */ = { 255 | isa = PBXSourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | FE8C0A761EE12EAB006C6118 /* ViewController.swift in Sources */, 259 | FE8C0A741EE12EAB006C6118 /* AppDelegate.swift in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXSourcesBuildPhase section */ 264 | 265 | /* Begin PBXTargetDependency section */ 266 | FE8C0A841EE13105006C6118 /* PBXTargetDependency */ = { 267 | isa = PBXTargetDependency; 268 | target = FE8C0A581EE12E54006C6118 /* AutoLayoutExtension */; 269 | targetProxy = FE8C0A831EE13105006C6118 /* PBXContainerItemProxy */; 270 | }; 271 | /* End PBXTargetDependency section */ 272 | 273 | /* Begin PBXVariantGroup section */ 274 | FE8C0A771EE12EAB006C6118 /* Main.storyboard */ = { 275 | isa = PBXVariantGroup; 276 | children = ( 277 | FE8C0A781EE12EAB006C6118 /* Base */, 278 | ); 279 | name = Main.storyboard; 280 | sourceTree = ""; 281 | }; 282 | FE8C0A7C1EE12EAB006C6118 /* LaunchScreen.storyboard */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | FE8C0A7D1EE12EAB006C6118 /* Base */, 286 | ); 287 | name = LaunchScreen.storyboard; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | FE8C0A5F1EE12E54006C6118 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_ANALYZER_NONNULL = YES; 298 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 299 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 300 | CLANG_CXX_LIBRARY = "libc++"; 301 | CLANG_ENABLE_MODULES = YES; 302 | CLANG_ENABLE_OBJC_ARC = YES; 303 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_COMMA = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 309 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 310 | CLANG_WARN_EMPTY_BODY = YES; 311 | CLANG_WARN_ENUM_CONVERSION = YES; 312 | CLANG_WARN_INFINITE_RECURSION = YES; 313 | CLANG_WARN_INT_CONVERSION = YES; 314 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 315 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 316 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 317 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 318 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 319 | CLANG_WARN_STRICT_PROTOTYPES = YES; 320 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 321 | CLANG_WARN_UNREACHABLE_CODE = YES; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 324 | COPY_PHASE_STRIP = NO; 325 | CURRENT_PROJECT_VERSION = 1; 326 | DEBUG_INFORMATION_FORMAT = dwarf; 327 | ENABLE_STRICT_OBJC_MSGSEND = YES; 328 | ENABLE_TESTABILITY = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu99; 330 | GCC_DYNAMIC_NO_PIC = NO; 331 | GCC_NO_COMMON_BLOCKS = YES; 332 | GCC_OPTIMIZATION_LEVEL = 0; 333 | GCC_PREPROCESSOR_DEFINITIONS = ( 334 | "DEBUG=1", 335 | "$(inherited)", 336 | ); 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 344 | MTL_ENABLE_DEBUG_INFO = YES; 345 | ONLY_ACTIVE_ARCH = YES; 346 | SDKROOT = iphoneos; 347 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 348 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 349 | TARGETED_DEVICE_FAMILY = "1,2"; 350 | VERSIONING_SYSTEM = "apple-generic"; 351 | VERSION_INFO_PREFIX = ""; 352 | }; 353 | name = Debug; 354 | }; 355 | FE8C0A601EE12E54006C6118 /* Release */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ALWAYS_SEARCH_USER_PATHS = NO; 359 | CLANG_ANALYZER_NONNULL = YES; 360 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 361 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 362 | CLANG_CXX_LIBRARY = "libc++"; 363 | CLANG_ENABLE_MODULES = YES; 364 | CLANG_ENABLE_OBJC_ARC = YES; 365 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_COMMA = YES; 368 | CLANG_WARN_CONSTANT_CONVERSION = YES; 369 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | CURRENT_PROJECT_VERSION = 1; 388 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 389 | ENABLE_NS_ASSERTIONS = NO; 390 | ENABLE_STRICT_OBJC_MSGSEND = YES; 391 | GCC_C_LANGUAGE_STANDARD = gnu99; 392 | GCC_NO_COMMON_BLOCKS = YES; 393 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 394 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 395 | GCC_WARN_UNDECLARED_SELECTOR = YES; 396 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 397 | GCC_WARN_UNUSED_FUNCTION = YES; 398 | GCC_WARN_UNUSED_VARIABLE = YES; 399 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 400 | MTL_ENABLE_DEBUG_INFO = NO; 401 | SDKROOT = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | VERSIONING_SYSTEM = "apple-generic"; 406 | VERSION_INFO_PREFIX = ""; 407 | }; 408 | name = Release; 409 | }; 410 | FE8C0A621EE12E54006C6118 /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | APPLICATION_EXTENSION_API_ONLY = YES; 414 | CODE_SIGN_IDENTITY = ""; 415 | DEFINES_MODULE = YES; 416 | DYLIB_COMPATIBILITY_VERSION = 1; 417 | DYLIB_CURRENT_VERSION = 1; 418 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 419 | INFOPLIST_FILE = AutoLayoutExtension/Info.plist; 420 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 421 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 422 | PRODUCT_BUNDLE_IDENTIFIER = com.mono0926.AutoLayoutExtension; 423 | PRODUCT_NAME = "$(TARGET_NAME)"; 424 | SKIP_INSTALL = YES; 425 | SWIFT_VERSION = 4.2; 426 | }; 427 | name = Debug; 428 | }; 429 | FE8C0A631EE12E54006C6118 /* Release */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | APPLICATION_EXTENSION_API_ONLY = YES; 433 | CODE_SIGN_IDENTITY = ""; 434 | DEFINES_MODULE = YES; 435 | DYLIB_COMPATIBILITY_VERSION = 1; 436 | DYLIB_CURRENT_VERSION = 1; 437 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 438 | INFOPLIST_FILE = AutoLayoutExtension/Info.plist; 439 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = com.mono0926.AutoLayoutExtension; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SKIP_INSTALL = YES; 444 | SWIFT_VERSION = 4.2; 445 | }; 446 | name = Release; 447 | }; 448 | FE8C0A811EE12EAB006C6118 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 452 | INFOPLIST_FILE = Example/Info.plist; 453 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 455 | PRODUCT_BUNDLE_IDENTIFIER = com.mono0926.Example; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | SWIFT_VERSION = 4.2; 458 | }; 459 | name = Debug; 460 | }; 461 | FE8C0A821EE12EAB006C6118 /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | INFOPLIST_FILE = Example/Info.plist; 466 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | PRODUCT_BUNDLE_IDENTIFIER = com.mono0926.Example; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | SWIFT_VERSION = 4.2; 471 | }; 472 | name = Release; 473 | }; 474 | /* End XCBuildConfiguration section */ 475 | 476 | /* Begin XCConfigurationList section */ 477 | FE8C0A531EE12E54006C6118 /* Build configuration list for PBXProject "AutoLayoutExtension" */ = { 478 | isa = XCConfigurationList; 479 | buildConfigurations = ( 480 | FE8C0A5F1EE12E54006C6118 /* Debug */, 481 | FE8C0A601EE12E54006C6118 /* Release */, 482 | ); 483 | defaultConfigurationIsVisible = 0; 484 | defaultConfigurationName = Release; 485 | }; 486 | FE8C0A611EE12E54006C6118 /* Build configuration list for PBXNativeTarget "AutoLayoutExtension" */ = { 487 | isa = XCConfigurationList; 488 | buildConfigurations = ( 489 | FE8C0A621EE12E54006C6118 /* Debug */, 490 | FE8C0A631EE12E54006C6118 /* Release */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | FE8C0A801EE12EAB006C6118 /* Build configuration list for PBXNativeTarget "Example" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | FE8C0A811EE12EAB006C6118 /* Debug */, 499 | FE8C0A821EE12EAB006C6118 /* Release */, 500 | ); 501 | defaultConfigurationIsVisible = 0; 502 | defaultConfigurationName = Release; 503 | }; 504 | /* End XCConfigurationList section */ 505 | }; 506 | rootObject = FE8C0A501EE12E54006C6118 /* Project object */; 507 | } 508 | -------------------------------------------------------------------------------- /AutoLayoutExtension.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoLayoutExtension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AutoLayoutExtension.xcodeproj/xcshareddata/xcschemes/AutoLayoutExtension.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /AutoLayoutExtension/AutoLayoutExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutoLayoutExtension.h 3 | // AutoLayoutExtension 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for AutoLayoutExtension. 12 | FOUNDATION_EXPORT double AutoLayoutExtensionVersionNumber; 13 | 14 | //! Project version string for AutoLayoutExtension. 15 | FOUNDATION_EXPORT const unsigned char AutoLayoutExtensionVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/Array.extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Array.extension.swift 3 | // AutoLayoutExtension 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Array where Element == NSLayoutConstraint { 12 | public func activate() { 13 | NSLayoutConstraint.activate(self) 14 | } 15 | public func deactivate() { 16 | NSLayoutConstraint.deactivate(self) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extension.swift 3 | // JoinUs 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 Vikona Inc. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct AutoLayoutExtension { 12 | let base: Base 13 | init (_ base: Base) { 14 | self.base = base 15 | } 16 | } 17 | 18 | public protocol AutoLayoutExtensionCompatible { 19 | associatedtype Compatible 20 | static var ale: AutoLayoutExtension.Type { get } 21 | var ale: AutoLayoutExtension { get } 22 | } 23 | 24 | extension AutoLayoutExtensionCompatible { 25 | public static var ale: AutoLayoutExtension.Type { 26 | return AutoLayoutExtension.self 27 | } 28 | 29 | public var ale: AutoLayoutExtension { 30 | return AutoLayoutExtension(self) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/Functions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Functions.swift 3 | // AutoLayoutExtension 4 | // 5 | // Created by mono on 2017/09/14. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/NSLayoutConstraint.extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint.extension.swift 3 | // JoinUs 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 Vikona Inc. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension NSLayoutConstraint: AutoLayoutExtensionCompatible {} 12 | 13 | extension AutoLayoutExtension where Base: NSLayoutConstraint { 14 | public func activate() { 15 | base.isActive = true 16 | } 17 | public func deactivate() { 18 | base.isActive = false 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/UIView.extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView.extension.swift 3 | // JoinUs 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 Vikona Inc. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension UIView: AutoLayoutExtensionCompatible { } 12 | 13 | public typealias FilledResult = ( 14 | top: NSLayoutConstraint, 15 | left: NSLayoutConstraint, 16 | bottom: NSLayoutConstraint, 17 | right: NSLayoutConstraint) 18 | 19 | public typealias CenteredResult = ( 20 | centerX: NSLayoutConstraint, 21 | centerY: NSLayoutConstraint, 22 | width: NSLayoutConstraint?, 23 | height: NSLayoutConstraint?) 24 | 25 | extension AutoLayoutExtension where Base: UIView { 26 | 27 | @discardableResult 28 | public func addFilledSubview(_ view: UIView, insets: UIEdgeInsets = .zero) -> FilledResult { 29 | 30 | addAutoLayoutedSubview(view) 31 | 32 | let top = view.topAnchor.constraint(equalTo: base.topAnchor, constant: insets.top) 33 | let left = view.leftAnchor.constraint(equalTo: base.leftAnchor, constant: insets.left) 34 | let bottom = view.bottomAnchor.constraint(equalTo: base.bottomAnchor, constant: -insets.bottom) 35 | let right = view.rightAnchor.constraint(equalTo: base.rightAnchor, constant: -insets.right) 36 | 37 | [top, left, bottom, right].activate() 38 | 39 | return (top: top, left: left, bottom: bottom, right: right) 40 | } 41 | 42 | @discardableResult 43 | public func addCenteredSubview(_ view: UIView, offset point: CGPoint = .zero, size: CGSize? = nil) -> CenteredResult { 44 | 45 | addAutoLayoutedSubview(view) 46 | let centerX = view.centerXAnchor.constraint(equalTo: base.centerXAnchor, constant: point.x) 47 | let centerY = view.centerYAnchor.constraint(equalTo: base.centerYAnchor, constant: point.y) 48 | 49 | var width: NSLayoutConstraint? 50 | var height: NSLayoutConstraint? 51 | if let size = size { 52 | width = view.widthAnchor.constraint(equalToConstant: size.width) 53 | height = view.heightAnchor.constraint(equalToConstant: size.height) 54 | } 55 | 56 | [centerX, centerY, width, height].compactMap { $0 }.activate() 57 | 58 | return (centerX: centerX, centerY: centerY, width: width, height: height) 59 | } 60 | 61 | public func addAutoLayoutedSubview(_ view: UIView, constraints: [NSLayoutConstraint]) { 62 | addAutoLayoutedSubview(view) 63 | constraints.activate() 64 | } 65 | 66 | func addAutoLayoutedSubview(_ view: UIView) { 67 | view.translatesAutoresizingMaskIntoConstraints = false 68 | base.addSubview(view) 69 | } 70 | 71 | /// https://qiita.com/_ha1f/items/5ca6892a9115b92de288 72 | public func layoutGuideSafeOrDefault() -> UILayoutGuide { 73 | if #available(iOS 11.0, *) { 74 | return base.safeAreaLayoutGuide 75 | } else { 76 | return UIViewLayoutGuideProxy(base) 77 | } 78 | } 79 | 80 | public func insetsSafeOrDefault() -> UIEdgeInsets { 81 | if #available(iOS 11.0, *) { 82 | return base.safeAreaInsets 83 | } else { 84 | return .zero 85 | } 86 | } 87 | } 88 | 89 | extension UIView { 90 | public static let standardSpacing: CGFloat = 8 91 | 92 | public static func additionalCGFloatForUnderIOS11(_ value: CGFloat) -> CGFloat { 93 | if #available(iOS 11.0, *) { 94 | return 0 95 | } else { 96 | return value 97 | } 98 | } 99 | 100 | public static func standardSpacingForUnderIOS11() -> CGFloat { 101 | return additionalCGFloatForUnderIOS11(standardSpacing) 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/UIViewController.extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController.extension.swift 3 | // AutoLayoutExtension 4 | // 5 | // Created by mono on 2017/09/26. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension UIViewController: AutoLayoutExtensionCompatible { } 12 | 13 | extension AutoLayoutExtension where Base: UIViewController { 14 | 15 | @discardableResult 16 | public func addFilledSubviewSafely(_ view: UIView, insets: UIEdgeInsets = .zero) -> FilledResult { 17 | 18 | base.view.ale.addAutoLayoutedSubview(view) 19 | 20 | let top: NSLayoutConstraint 21 | let left: NSLayoutConstraint 22 | let bottom: NSLayoutConstraint 23 | let right: NSLayoutConstraint 24 | 25 | if #available(iOS 11.0, *) { 26 | let safeAreaLayoutGuide = base.view.safeAreaLayoutGuide 27 | top = view.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: insets.top) 28 | left = view.leftAnchor.constraint(equalTo: safeAreaLayoutGuide.leftAnchor, constant: insets.left) 29 | bottom = view.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -insets.bottom) 30 | right = view.rightAnchor.constraint(equalTo: safeAreaLayoutGuide.rightAnchor, constant: -insets.right) 31 | } else { 32 | top = view.topAnchor.constraint(equalTo: base.topLayoutGuide.bottomAnchor, constant: insets.top) 33 | left = view.leftAnchor.constraint(equalTo: base.view.leftAnchor, constant: insets.left) 34 | bottom = view.bottomAnchor.constraint(equalTo: base.bottomLayoutGuide.topAnchor, constant: -insets.bottom) 35 | right = view.rightAnchor.constraint(equalTo: base.view.rightAnchor, constant: -insets.right) 36 | } 37 | 38 | [top, left, bottom, right].activate() 39 | 40 | return (top: top, left: left, bottom: bottom, right: right) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Extension/UIViewLayoutGuideProxy.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewLayoutGuideProxy.swift 3 | // AutoLayoutExtension 4 | // 5 | // Created by mono on 2017/11/01. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | final class UIViewLayoutGuideProxy: UILayoutGuide { 12 | 13 | private weak var _base: UIView? 14 | 15 | init(_ view: UIView) { 16 | self._base = view 17 | super.init() 18 | } 19 | 20 | required init?(coder aDecoder: NSCoder) { 21 | fatalError("UIViewLayoutGuideProxy cannot be instantiated from NSCoder. Use init(UIView) instead.") 22 | } 23 | 24 | override var leftAnchor: NSLayoutXAxisAnchor { 25 | return _base?.leftAnchor ?? NSLayoutXAxisAnchor() 26 | } 27 | 28 | override var topAnchor: NSLayoutYAxisAnchor { 29 | return _base?.topAnchor ?? NSLayoutYAxisAnchor() 30 | } 31 | 32 | override var bottomAnchor: NSLayoutYAxisAnchor { 33 | return _base?.bottomAnchor ?? NSLayoutYAxisAnchor() 34 | } 35 | 36 | override var rightAnchor: NSLayoutXAxisAnchor { 37 | return _base?.rightAnchor ?? NSLayoutXAxisAnchor() 38 | } 39 | 40 | override var widthAnchor: NSLayoutDimension { 41 | return _base?.widthAnchor ?? NSLayoutDimension() 42 | } 43 | 44 | override var heightAnchor: NSLayoutDimension { 45 | return _base?.heightAnchor ?? NSLayoutDimension() 46 | } 47 | 48 | override var leadingAnchor: NSLayoutXAxisAnchor { 49 | return _base?.leadingAnchor ?? NSLayoutXAxisAnchor() 50 | } 51 | 52 | override var trailingAnchor: NSLayoutXAxisAnchor { 53 | return _base?.trailingAnchor ?? NSLayoutXAxisAnchor() 54 | } 55 | 56 | override var centerXAnchor: NSLayoutXAxisAnchor { 57 | return _base?.centerXAnchor ?? NSLayoutXAxisAnchor() 58 | } 59 | 60 | override var centerYAnchor: NSLayoutYAxisAnchor { 61 | return _base?.centerYAnchor ?? NSLayoutYAxisAnchor() 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /AutoLayoutExtension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | return true 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Example/Assets.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 | } -------------------------------------------------------------------------------- /Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by mono on 2017/06/02. 6 | // Copyright © 2017 mono. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AutoLayoutExtension 11 | 12 | class ViewController: UIViewController { 13 | let labelFilled = UILabel() 14 | let buttonFilled = UIButton(type: UIButton.ButtonType.system) 15 | let buttonToggleActive = UIButton(type: UIButton.ButtonType.system) 16 | let viewFilledOuter = UIView() 17 | let viewFilledInner = UIView() 18 | var viewFilledInnerConstrains: FilledResult! 19 | let labelCentered = UILabel() 20 | let viewCenteredOuter = UIView() 21 | let viewCenteredInner = UIView() 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | 26 | // Filled 27 | labelFilled.text = "Filled:" 28 | view.ale.addAutoLayoutedSubview(labelFilled, constraints: [ 29 | labelFilled.leftAnchor.constraint(equalTo: view.leftAnchor), 30 | labelFilled.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20) 31 | ]) 32 | viewFilledOuter.backgroundColor = .black 33 | view.ale.addAutoLayoutedSubview(viewFilledOuter, constraints: [ 34 | viewFilledOuter.topAnchor.constraint(equalTo: labelFilled.bottomAnchor, constant: 10), 35 | viewFilledOuter.leftAnchor.constraint(equalTo: view.leftAnchor), 36 | viewFilledOuter.widthAnchor.constraint(equalToConstant: 100), 37 | viewFilledOuter.heightAnchor.constraint(equalToConstant: 100), 38 | ]) 39 | viewFilledInner.backgroundColor = .red 40 | viewFilledInnerConstrains = viewFilledOuter.ale.addFilledSubview(viewFilledInner, 41 | insets: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)) 42 | buttonFilled.setTitle("Move to right", for: .normal) 43 | view.ale.addAutoLayoutedSubview(buttonFilled, constraints: [ 44 | buttonFilled.leftAnchor.constraint(equalTo: view.leftAnchor), 45 | buttonFilled.topAnchor.constraint(equalTo: viewFilledOuter.bottomAnchor) 46 | ]) 47 | buttonFilled.addTarget(self, action: #selector(moveRightDidTap(_:)), for: .touchUpInside) 48 | 49 | buttonToggleActive.setTitle("Activate/Deactivate inner right", for: .normal) 50 | view.ale.addAutoLayoutedSubview(buttonToggleActive, constraints: [ 51 | buttonToggleActive.leftAnchor.constraint(equalTo: view.leftAnchor), 52 | buttonToggleActive.topAnchor.constraint(equalTo: buttonFilled.bottomAnchor) 53 | ]) 54 | buttonToggleActive.addTarget(self, action: #selector(toggleActiveDidTap(_:)), for: .touchUpInside) 55 | 56 | // Centered: 57 | labelCentered.text = "Centered:" 58 | view.ale.addAutoLayoutedSubview(labelCentered, constraints: [ 59 | labelCentered.leftAnchor.constraint(equalTo: view.leftAnchor), 60 | labelCentered.topAnchor.constraint(equalTo: buttonToggleActive.bottomAnchor, constant: 20) 61 | ]) 62 | viewCenteredOuter.backgroundColor = .black 63 | view.ale.addAutoLayoutedSubview(viewCenteredOuter, constraints: [ 64 | viewCenteredOuter.topAnchor.constraint(equalTo: labelCentered.bottomAnchor, constant: 10), 65 | viewCenteredOuter.leftAnchor.constraint(equalTo: view.leftAnchor), 66 | viewCenteredOuter.widthAnchor.constraint(equalToConstant: 100), 67 | viewCenteredOuter.heightAnchor.constraint(equalToConstant: 100), 68 | ]) 69 | viewCenteredInner.backgroundColor = .red 70 | viewCenteredOuter.ale.addCenteredSubview(viewCenteredInner, 71 | offset: CGPoint(x: 10, y: 20), size: CGSize(width: 60, height: 40)) 72 | 73 | 74 | } 75 | 76 | @objc 77 | func moveRightDidTap(_ sender: UIButton) { 78 | let offset: CGFloat = 50 79 | viewFilledInnerConstrains.right.constant += offset 80 | UIView.animate(withDuration: 0.5, animations: { 81 | self.view.layoutIfNeeded() 82 | }){ finished in 83 | self.viewFilledInnerConstrains.left.constant += offset 84 | UIView.animate(withDuration: 0.5) { 85 | self.view.layoutIfNeeded() 86 | } 87 | } 88 | } 89 | 90 | @objc 91 | func toggleActiveDidTap(_ sender: UIButton) { 92 | let target = viewFilledInnerConstrains.right 93 | target.isActive = !target.isActive 94 | self.view.layoutIfNeeded() 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Masayuki Ono 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoLayoutExtension 2 | Thin wrapper of AutoLayout 3 | 4 | ## Usage 5 | 6 | See [Example](https://github.com/mono0926/AutoLayoutExtension/blob/master/Example/ViewController.swift). 7 | --------------------------------------------------------------------------------