From d4cb974b3e776da3935933af5d2d76992266d35c Mon Sep 17 00:00:00 2001 From: Steve Dao Date: Wed, 8 Jul 2020 06:58:01 +0800 Subject: [PATCH 1/4] Updated DYLIB_COMPATIBILITY_VERSION & DYLIB_CURRENT_VERSION (#646) * Fixed carthage DYLIB_COMPATIBILITY_VERSION * updated DYLIB_CURRENT_VERSION --- SnapKit.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SnapKit.xcodeproj/project.pbxproj b/SnapKit.xcodeproj/project.pbxproj index 58f9b93..cb0a901 100644 --- a/SnapKit.xcodeproj/project.pbxproj +++ b/SnapKit.xcodeproj/project.pbxproj @@ -520,6 +520,8 @@ CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1.0.0; DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -541,6 +543,8 @@ CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1.0.0; DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; From 851bbf8dd838b31d5d64a659956a322be7a96eaa Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Wed, 13 Apr 2022 16:06:06 +1200 Subject: [PATCH 2/4] Feature/release 5.6 (#746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for UILayoutPriority as priority target. (#466) * Add support for UILayoutPriority as priority target. * Fixed for tvOS * Add update(priority: ConstraintPriority) method (#467) * Add update(priority: ConstraintPriority) method * Fix copy-paste error * Add Swift Package Manager support (#501) * Swift4.2 (#516) * make ConstraintAttributes conform to ExpressibleByIntegerLiteral (#520) * Adds 'constraint.isActive = bool' to Constraint (#496) * delegate identical 'constraint creation' code to 'prepareConstraints' * adds 'set(isActivated:)' method to call appropriate 'activate/deactivate' based on bool cleans up about 30 lines of if foo { activate } else { deactivate } code in my app * instead of 'set(isActivated:)', use 'isActive = value' * Add swift version to podspec * Update podspec * Update podspec * Update project to get rid of Migration Warning (#547) * Update Swift Language version to 4.2 under build settings (#551) * Update swift language version to 4.2 in build settings * Update podspec * Remove Swift Version file * Remove Package.swift, SnapKit is not SwiftPM compatible anyways * Update Podspec * Update version in Podspec * Support swift 5.0 (#570) * Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed * [EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574) * @sashabelonogov Update LayoutConstraint == operator to support iOS 10 and higher changes * Simplify return statement of the LayoutConstraint == operator * Fix incorrect behavior of inset with center and baseline anchors (#569) * Fix insets adjusting center attributes incorrectly * Fix insets adjusting baseline attributes incorrectly * Add back Package.swift for SwiftPM compatibility (#559) reverts 477fffae4c37386285f78511ff4120f1f5324ff8 * Update podspec * Update min target versions * Update min target versions * Update README.md * Update README.md * Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593) This reverts commit bc2b0b93320513eb747b3baf6332c05bacc067b4. * Update Podspec * Bump min version requirements * Fix layout constraint comparison * Fix equality check for iOS * Adds support for NSDirectionalEdgeInsets as an inset constant (#594) * Make ConstraintViewDSL content priorities nonmutating (#586) * Adds two new compositions – DirectionalEdges and DirectionalMargins (#595) * WIP * Add directional margins * Whitespace * Add Playground Sample (#608) * added updates to Package.swift so it can be imported with Xcode 11 (#615) * Revert #574 * Update Podspec * Add background color to quick start box in README.md (#619) * add-dimensional-edges: add ConstraintItems horizontalEdges, verticalEdges, directionalHorizontalEdges and directionalVerticalEdges as convenience items to express left+right, top+bottom or leading+trailing (#637) * Update deprecations to allow Xcode to auto-fixup. (#634) * Migrate to Xcode 11 and updated travis.yml (#629) * Migrate to Xcode 11 and updated travis.yml * Travis to support Xcode 11 * project.pbxproj: Update to recommended settings. (#627) * Add test assert to unit test testCanSetLabel. (#625) * Add back support for OS X 10.11 (#645) * Use << for ConstraintAttributes options (#659) * Use << for ConstraintAttributes options * iPhone 6s is not supported by the latest Xcode * Add method getting constraint with closure to ConstraintMakerRelatable (#663) * add ConstraintMakerRelatable extension * fix fatalError message Co-authored-by: Jimi * Xcode 12 and SwiftPM enhancements * Update README to include SPM installation notes (#673) * Fix typo * Remove duplicate file * xcodeproject configuration enhancement for localization (#584) Co-authored-by: AmrAngry * Updates to project files * Dynamic Product (#710) This PR adds a dynamic product to SnapKit. Having a dynamic product is important in modular project structures; multiple packages may be using SnapKit, and this allows that support without the end-user have to wrap SnapKit in their own package that exposes it and using that package in lieu of SnapKit. * Fix warning about `class` (#714) * Added Example-iOS.xcdodeproj and fixed examples (#707) * Update README.md, add missing Migration Guides section (#721) * Make ConstraintMaker.item public (#693) * Typo source directory in Podspec (#738) Source directory has been renamed in 18608ead653bfe1e05e3d1f6fb6d34f62cec49bd * Release 5.6 * Update urls in readme * Update podspec version Co-authored-by: Benjamin Chrobot Co-authored-by: Linus Unnebäck Co-authored-by: Mauro Vime Castillo Co-authored-by: o( ̄へ ̄)o Co-authored-by: Colin T.A. Gray Co-authored-by: Shai Mishali Co-authored-by: Ibrahim Koteish Co-authored-by: Jungwon An Co-authored-by: Alexander Belonogov Co-authored-by: Christian Schnorr Co-authored-by: Josh Converse Co-authored-by: Vitalii Budnik Co-authored-by: Shiva Huang Co-authored-by: Max Cobb <5754073+maxxfrazer@users.noreply.github.com> Co-authored-by: Liam Elmore <32336260+iosmo@users.noreply.github.com> Co-authored-by: Sven Driemecker Co-authored-by: Alex Simpson Co-authored-by: pushp1989 <54930194+pushp1989@users.noreply.github.com> Co-authored-by: Ben Yohay Co-authored-by: Natascha Fadeeva Co-authored-by: Wang, Chi Co-authored-by: Roman Podymov Co-authored-by: wotjd Co-authored-by: Jimi Co-authored-by: Samuel Eshun Co-authored-by: Amr Elghadban Co-authored-by: AmrAngry Co-authored-by: Hesham Salman Co-authored-by: Mr. Ming Co-authored-by: Teameh Co-authored-by: Josip Rezić Co-authored-by: Rhett Tuan Co-authored-by: Damien Debin Co-authored-by: Robert Payne --- .gitignore | 2 + .swift-version | 1 - .travis.yml | 8 +- Example-iOS/AppDelegate.swift | 4 +- .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 45 ++- Example-iOS/Assets.xcassets/Contents.json | 6 + .../Example-iOS.xcodeproj/project.pbxproj | 360 ++++++++++++++++++ Example-iOS/ListViewController.swift | 4 +- Package.swift | 19 +- README.md | 46 ++- SnapKit.podspec | 12 +- SnapKit.xcodeproj/project.pbxproj | 94 +++-- .../xcshareddata/xcschemes/SnapKit.xcscheme | 24 +- SnapKit.xcworkspace/contents.xcworkspacedata | 3 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + SnapKitPlayground.playground/Contents.swift | 29 ++ .../contents.xcplayground | 4 + .../contents.xcworkspacedata | 4 + .../timeline.xctimeline | 6 + Source/ConstraintView+Extensions.swift | 152 -------- {Source => Sources}/Constraint.swift | 78 +++- .../ConstraintAttributes.swift | 91 +++-- {Source => Sources}/ConstraintConfig.swift | 0 .../ConstraintConstantTarget.swift | 86 ++++- {Source => Sources}/ConstraintDSL.swift | 28 +- .../ConstraintDescription.swift | 0 .../ConstraintDirectionalInsetTarget.swift | 49 +++ .../ConstraintDirectionalInsets.swift | 13 +- .../ConstraintInsetTarget.swift | 0 {Source => Sources}/ConstraintInsets.swift | 0 {Source => Sources}/ConstraintItem.swift | 0 .../ConstraintLayoutGuide+Extensions.swift | 2 +- .../ConstraintLayoutGuide.swift | 0 .../ConstraintLayoutGuideDSL.swift | 0 .../ConstraintLayoutSupport.swift | 0 .../ConstraintLayoutSupportDSL.swift | 0 {Source => Sources}/ConstraintMaker.swift | 44 ++- .../ConstraintMakerEditable.swift | 10 +- .../ConstraintMakerExtendable.swift | 28 +- .../ConstraintMakerFinalizable.swift | 0 .../ConstraintMakerPrioritizable.swift | 12 +- .../ConstraintMakerRelatable+Extensions.swift | 57 +++ .../ConstraintMakerRelatable.swift | 4 +- .../ConstraintMultiplierTarget.swift | 0 .../ConstraintOffsetTarget.swift | 0 {Source => Sources}/ConstraintPriority.swift | 0 .../ConstraintPriorityTarget.swift | 10 + .../ConstraintRelatableTarget.swift | 6 + {Source => Sources}/ConstraintRelation.swift | 0 Sources/ConstraintView+Extensions.swift | 152 ++++++++ {Source => Sources}/ConstraintView.swift | 0 {Source => Sources}/ConstraintViewDSL.swift | 8 +- {Source => Sources}/Debugging.swift | 15 +- {Source => Sources}/LayoutConstraint.swift | 12 +- .../LayoutConstraintItem.swift | 2 +- {Source => Sources}/Typealiases.swift | 5 + .../UILayoutSupport+Extensions.swift | 2 +- {Source => Supporting Files}/Info.plist | 0 Tests/{ => SnapKitTests}/Info.plist | 0 Tests/{ => SnapKitTests}/Tests.swift | 226 ++++++++++- 61 files changed, 1429 insertions(+), 353 deletions(-) delete mode 100644 .swift-version create mode 100644 Example-iOS/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Example-iOS/Assets.xcassets/Contents.json create mode 100644 Example-iOS/Example-iOS.xcodeproj/project.pbxproj create mode 100644 SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 SnapKitPlayground.playground/Contents.swift create mode 100644 SnapKitPlayground.playground/contents.xcplayground create mode 100644 SnapKitPlayground.playground/playground.xcworkspace/contents.xcworkspacedata create mode 100644 SnapKitPlayground.playground/timeline.xctimeline delete mode 100644 Source/ConstraintView+Extensions.swift rename {Source => Sources}/Constraint.swift (79%) rename {Source => Sources}/ConstraintAttributes.swift (61%) rename {Source => Sources}/ConstraintConfig.swift (100%) rename {Source => Sources}/ConstraintConstantTarget.swift (63%) rename {Source => Sources}/ConstraintDSL.swift (85%) rename {Source => Sources}/ConstraintDescription.swift (100%) create mode 100644 Sources/ConstraintDirectionalInsetTarget.swift rename Source/SnapKit.h => Sources/ConstraintDirectionalInsets.swift (84%) rename {Source => Sources}/ConstraintInsetTarget.swift (100%) rename {Source => Sources}/ConstraintInsets.swift (100%) rename {Source => Sources}/ConstraintItem.swift (100%) rename {Source => Sources}/ConstraintLayoutGuide+Extensions.swift (96%) rename {Source => Sources}/ConstraintLayoutGuide.swift (100%) rename {Source => Sources}/ConstraintLayoutGuideDSL.swift (100%) rename {Source => Sources}/ConstraintLayoutSupport.swift (100%) rename {Source => Sources}/ConstraintLayoutSupportDSL.swift (100%) rename {Source => Sources}/ConstraintMaker.swift (86%) rename {Source => Sources}/ConstraintMakerEditable.swift (84%) rename {Source => Sources}/ConstraintMakerExtendable.swift (83%) rename {Source => Sources}/ConstraintMakerFinalizable.swift (100%) rename Source/ConstraintMakerPriortizable.swift => Sources/ConstraintMakerPrioritizable.swift (81%) create mode 100644 Sources/ConstraintMakerRelatable+Extensions.swift rename {Source => Sources}/ConstraintMakerRelatable.swift (95%) rename {Source => Sources}/ConstraintMultiplierTarget.swift (100%) rename {Source => Sources}/ConstraintOffsetTarget.swift (100%) rename {Source => Sources}/ConstraintPriority.swift (100%) rename {Source => Sources}/ConstraintPriorityTarget.swift (92%) rename {Source => Sources}/ConstraintRelatableTarget.swift (93%) rename {Source => Sources}/ConstraintRelation.swift (100%) create mode 100644 Sources/ConstraintView+Extensions.swift rename {Source => Sources}/ConstraintView.swift (100%) rename {Source => Sources}/ConstraintViewDSL.swift (97%) rename {Source => Sources}/Debugging.swift (94%) rename {Source => Sources}/LayoutConstraint.swift (79%) rename {Source => Sources}/LayoutConstraintItem.swift (98%) rename {Source => Sources}/Typealiases.swift (91%) rename {Source => Sources}/UILayoutSupport+Extensions.swift (96%) rename {Source => Supporting Files}/Info.plist (100%) rename Tests/{ => SnapKitTests}/Info.plist (100%) rename Tests/{ => SnapKitTests}/Tests.swift (65%) diff --git a/.gitignore b/.gitignore index c0dbc2e..c15ee17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.build/ project.xcworkspace xcuserdata Examples/ @@ -5,3 +6,4 @@ Examples/ Gemfile Gemfile.lock *.sketch +.swiftpm diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 389f774..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.0 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ebd8151..1cfdf13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode11 env: - - ACTION=test PLATFORM=Mac DESTINATION='platform=OS X' - - ACTION=test PLATFORM=iOS DESTINATION='platform=iOS Simulator,name=iPhone 6S' - - ACTION=test PLATFORM=tvOS DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' + - ACTION=test PLATFORM=Mac DESTINATION='platform=macOS' + - ACTION=test PLATFORM=iOS DESTINATION='platform=iOS Simulator,name=iPhone 8' + - ACTION=test PLATFORM=tvOS DESTINATION='platform=tvOS Simulator,name=Apple TV 4K (at 1080p)' script: - set -o pipefail && xcodebuild -scheme SnapKit -destination "$DESTINATION" $ACTION | xcpretty diff --git a/Example-iOS/AppDelegate.swift b/Example-iOS/AppDelegate.swift index 9f89af6..cb672ba 100644 --- a/Example-iOS/AppDelegate.swift +++ b/Example-iOS/AppDelegate.swift @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { self.window = UIWindow(frame: UIScreen.main.bounds) @@ -27,4 +27,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } -} \ No newline at end of file +} diff --git a/Example-iOS/Assets.xcassets/AccentColor.colorset/Contents.json b/Example-iOS/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example-iOS/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..8121323 100644 --- a/Example-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -2,37 +2,52 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Example-iOS/Assets.xcassets/Contents.json b/Example-iOS/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example-iOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-iOS/Example-iOS.xcodeproj/project.pbxproj b/Example-iOS/Example-iOS.xcodeproj/project.pbxproj new file mode 100644 index 0000000..61738e0 --- /dev/null +++ b/Example-iOS/Example-iOS.xcodeproj/project.pbxproj @@ -0,0 +1,360 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 440B451E25D8696C00334F54 /* ListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B451B25D8696C00334F54 /* ListViewController.swift */; }; + 440B452125D869A700334F54 /* BasicUIScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B451F25D869A700334F54 /* BasicUIScrollViewController.swift */; }; + 440B452225D869A700334F54 /* SimpleLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B452025D869A700334F54 /* SimpleLayoutViewController.swift */; }; + 440B452B25D86C0100334F54 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 440B452A25D86C0100334F54 /* SnapKit */; }; + 44477D7225D86845009F5E40 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44477D7125D86845009F5E40 /* AppDelegate.swift */; }; + 44477D7B25D86846009F5E40 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 44477D7A25D86846009F5E40 /* Assets.xcassets */; }; + 44477D7E25D86846009F5E40 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 44477D7C25D86846009F5E40 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 440B451B25D8696C00334F54 /* ListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListViewController.swift; sourceTree = ""; }; + 440B451F25D869A700334F54 /* BasicUIScrollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BasicUIScrollViewController.swift; path = demos/BasicUIScrollViewController.swift; sourceTree = ""; }; + 440B452025D869A700334F54 /* SimpleLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SimpleLayoutViewController.swift; path = demos/SimpleLayoutViewController.swift; sourceTree = ""; }; + 440B452925D86BF200334F54 /* SnapKit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = SnapKit; path = ..; sourceTree = ""; }; + 44477D6E25D86845009F5E40 /* Example-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 44477D7125D86845009F5E40 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 44477D7A25D86846009F5E40 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 44477D7D25D86846009F5E40 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 44477D7F25D86846009F5E40 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 44477D6B25D86845009F5E40 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 440B452B25D86C0100334F54 /* SnapKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 440B452725D86BDF00334F54 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 440B452925D86BF200334F54 /* SnapKit */, + ); + name = Frameworks; + sourceTree = ""; + }; + 44477D6525D86845009F5E40 = { + isa = PBXGroup; + children = ( + 44477D7025D86845009F5E40 /* Example-iOS */, + 44477D6F25D86845009F5E40 /* Products */, + 440B452725D86BDF00334F54 /* Frameworks */, + ); + sourceTree = ""; + }; + 44477D6F25D86845009F5E40 /* Products */ = { + isa = PBXGroup; + children = ( + 44477D6E25D86845009F5E40 /* Example-iOS.app */, + ); + name = Products; + sourceTree = ""; + }; + 44477D7025D86845009F5E40 /* Example-iOS */ = { + isa = PBXGroup; + children = ( + 44477D7C25D86846009F5E40 /* LaunchScreen.storyboard */, + 44477D7A25D86846009F5E40 /* Assets.xcassets */, + 44477D7F25D86846009F5E40 /* Info.plist */, + 44477D7125D86845009F5E40 /* AppDelegate.swift */, + 440B451B25D8696C00334F54 /* ListViewController.swift */, + 440B451F25D869A700334F54 /* BasicUIScrollViewController.swift */, + 440B452025D869A700334F54 /* SimpleLayoutViewController.swift */, + ); + name = "Example-iOS"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 44477D6D25D86845009F5E40 /* Example-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 44477D8225D86846009F5E40 /* Build configuration list for PBXNativeTarget "Example-iOS" */; + buildPhases = ( + 44477D6A25D86845009F5E40 /* Sources */, + 44477D6B25D86845009F5E40 /* Frameworks */, + 44477D6C25D86845009F5E40 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Example-iOS"; + packageProductDependencies = ( + 440B452A25D86C0100334F54 /* SnapKit */, + ); + productName = "Example-iOS"; + productReference = 44477D6E25D86845009F5E40 /* Example-iOS.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 44477D6625D86845009F5E40 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 44477D6D25D86845009F5E40 = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 44477D6925D86845009F5E40 /* Build configuration list for PBXProject "Example-iOS" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 44477D6525D86845009F5E40; + productRefGroup = 44477D6F25D86845009F5E40 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 44477D6D25D86845009F5E40 /* Example-iOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 44477D6C25D86845009F5E40 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 44477D7E25D86846009F5E40 /* LaunchScreen.storyboard in Resources */, + 44477D7B25D86846009F5E40 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 44477D6A25D86845009F5E40 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 440B452225D869A700334F54 /* SimpleLayoutViewController.swift in Sources */, + 440B451E25D8696C00334F54 /* ListViewController.swift in Sources */, + 440B452125D869A700334F54 /* BasicUIScrollViewController.swift in Sources */, + 44477D7225D86845009F5E40 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 44477D7C25D86846009F5E40 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 44477D7D25D86846009F5E40 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 44477D8025D86846009F5E40 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 44477D8125D86846009F5E40 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 44477D8325D86846009F5E40 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 44477D8425D86846009F5E40 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 44477D6925D86845009F5E40 /* Build configuration list for PBXProject "Example-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 44477D8025D86846009F5E40 /* Debug */, + 44477D8125D86846009F5E40 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 44477D8225D86846009F5E40 /* Build configuration list for PBXNativeTarget "Example-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 44477D8325D86846009F5E40 /* Debug */, + 44477D8425D86846009F5E40 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 440B452A25D86C0100334F54 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + productName = SnapKit; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 44477D6625D86845009F5E40 /* Project object */; +} diff --git a/Example-iOS/ListViewController.swift b/Example-iOS/ListViewController.swift index 5b5082b..9a8aa96 100644 --- a/Example-iOS/ListViewController.swift +++ b/Example-iOS/ListViewController.swift @@ -39,8 +39,8 @@ class ListViewController: UITableViewController { let viewController = SimpleLayoutViewController() navigationController?.pushViewController(viewController, animated: true) } else if indexPath.row == 1 { - let viewController = ViewController() + let viewController = BasicUIScrollViewController() navigationController?.pushViewController(viewController, animated: true) } } -} \ No newline at end of file +} diff --git a/Package.swift b/Package.swift index 2e87314..c3d31cd 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,4 @@ +// swift-tools-version:5.0 // // SnapKit // @@ -25,5 +26,21 @@ import PackageDescription let package = Package( - name: "SnapKit" + name: "SnapKit", + platforms: [ + .iOS(.v10), + .macOS(.v10_11), + .tvOS(.v10) + ], + products: [ + .library(name: "SnapKit", targets: ["SnapKit"]), + .library(name: "SnapKit-Dynamic", type: .dynamic, targets: ["SnapKit"]), + ], + targets: [ + .target(name: "SnapKit", path: "Sources"), + .testTarget(name: "SnapKitTests", dependencies: ["SnapKit"]), + ], + swiftLanguageVersions: [ + .v5 + ] ) diff --git a/README.md b/README.md index fed2133..b36df7a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. @@ -7,8 +7,8 @@ SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. [![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -#### ⚠️ **To use with Swift 3.x please ensure you are using >= 3.0.0** ⚠️ -#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️ +#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️ +#### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️ ## Contents @@ -22,9 +22,13 @@ SnapKit is a DSL to make Auto Layout easy on both iOS and OS X. ## Requirements -- iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+ -- Xcode 9.0+ -- Swift 3.0+ +- iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+ +- Xcode 10.0+ +- Swift 4.0+ + +## Migration Guides + +- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md) ## Communication @@ -55,7 +59,7 @@ platform :ios, '10.0' use_frameworks! target '' do - pod 'SnapKit', '~> 4.0.0' + pod 'SnapKit', '~> 5.6.0' end ``` @@ -79,11 +83,25 @@ $ brew install carthage To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`: ```ogdl -github "SnapKit/SnapKit" ~> 4.0.0 +github "SnapKit/SnapKit" ~> 5.0.0 ``` Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project. +### Swift Package Manager + +[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. + +> Xcode 11+ is required to build SnapKit using Swift Package Manager. + +To integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`: + +```swift +dependencies: [ + .package(url: "https://github.com/SnapKit/SnapKit.git", .upToNextMajor(from: "5.0.1")) +] +``` + ### Manually If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually. @@ -105,6 +123,7 @@ class MyViewController: UIViewController { super.viewDidLoad() self.view.addSubview(box) + box.backgroundColor = .green box.snp.makeConstraints { (make) -> Void in make.width.height.equalTo(50) make.center.equalTo(self.view) @@ -114,10 +133,17 @@ class MyViewController: UIViewController { } ``` +### Playground +You can try SnapKit in Playground. + +**Note:** + +> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first. + ### Resources -- [Documentation](http://snapkit.io/docs/) -- [F.A.Q.](http://snapkit.io/faq/) +- [Documentation](https://snapkit.github.io/SnapKit/docs/) +- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/) ## Credits diff --git a/SnapKit.podspec b/SnapKit.podspec index 7b50368..1708568 100644 --- a/SnapKit.podspec +++ b/SnapKit.podspec @@ -1,18 +1,18 @@ Pod::Spec.new do |s| s.name = 'SnapKit' - s.version = '4.0.0' + s.version = '5.6.0' s.license = 'MIT' s.summary = 'Harness the power of auto layout with a simplified, chainable, and compile time safe syntax.' s.homepage = 'https://github.com/SnapKit/SnapKit' s.authors = { 'Robert Payne' => 'robertpayne@me.com' } s.social_media_url = 'http://twitter.com/robertjpayne' - s.source = { :git => 'https://github.com/SnapKit/SnapKit.git', :tag => '4.0.0' } + s.source = { :git => 'https://github.com/SnapKit/SnapKit.git', :tag => '5.0.1' } - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '10.0' s.osx.deployment_target = '10.11' - s.tvos.deployment_target = '9.0' + s.tvos.deployment_target = '10.0' - s.source_files = 'Source/*.swift' + s.source_files = 'Sources/*.swift' - s.requires_arc = true + s.swift_version = '5.0' end diff --git a/SnapKit.xcodeproj/project.pbxproj b/SnapKit.xcodeproj/project.pbxproj index cb0a901..d2d8322 100644 --- a/SnapKit.xcodeproj/project.pbxproj +++ b/SnapKit.xcodeproj/project.pbxproj @@ -8,6 +8,9 @@ /* Begin PBXBuildFile section */ 2DBA080E1F1FAD66001CFED4 /* Typealiases.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DBA080D1F1FAD66001CFED4 /* Typealiases.swift */; }; + 3CA7D6C224592D4D005E10C2 /* ConstraintMakerRelatable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CA7D6C124592D4D005E10C2 /* ConstraintMakerRelatable+Extensions.swift */; }; + 7E1CB2AE227BB5520066B6C0 /* ConstraintDirectionalInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E1CB2AD227BB5520066B6C0 /* ConstraintDirectionalInsetTarget.swift */; }; + 7E1CB2B0227BBDF70066B6C0 /* ConstraintDirectionalInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E1CB2AF227BBDF70066B6C0 /* ConstraintDirectionalInsets.swift */; }; EE235F5F1C5785BC00C08960 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F5E1C5785BC00C08960 /* Debugging.swift */; }; EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F621C5785C600C08960 /* Constraint.swift */; }; EE235F701C5785C600C08960 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F631C5785C600C08960 /* ConstraintDescription.swift */; }; @@ -26,7 +29,7 @@ EE235FA31C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */; }; EE235FAC1C5785D400C08960 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA61C5785D400C08960 /* ConstraintMaker.swift */; }; EE235FAF1C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */; }; - EE235FB21C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */; }; + EE235FB21C5785D400C08960 /* ConstraintMakerPrioritizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA81C5785D400C08960 /* ConstraintMakerPrioritizable.swift */; }; EE235FB51C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */; }; EE235FB81C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */; }; EE235FBB1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */; }; @@ -36,7 +39,6 @@ EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; }; EE6087751E4F133E0029CF84 /* ConstraintPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6087741E4F133E0029CF84 /* ConstraintPriority.swift */; }; EE6898CB1DA7B3A100D47F33 /* LayoutConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6898CA1DA7B3A100D47F33 /* LayoutConstraintItem.swift */; }; - EECDB3741AC0C9B6006BBC11 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; EECDB3931AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; }; EEF68F9E1D78492400980C26 /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */; }; EEF68FA61D784A5300980C26 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */; }; @@ -48,7 +50,10 @@ /* Begin PBXFileReference section */ 2DBA080D1F1FAD66001CFED4 /* Typealiases.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Typealiases.swift; sourceTree = ""; }; + 3CA7D6C124592D4D005E10C2 /* ConstraintMakerRelatable+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ConstraintMakerRelatable+Extensions.swift"; sourceTree = ""; }; 537DCE9A1C35CD4100B5B899 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 7E1CB2AD227BB5520066B6C0 /* ConstraintDirectionalInsetTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintDirectionalInsetTarget.swift; sourceTree = ""; }; + 7E1CB2AF227BBDF70066B6C0 /* ConstraintDirectionalInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintDirectionalInsets.swift; sourceTree = ""; }; EE235F5E1C5785BC00C08960 /* Debugging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debugging.swift; sourceTree = ""; }; EE235F621C5785C600C08960 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = ""; }; EE235F631C5785C600C08960 /* ConstraintDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDescription.swift; sourceTree = ""; }; @@ -67,7 +72,7 @@ EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintInsetTarget.swift; sourceTree = ""; }; EE235FA61C5785D400C08960 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = ""; }; EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerFinalizable.swift; sourceTree = ""; }; - EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerPriortizable.swift; sourceTree = ""; }; + EE235FA81C5785D400C08960 /* ConstraintMakerPrioritizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerPrioritizable.swift; sourceTree = ""; }; EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerEditable.swift; sourceTree = ""; }; EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerRelatable.swift; sourceTree = ""; }; EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerExtendable.swift; sourceTree = ""; }; @@ -76,14 +81,13 @@ EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConstraintView+Extensions.swift"; sourceTree = ""; }; EE6087741E4F133E0029CF84 /* ConstraintPriority.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintPriority.swift; sourceTree = ""; }; EE6898CA1DA7B3A100D47F33 /* LayoutConstraintItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraintItem.swift; sourceTree = ""; }; + EE6DB559251D9A6B00E0C374 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; EE94F6081AC0F10A008767FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; EE94F60A1AC0F10F008767FF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; }; EEBCC9D819CC627D0083B827 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EEBCC9E219CC627E0083B827 /* SnapKit Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - EECDB3641AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - EECDB3661AC0C95C006BBC11 /* SnapKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnapKit.h; sourceTree = ""; }; - EECDB3691AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - EECDB36A1AC0C95C006BBC11 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; + EECDB3691AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = SnapKitTests/Info.plist; sourceTree = ""; }; + EECDB36A1AC0C95C006BBC11 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Tests.swift; path = SnapKitTests/Tests.swift; sourceTree = ""; }; EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutGuideDSL.swift; sourceTree = ""; }; EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDSL.swift; sourceTree = ""; }; EEF68FAF1D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConstraintLayoutGuide+Extensions.swift"; sourceTree = ""; }; @@ -114,7 +118,8 @@ DDC9FD8C1981B4DD009612C7 = { isa = PBXGroup; children = ( - EECDB35D1AC0C95C006BBC11 /* Source */, + EE6DB557251D9A6B00E0C374 /* Supporting Files */, + EECDB35D1AC0C95C006BBC11 /* Sources */, EE94F60C1AC0F113008767FF /* Frameworks */, DDC9FD961981B4DD009612C7 /* Products */, ); @@ -135,6 +140,7 @@ EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */, EEF68FAF1D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift */, EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */, + 3CA7D6C124592D4D005E10C2 /* ConstraintMakerRelatable+Extensions.swift */, ); name = Extensions; sourceTree = ""; @@ -155,7 +161,7 @@ children = ( EE235FA61C5785D400C08960 /* ConstraintMaker.swift */, EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */, - EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */, + EE235FA81C5785D400C08960 /* ConstraintMakerPrioritizable.swift */, EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */, EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */, EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */, @@ -172,6 +178,7 @@ EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */, EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */, EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */, + 7E1CB2AD227BB5520066B6C0 /* ConstraintDirectionalInsetTarget.swift */, ); name = Targets; sourceTree = ""; @@ -183,6 +190,7 @@ EE235F621C5785C600C08960 /* Constraint.swift */, EE235F631C5785C600C08960 /* ConstraintDescription.swift */, EE235F641C5785C600C08960 /* ConstraintInsets.swift */, + 7E1CB2AF227BBDF70066B6C0 /* ConstraintDirectionalInsets.swift */, EE235F651C5785C600C08960 /* ConstraintConfig.swift */, EE235F661C5785C600C08960 /* ConstraintView.swift */, EEF68FBB1D78653000980C26 /* ConstraintLayoutGuide.swift */, @@ -205,6 +213,14 @@ name = Debugging; sourceTree = ""; }; + EE6DB557251D9A6B00E0C374 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + EE6DB559251D9A6B00E0C374 /* Info.plist */, + ); + path = "Supporting Files"; + sourceTree = ""; + }; EE94F60C1AC0F113008767FF /* Frameworks */ = { isa = PBXGroup; children = ( @@ -215,20 +231,18 @@ name = Frameworks; sourceTree = ""; }; - EECDB35D1AC0C95C006BBC11 /* Source */ = { + EECDB35D1AC0C95C006BBC11 /* Sources */ = { isa = PBXGroup; children = ( - EECDB3661AC0C95C006BBC11 /* SnapKit.h */, EE235F581C57858700C08960 /* Extensions */, EE235F591C57859200C08960 /* DSLs */, EE235F5A1C57859900C08960 /* Maker */, EE235F5B1C57859E00C08960 /* Targets */, EE235F5C1C5785A400C08960 /* Models */, EE235F5D1C5785AC00C08960 /* Debugging */, - EECDB36B1AC0C967006BBC11 /* Supporting Files */, EECDB3681AC0C95C006BBC11 /* Tests */, ); - path = Source; + path = Sources; sourceTree = ""; }; EECDB3681AC0C95C006BBC11 /* Tests */ = { @@ -241,14 +255,6 @@ path = ../Tests; sourceTree = ""; }; - EECDB36B1AC0C967006BBC11 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - EECDB3641AC0C95C006BBC11 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -256,7 +262,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - EECDB3741AC0C9B6006BBC11 /* SnapKit.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -305,23 +310,23 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1230; ORGANIZATIONNAME = "SnapKit Team"; TargetAttributes = { EEBCC9D719CC627D0083B827 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; EEBCC9E119CC627D0083B827 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = DDC9FD901981B4DD009612C7 /* Build configuration list for PBXProject "SnapKit" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -371,6 +376,7 @@ EE235FB51C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */, EEF68FBC1D78653000980C26 /* ConstraintLayoutGuide.swift in Sources */, EE235FAC1C5785D400C08960 /* ConstraintMaker.swift in Sources */, + 7E1CB2AE227BB5520066B6C0 /* ConstraintDirectionalInsetTarget.swift in Sources */, EE6087751E4F133E0029CF84 /* ConstraintPriority.swift in Sources */, EE235F941C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */, EEF68FA61D784A5300980C26 /* ConstraintDSL.swift in Sources */, @@ -384,13 +390,15 @@ EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */, EE235F791C5785C600C08960 /* ConstraintView.swift in Sources */, EE6898CB1DA7B3A100D47F33 /* LayoutConstraintItem.swift in Sources */, - EE235FB21C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */, + EE235FB21C5785D400C08960 /* ConstraintMakerPrioritizable.swift in Sources */, EE235F8B1C5785C600C08960 /* LayoutConstraint.swift in Sources */, + 7E1CB2B0227BBDF70066B6C0 /* ConstraintDirectionalInsets.swift in Sources */, EE235FA31C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */, EE235F9D1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */, EE235FC01C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */, EE235F5F1C5785BC00C08960 /* Debugging.swift in Sources */, EE235FC31C5785DC00C08960 /* ConstraintLayoutSupportDSL.swift in Sources */, + 3CA7D6C224592D4D005E10C2 /* ConstraintMakerRelatable+Extensions.swift in Sources */, EE235F7F1C5785C600C08960 /* ConstraintRelation.swift in Sources */, EEF68FB41D784FBA00980C26 /* UILayoutSupport+Extensions.swift in Sources */, EE235F701C5785C600C08960 /* ConstraintDescription.swift in Sources */, @@ -412,6 +420,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -420,14 +429,17 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -469,6 +481,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -477,14 +490,17 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -523,15 +539,17 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK; PRODUCT_NAME = SnapKit; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -546,14 +564,16 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK; PRODUCT_NAME = SnapKit; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -563,11 +583,13 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Tests/SnapKitTests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @loader_path/../Frameworks @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -576,12 +598,14 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Tests/SnapKitTests/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @loader_path/../Frameworks @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme b/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme index 48ec452..aa1d3af 100644 --- a/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme +++ b/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + diff --git a/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SnapKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SnapKitPlayground.playground/Contents.swift b/SnapKitPlayground.playground/Contents.swift new file mode 100644 index 0000000..d84900a --- /dev/null +++ b/SnapKitPlayground.playground/Contents.swift @@ -0,0 +1,29 @@ +//: A UIKit based Playground for presenting user interface +// To use this playground, build SnapKit.framework for any simulator first. + +import SnapKit +import UIKit +import PlaygroundSupport + +class MyViewController : UIViewController { + override func loadView() { + let view = UIView() + view.backgroundColor = .white + + let label = UILabel() + label.text = "Hello World!" + label.textColor = .black + + view.addSubview(label) + + label.snp.makeConstraints { (make) in + make.left.equalToSuperview().offset(150) + make.top.equalToSuperview().offset(200) + make.size.equalTo(CGSize(width: 200, height: 20)) + } + + self.view = view + } +} +// Present the view controller in the Live View window +PlaygroundPage.current.liveView = MyViewController() diff --git a/SnapKitPlayground.playground/contents.xcplayground b/SnapKitPlayground.playground/contents.xcplayground new file mode 100644 index 0000000..3b15108 --- /dev/null +++ b/SnapKitPlayground.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SnapKitPlayground.playground/playground.xcworkspace/contents.xcworkspacedata b/SnapKitPlayground.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..94b2795 --- /dev/null +++ b/SnapKitPlayground.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,4 @@ + + + diff --git a/SnapKitPlayground.playground/timeline.xctimeline b/SnapKitPlayground.playground/timeline.xctimeline new file mode 100644 index 0000000..bf468af --- /dev/null +++ b/SnapKitPlayground.playground/timeline.xctimeline @@ -0,0 +1,6 @@ + + + + + diff --git a/Source/ConstraintView+Extensions.swift b/Source/ConstraintView+Extensions.swift deleted file mode 100644 index 77afad9..0000000 --- a/Source/ConstraintView+Extensions.swift +++ /dev/null @@ -1,152 +0,0 @@ -// -// SnapKit -// -// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit -// -// 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: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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. - -#if os(iOS) || os(tvOS) - import UIKit -#else - import AppKit -#endif - - -public extension ConstraintView { - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_left: ConstraintItem { return self.snp.left } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_top: ConstraintItem { return self.snp.top } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_right: ConstraintItem { return self.snp.right } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_bottom: ConstraintItem { return self.snp.bottom } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_leading: ConstraintItem { return self.snp.leading } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_trailing: ConstraintItem { return self.snp.trailing } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_width: ConstraintItem { return self.snp.width } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_height: ConstraintItem { return self.snp.height } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_centerX: ConstraintItem { return self.snp.centerX } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_centerY: ConstraintItem { return self.snp.centerY } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_baseline: ConstraintItem { return self.snp.baseline } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, OSX 10.11, *) - public var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, OSX 10.11, *) - public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_topMargin: ConstraintItem { return self.snp.topMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_edges: ConstraintItem { return self.snp.edges } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_size: ConstraintItem { return self.snp.size } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public var snp_center: ConstraintItem { return self.snp.center } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_margins: ConstraintItem { return self.snp.margins } - - @available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.") - @available(iOS 8.0, *) - public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { - return self.snp.prepareConstraints(closure) - } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { - self.snp.makeConstraints(closure) - } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { - self.snp.remakeConstraints(closure) - } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { - self.snp.updateConstraints(closure) - } - - @available(*, deprecated:3.0, message:"Use newer snp.* syntax.") - public func snp_removeConstraints() { - self.snp.removeConstraints() - } - - public var snp: ConstraintViewDSL { - return ConstraintViewDSL(view: self) - } - -} diff --git a/Source/Constraint.swift b/Sources/Constraint.swift similarity index 79% rename from Source/Constraint.swift rename to Sources/Constraint.swift index 2720745..37409b3 100644 --- a/Source/Constraint.swift +++ b/Sources/Constraint.swift @@ -49,12 +49,23 @@ public final class Constraint { public var layoutConstraints: [LayoutConstraint] public var isActive: Bool { - for layoutConstraint in self.layoutConstraints { - if layoutConstraint.isActive { - return true + set { + if newValue { + activate() + } + else { + deactivate() } } - return false + + get { + for layoutConstraint in self.layoutConstraints { + if layoutConstraint.isActive { + return true + } + } + return false + } } // MARK: Initialization @@ -118,6 +129,32 @@ public final class Constraint { default: fatalError() } + } else if self.from.attributes == .directionalEdges && self.to.attributes == .directionalMargins { + switch layoutFromAttribute { + case .leading: + layoutToAttribute = .leadingMargin + case .trailing: + layoutToAttribute = .trailingMargin + case .top: + layoutToAttribute = .topMargin + case .bottom: + layoutToAttribute = .bottomMargin + default: + fatalError() + } + } else if self.from.attributes == .directionalMargins && self.to.attributes == .directionalEdges { + switch layoutFromAttribute { + case .leadingMargin: + layoutToAttribute = .leading + case .trailingMargin: + layoutToAttribute = .trailing + case .topMargin: + layoutToAttribute = .top + case .bottomMargin: + layoutToAttribute = .bottom + default: + fatalError() + } } else if self.from.attributes == self.to.attributes { layoutToAttribute = layoutFromAttribute } else { @@ -178,12 +215,12 @@ public final class Constraint { // MARK: Public - @available(*, deprecated:3.0, message:"Use activate().") + @available(*, deprecated, renamed:"activate()") public func install() { self.activate() } - @available(*, deprecated:3.0, message:"Use deactivate().") + @available(*, deprecated, renamed:"deactivate()") public func uninstall() { self.deactivate() } @@ -208,31 +245,46 @@ public final class Constraint { return self } + #if os(iOS) || os(tvOS) + @discardableResult + @available(iOS 11.0, tvOS 11.0, *) + public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint { + self.constant = inset.constraintDirectionalInsetTargetValue + return self + } + #endif + @discardableResult public func update(priority: ConstraintPriorityTarget) -> Constraint { self.priority = priority.constraintPriorityTargetValue return self } - @available(*, deprecated:3.0, message:"Use update(offset: ConstraintOffsetTarget) instead.") + @discardableResult + public func update(priority: ConstraintPriority) -> Constraint { + self.priority = priority.value + return self + } + + @available(*, deprecated, renamed:"update(offset:)") public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) } - @available(*, deprecated:3.0, message:"Use update(inset: ConstraintInsetTarget) instead.") + @available(*, deprecated, renamed:"update(inset:)") public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) } - @available(*, deprecated:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.") + @available(*, deprecated, renamed:"update(priority:)") public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) } - @available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.") + @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.") public func updatePriorityRequired() -> Void {} - @available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.") + @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.") public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") } - @available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.") + @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.") public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") } - @available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.") + @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.") public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") } // MARK: Internal diff --git a/Source/ConstraintAttributes.swift b/Sources/ConstraintAttributes.swift similarity index 61% rename from Source/ConstraintAttributes.swift rename to Sources/ConstraintAttributes.swift index 10bddb1..408308b 100644 --- a/Source/ConstraintAttributes.swift +++ b/Sources/ConstraintAttributes.swift @@ -28,7 +28,9 @@ #endif -internal struct ConstraintAttributes : OptionSet { +internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral { + + typealias IntegerLiteralType = UInt internal init(rawValue: UInt) { self.rawValue = rawValue @@ -39,10 +41,13 @@ internal struct ConstraintAttributes : OptionSet { internal init(nilLiteral: ()) { self.rawValue = 0 } + internal init(integerLiteral rawValue: IntegerLiteralType) { + self.init(rawValue: rawValue) + } internal private(set) var rawValue: UInt - internal static var allZeros: ConstraintAttributes { return self.init(0) } - internal static func convertFromNilLiteral() -> ConstraintAttributes { return self.init(0) } + internal static var allZeros: ConstraintAttributes { return 0 } + internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 } internal var boolValue: Bool { return self.rawValue != 0 } internal func toRaw() -> UInt { return self.rawValue } @@ -51,57 +56,65 @@ internal struct ConstraintAttributes : OptionSet { // normal - internal static var none: ConstraintAttributes { return self.init(0) } - internal static var left: ConstraintAttributes { return self.init(1) } - internal static var top: ConstraintAttributes { return self.init(2) } - internal static var right: ConstraintAttributes { return self.init(4) } - internal static var bottom: ConstraintAttributes { return self.init(8) } - internal static var leading: ConstraintAttributes { return self.init(16) } - internal static var trailing: ConstraintAttributes { return self.init(32) } - internal static var width: ConstraintAttributes { return self.init(64) } - internal static var height: ConstraintAttributes { return self.init(128) } - internal static var centerX: ConstraintAttributes { return self.init(256) } - internal static var centerY: ConstraintAttributes { return self.init(512) } - internal static var lastBaseline: ConstraintAttributes { return self.init(1024) } + internal static let none: ConstraintAttributes = 0 + internal static let left: ConstraintAttributes = ConstraintAttributes(UInt(1) << 0) + internal static let top: ConstraintAttributes = ConstraintAttributes(UInt(1) << 1) + internal static let right: ConstraintAttributes = ConstraintAttributes(UInt(1) << 2) + internal static let bottom: ConstraintAttributes = ConstraintAttributes(UInt(1) << 3) + internal static let leading: ConstraintAttributes = ConstraintAttributes(UInt(1) << 4) + internal static let trailing: ConstraintAttributes = ConstraintAttributes(UInt(1) << 5) + internal static let width: ConstraintAttributes = ConstraintAttributes(UInt(1) << 6) + internal static let height: ConstraintAttributes = ConstraintAttributes(UInt(1) << 7) + internal static let centerX: ConstraintAttributes = ConstraintAttributes(UInt(1) << 8) + internal static let centerY: ConstraintAttributes = ConstraintAttributes(UInt(1) << 9) + internal static let lastBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 10) @available(iOS 8.0, OSX 10.11, *) - internal static var firstBaseline: ConstraintAttributes { return self.init(2048) } - + internal static let firstBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 11) + @available(iOS 8.0, *) - internal static var leftMargin: ConstraintAttributes { return self.init(4096) } - + internal static let leftMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 12) + @available(iOS 8.0, *) - internal static var rightMargin: ConstraintAttributes { return self.init(8192) } - + internal static let rightMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 13) + @available(iOS 8.0, *) - internal static var topMargin: ConstraintAttributes { return self.init(16384) } - + internal static let topMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 14) + @available(iOS 8.0, *) - internal static var bottomMargin: ConstraintAttributes { return self.init(32768) } - + internal static let bottomMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 15) + @available(iOS 8.0, *) - internal static var leadingMargin: ConstraintAttributes { return self.init(65536) } - + internal static let leadingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 16) + @available(iOS 8.0, *) - internal static var trailingMargin: ConstraintAttributes { return self.init(131072) } - + internal static let trailingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 17) + @available(iOS 8.0, *) - internal static var centerXWithinMargins: ConstraintAttributes { return self.init(262144) } - + internal static let centerXWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 18) + @available(iOS 8.0, *) - internal static var centerYWithinMargins: ConstraintAttributes { return self.init(524288) } + internal static let centerYWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 19) // aggregates - internal static var edges: ConstraintAttributes { return self.init(15) } - internal static var size: ConstraintAttributes { return self.init(192) } - internal static var center: ConstraintAttributes { return self.init(768) } - + internal static let edges: ConstraintAttributes = [.horizontalEdges, .verticalEdges] + internal static let horizontalEdges: ConstraintAttributes = [.left, .right] + internal static let verticalEdges: ConstraintAttributes = [.top, .bottom] + internal static let directionalEdges: ConstraintAttributes = [.directionalHorizontalEdges, .directionalVerticalEdges] + internal static let directionalHorizontalEdges: ConstraintAttributes = [.leading, .trailing] + internal static let directionalVerticalEdges: ConstraintAttributes = [.top, .bottom] + internal static let size: ConstraintAttributes = [.width, .height] + internal static let center: ConstraintAttributes = [.centerX, .centerY] + @available(iOS 8.0, *) - internal static var margins: ConstraintAttributes { return self.init(61440) } - + internal static let margins: ConstraintAttributes = [.leftMargin, .topMargin, .rightMargin, .bottomMargin] + @available(iOS 8.0, *) - internal static var centerWithinMargins: ConstraintAttributes { return self.init(786432) } + internal static let directionalMargins: ConstraintAttributes = [.leadingMargin, .topMargin, .trailingMargin, .bottomMargin] + + @available(iOS 8.0, *) + internal static let centerWithinMargins: ConstraintAttributes = [.centerXWithinMargins, .centerYWithinMargins] internal var layoutAttributes:[LayoutAttribute] { var attrs = [LayoutAttribute]() diff --git a/Source/ConstraintConfig.swift b/Sources/ConstraintConfig.swift similarity index 100% rename from Source/ConstraintConfig.swift rename to Sources/ConstraintConfig.swift diff --git a/Source/ConstraintConstantTarget.swift b/Sources/ConstraintConstantTarget.swift similarity index 63% rename from Source/ConstraintConstantTarget.swift rename to Sources/ConstraintConstantTarget.swift index bc6d596..7f54907 100644 --- a/Source/ConstraintConstantTarget.swift +++ b/Sources/ConstraintConstantTarget.swift @@ -40,6 +40,12 @@ extension CGSize: ConstraintConstantTarget { extension ConstraintInsets: ConstraintConstantTarget { } +#if os(iOS) || os(tvOS) +@available(iOS 11.0, tvOS 11.0, *) +extension ConstraintDirectionalInsets: ConstraintConstantTarget { +} +#endif + extension ConstraintConstantTarget { internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat { @@ -82,7 +88,11 @@ extension ConstraintConstantTarget { return value.y case .width, .height, .notAnAttribute: return 0.0 - } + #if swift(>=5.0) + @unknown default: + return 0.0 + #endif + } #else switch layoutAttribute { case .left, .right, .leading, .trailing, .centerX: @@ -91,56 +101,112 @@ extension ConstraintConstantTarget { return value.y case .width, .height, .notAnAttribute: return 0.0 - } + #if swift(>=5.0) + @unknown default: + return 0.0 + #endif + } #endif } if let value = self as? ConstraintInsets { #if os(iOS) || os(tvOS) switch layoutAttribute { - case .left, .leftMargin, .centerX, .centerXWithinMargins: + case .left, .leftMargin: return value.left - case .top, .topMargin, .centerY, .centerYWithinMargins, .lastBaseline, .firstBaseline: + case .top, .topMargin, .firstBaseline: return value.top case .right, .rightMargin: return -value.right - case .bottom, .bottomMargin: + case .bottom, .bottomMargin, .lastBaseline: return -value.bottom case .leading, .leadingMargin: return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right case .trailing, .trailingMargin: return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left + case .centerX, .centerXWithinMargins: + return (value.left - value.right) / 2 + case .centerY, .centerYWithinMargins: + return (value.top - value.bottom) / 2 case .width: return -(value.left + value.right) case .height: return -(value.top + value.bottom) case .notAnAttribute: return 0.0 - } + #if swift(>=5.0) + @unknown default: + return 0.0 + #endif + } #else switch layoutAttribute { - case .left, .centerX: + case .left: return value.left - case .top, .centerY, .lastBaseline, .firstBaseline: + case .top, .firstBaseline: return value.top case .right: return -value.right - case .bottom: + case .bottom, .lastBaseline: return -value.bottom case .leading: return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right case .trailing: return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left + case .centerX: + return (value.left - value.right) / 2 + case .centerY: + return (value.top - value.bottom) / 2 case .width: return -(value.left + value.right) case .height: return -(value.top + value.bottom) case .notAnAttribute: return 0.0 - } + #if swift(>=5.0) + @unknown default: + return 0.0 + #endif + } #endif } + #if os(iOS) || os(tvOS) + if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets { + switch layoutAttribute { + case .left, .leftMargin: + return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.leading : value.trailing + case .top, .topMargin, .firstBaseline: + return value.top + case .right, .rightMargin: + return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.trailing : -value.leading + case .bottom, .bottomMargin, .lastBaseline: + return -value.bottom + case .leading, .leadingMargin: + return value.leading + case .trailing, .trailingMargin: + return -value.trailing + case .centerX, .centerXWithinMargins: + return (value.leading - value.trailing) / 2 + case .centerY, .centerYWithinMargins: + return (value.top - value.bottom) / 2 + case .width: + return -(value.leading + value.trailing) + case .height: + return -(value.top + value.bottom) + case .notAnAttribute: + return 0.0 + #if swift(>=5.0) + @unknown default: + return 0.0 + #else + default: + return 0.0 + #endif + } + } + #endif + return 0.0 } diff --git a/Source/ConstraintDSL.swift b/Sources/ConstraintDSL.swift similarity index 85% rename from Source/ConstraintDSL.swift rename to Sources/ConstraintDSL.swift index a7e1798..20f153d 100644 --- a/Source/ConstraintDSL.swift +++ b/Sources/ConstraintDSL.swift @@ -99,6 +99,26 @@ extension ConstraintBasicAttributesDSL { return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges) } + public var directionalEdges: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalEdges) + } + + public var horizontalEdges: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.horizontalEdges) + } + + public var verticalEdges: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.verticalEdges) + } + + public var directionalHorizontalEdges: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalHorizontalEdges) + } + + public var directionalVerticalEdges: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalVerticalEdges) + } + public var size: ConstraintItem { return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size) } @@ -114,8 +134,7 @@ public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL { extension ConstraintAttributesDSL { // MARK: Baselines - - @available(*, deprecated:3.0, message:"Use .lastBaseline instead") + @available(*, deprecated, renamed:"lastBaseline") public var baseline: ConstraintItem { return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline) } @@ -177,6 +196,11 @@ extension ConstraintAttributesDSL { return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins) } + @available(iOS 8.0, *) + public var directionalMargins: ConstraintItem { + return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalMargins) + } + @available(iOS 8.0, *) public var centerWithinMargins: ConstraintItem { return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins) diff --git a/Source/ConstraintDescription.swift b/Sources/ConstraintDescription.swift similarity index 100% rename from Source/ConstraintDescription.swift rename to Sources/ConstraintDescription.swift diff --git a/Sources/ConstraintDirectionalInsetTarget.swift b/Sources/ConstraintDirectionalInsetTarget.swift new file mode 100644 index 0000000..955aec3 --- /dev/null +++ b/Sources/ConstraintDirectionalInsetTarget.swift @@ -0,0 +1,49 @@ +// +// SnapKit +// +// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit +// +// 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: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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. + +#if os(iOS) || os(tvOS) +import UIKit +#else +import AppKit +#endif + +#if os(iOS) || os(tvOS) +public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget { +} + +@available(iOS 11.0, tvOS 11.0, *) +extension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget { +} + +extension ConstraintDirectionalInsetTarget { + + @available(iOS 11.0, tvOS 11.0, *) + internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets { + if let amount = self as? ConstraintDirectionalInsets { + return amount + } else { + return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0) + } + } +} +#endif diff --git a/Source/SnapKit.h b/Sources/ConstraintDirectionalInsets.swift similarity index 84% rename from Source/SnapKit.h rename to Sources/ConstraintDirectionalInsets.swift index 12075c8..ada8ed5 100644 --- a/Source/SnapKit.h +++ b/Sources/ConstraintDirectionalInsets.swift @@ -21,7 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#import +#if os(iOS) || os(tvOS) + import UIKit +#else + import AppKit +#endif -FOUNDATION_EXPORT double SnapKitVersionNumber; -FOUNDATION_EXPORT const unsigned char SnapKitVersionString[]; \ No newline at end of file + +#if os(iOS) || os(tvOS) + @available(iOS 11.0, tvOS 11.0, *) + public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets +#endif diff --git a/Source/ConstraintInsetTarget.swift b/Sources/ConstraintInsetTarget.swift similarity index 100% rename from Source/ConstraintInsetTarget.swift rename to Sources/ConstraintInsetTarget.swift diff --git a/Source/ConstraintInsets.swift b/Sources/ConstraintInsets.swift similarity index 100% rename from Source/ConstraintInsets.swift rename to Sources/ConstraintInsets.swift diff --git a/Source/ConstraintItem.swift b/Sources/ConstraintItem.swift similarity index 100% rename from Source/ConstraintItem.swift rename to Sources/ConstraintItem.swift diff --git a/Source/ConstraintLayoutGuide+Extensions.swift b/Sources/ConstraintLayoutGuide+Extensions.swift similarity index 96% rename from Source/ConstraintLayoutGuide+Extensions.swift rename to Sources/ConstraintLayoutGuide+Extensions.swift index c2d9e9d..d429e0c 100644 --- a/Source/ConstraintLayoutGuide+Extensions.swift +++ b/Sources/ConstraintLayoutGuide+Extensions.swift @@ -29,7 +29,7 @@ @available(iOS 9.0, OSX 10.11, *) public extension ConstraintLayoutGuide { - public var snp: ConstraintLayoutGuideDSL { + var snp: ConstraintLayoutGuideDSL { return ConstraintLayoutGuideDSL(guide: self) } diff --git a/Source/ConstraintLayoutGuide.swift b/Sources/ConstraintLayoutGuide.swift similarity index 100% rename from Source/ConstraintLayoutGuide.swift rename to Sources/ConstraintLayoutGuide.swift diff --git a/Source/ConstraintLayoutGuideDSL.swift b/Sources/ConstraintLayoutGuideDSL.swift similarity index 100% rename from Source/ConstraintLayoutGuideDSL.swift rename to Sources/ConstraintLayoutGuideDSL.swift diff --git a/Source/ConstraintLayoutSupport.swift b/Sources/ConstraintLayoutSupport.swift similarity index 100% rename from Source/ConstraintLayoutSupport.swift rename to Sources/ConstraintLayoutSupport.swift diff --git a/Source/ConstraintLayoutSupportDSL.swift b/Sources/ConstraintLayoutSupportDSL.swift similarity index 100% rename from Source/ConstraintLayoutSupportDSL.swift rename to Sources/ConstraintLayoutSupportDSL.swift diff --git a/Source/ConstraintMaker.swift b/Sources/ConstraintMaker.swift similarity index 86% rename from Source/ConstraintMaker.swift rename to Sources/ConstraintMaker.swift index b20cdb5..50d7402 100644 --- a/Source/ConstraintMaker.swift +++ b/Sources/ConstraintMaker.swift @@ -69,7 +69,7 @@ public class ConstraintMaker { return self.makeExtendableWithAttributes(.centerY) } - @available(*, deprecated:3.0, message:"Use lastBaseline instead") + @available(*, deprecated, renamed:"lastBaseline") public var baseline: ConstraintMakerExtendable { return self.makeExtendableWithAttributes(.lastBaseline) } @@ -126,6 +126,21 @@ public class ConstraintMaker { public var edges: ConstraintMakerExtendable { return self.makeExtendableWithAttributes(.edges) } + public var horizontalEdges: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.horizontalEdges) + } + public var verticalEdges: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.verticalEdges) + } + public var directionalEdges: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.directionalEdges) + } + public var directionalHorizontalEdges: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.directionalHorizontalEdges) + } + public var directionalVerticalEdges: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.directionalVerticalEdges) + } public var size: ConstraintMakerExtendable { return self.makeExtendableWithAttributes(.size) } @@ -138,12 +153,17 @@ public class ConstraintMaker { return self.makeExtendableWithAttributes(.margins) } + @available(iOS 8.0, *) + public var directionalMargins: ConstraintMakerExtendable { + return self.makeExtendableWithAttributes(.directionalMargins) + } + @available(iOS 8.0, *) public var centerWithinMargins: ConstraintMakerExtendable { return self.makeExtendableWithAttributes(.centerWithinMargins) } - private let item: LayoutConstraintItem + public let item: LayoutConstraintItem private var descriptions = [ConstraintDescription]() internal init(item: LayoutConstraintItem) { @@ -171,15 +191,7 @@ public class ConstraintMaker { } internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) { - let maker = ConstraintMaker(item: item) - closure(maker) - var constraints: [Constraint] = [] - for description in maker.descriptions { - guard let constraint = description.constraint else { - continue - } - constraints.append(constraint) - } + let constraints = prepareConstraints(item: item, closure: closure) for constraint in constraints { constraint.activateIfNeeded(updatingExisting: false) } @@ -196,15 +208,7 @@ public class ConstraintMaker { return } - let maker = ConstraintMaker(item: item) - closure(maker) - var constraints: [Constraint] = [] - for description in maker.descriptions { - guard let constraint = description.constraint else { - continue - } - constraints.append(constraint) - } + let constraints = prepareConstraints(item: item, closure: closure) for constraint in constraints { constraint.activateIfNeeded(updatingExisting: true) } diff --git a/Source/ConstraintMakerEditable.swift b/Sources/ConstraintMakerEditable.swift similarity index 84% rename from Source/ConstraintMakerEditable.swift rename to Sources/ConstraintMakerEditable.swift index fb88c41..4869bc2 100644 --- a/Source/ConstraintMakerEditable.swift +++ b/Sources/ConstraintMakerEditable.swift @@ -28,7 +28,7 @@ #endif -public class ConstraintMakerEditable: ConstraintMakerPriortizable { +public class ConstraintMakerEditable: ConstraintMakerPrioritizable { @discardableResult public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { @@ -53,4 +53,12 @@ public class ConstraintMakerEditable: ConstraintMakerPriortizable { return self } + #if os(iOS) || os(tvOS) + @discardableResult + @available(iOS 11.0, tvOS 11.0, *) + public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable { + self.description.constant = amount.constraintDirectionalInsetTargetValue + return self + } + #endif } diff --git a/Source/ConstraintMakerExtendable.swift b/Sources/ConstraintMakerExtendable.swift similarity index 83% rename from Source/ConstraintMakerExtendable.swift rename to Sources/ConstraintMakerExtendable.swift index 6a755b5..d834649 100644 --- a/Source/ConstraintMakerExtendable.swift +++ b/Sources/ConstraintMakerExtendable.swift @@ -80,7 +80,7 @@ public class ConstraintMakerExtendable: ConstraintMakerRelatable { return self } - @available(*, deprecated:3.0, message:"Use lastBaseline instead") + @available(*, deprecated, renamed:"lastBaseline") public var baseline: ConstraintMakerExtendable { self.description.attributes += .lastBaseline return self @@ -149,6 +149,26 @@ public class ConstraintMakerExtendable: ConstraintMakerRelatable { self.description.attributes += .edges return self } + public var horizontalEdges: ConstraintMakerExtendable { + self.description.attributes += .horizontalEdges + return self + } + public var verticalEdges: ConstraintMakerExtendable { + self.description.attributes += .verticalEdges + return self + } + public var directionalEdges: ConstraintMakerExtendable { + self.description.attributes += .directionalEdges + return self + } + public var directionalHorizontalEdges: ConstraintMakerExtendable { + self.description.attributes += .directionalHorizontalEdges + return self + } + public var directionalVerticalEdges: ConstraintMakerExtendable { + self.description.attributes += .directionalVerticalEdges + return self + } public var size: ConstraintMakerExtendable { self.description.attributes += .size return self @@ -160,6 +180,12 @@ public class ConstraintMakerExtendable: ConstraintMakerRelatable { return self } + @available(iOS 8.0, *) + public var directionalMargins: ConstraintMakerExtendable { + self.description.attributes += .directionalMargins + return self + } + @available(iOS 8.0, *) public var centerWithinMargins: ConstraintMakerExtendable { self.description.attributes += .centerWithinMargins diff --git a/Source/ConstraintMakerFinalizable.swift b/Sources/ConstraintMakerFinalizable.swift similarity index 100% rename from Source/ConstraintMakerFinalizable.swift rename to Sources/ConstraintMakerFinalizable.swift diff --git a/Source/ConstraintMakerPriortizable.swift b/Sources/ConstraintMakerPrioritizable.swift similarity index 81% rename from Source/ConstraintMakerPriortizable.swift rename to Sources/ConstraintMakerPrioritizable.swift index ef79448..5af5303 100644 --- a/Source/ConstraintMakerPriortizable.swift +++ b/Sources/ConstraintMakerPrioritizable.swift @@ -27,8 +27,10 @@ import AppKit #endif +@available(*, deprecated, message:"Use ConstraintMakerPrioritizable instead.") +public typealias ConstraintMakerPriortizable = ConstraintMakerPrioritizable -public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { +public class ConstraintMakerPrioritizable: ConstraintMakerFinalizable { @discardableResult public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable { @@ -42,25 +44,25 @@ public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { return self } - @available(*, deprecated:3.0, message:"Use priority(.required) instead.") + @available(*, deprecated, message:"Use priority(.required) instead.") @discardableResult public func priorityRequired() -> ConstraintMakerFinalizable { return self.priority(.required) } - @available(*, deprecated:3.0, message:"Use priority(.high) instead.") + @available(*, deprecated, message:"Use priority(.high) instead.") @discardableResult public func priorityHigh() -> ConstraintMakerFinalizable { return self.priority(.high) } - @available(*, deprecated:3.0, message:"Use priority(.medium) instead.") + @available(*, deprecated, message:"Use priority(.medium) instead.") @discardableResult public func priorityMedium() -> ConstraintMakerFinalizable { return self.priority(.medium) } - @available(*, deprecated:3.0, message:"Use priority(.low) instead.") + @available(*, deprecated, message:"Use priority(.low) instead.") @discardableResult public func priorityLow() -> ConstraintMakerFinalizable { return self.priority(.low) diff --git a/Sources/ConstraintMakerRelatable+Extensions.swift b/Sources/ConstraintMakerRelatable+Extensions.swift new file mode 100644 index 0000000..63100d7 --- /dev/null +++ b/Sources/ConstraintMakerRelatable+Extensions.swift @@ -0,0 +1,57 @@ +// +// SnapKit +// +// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit +// +// 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: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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. + +#if os(iOS) || os(tvOS) + import UIKit +#else + import AppKit +#endif + + +extension ConstraintMakerRelatable { + + @discardableResult + public func equalToSuperview(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { + guard let other = self.description.item.superview else { + fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.") + } + return self.relatedTo(closure(other), relation: .equal, file: file, line: line) + } + + @discardableResult + public func lessThanOrEqualToSuperview(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { + guard let other = self.description.item.superview else { + fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.") + } + return self.relatedTo(closure(other), relation: .lessThanOrEqual, file: file, line: line) + } + + @discardableResult + public func greaterThanOrEqualTo(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { + guard let other = self.description.item.superview else { + fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.") + } + return self.relatedTo(closure(other), relation: .greaterThanOrEqual, file: file, line: line) + } + +} diff --git a/Source/ConstraintMakerRelatable.swift b/Sources/ConstraintMakerRelatable.swift similarity index 95% rename from Source/ConstraintMakerRelatable.swift rename to Sources/ConstraintMakerRelatable.swift index 98c7158..7889532 100644 --- a/Source/ConstraintMakerRelatable.swift +++ b/Sources/ConstraintMakerRelatable.swift @@ -45,7 +45,9 @@ public class ConstraintMakerRelatable { other.attributes.layoutAttributes.count <= 1 || other.attributes.layoutAttributes == self.description.attributes.layoutAttributes || other.attributes == .edges && self.description.attributes == .margins || - other.attributes == .margins && self.description.attributes == .edges else { + other.attributes == .margins && self.description.attributes == .edges || + other.attributes == .directionalEdges && self.description.attributes == .directionalMargins || + other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else { fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))"); } diff --git a/Source/ConstraintMultiplierTarget.swift b/Sources/ConstraintMultiplierTarget.swift similarity index 100% rename from Source/ConstraintMultiplierTarget.swift rename to Sources/ConstraintMultiplierTarget.swift diff --git a/Source/ConstraintOffsetTarget.swift b/Sources/ConstraintOffsetTarget.swift similarity index 100% rename from Source/ConstraintOffsetTarget.swift rename to Sources/ConstraintOffsetTarget.swift diff --git a/Source/ConstraintPriority.swift b/Sources/ConstraintPriority.swift similarity index 100% rename from Source/ConstraintPriority.swift rename to Sources/ConstraintPriority.swift diff --git a/Source/ConstraintPriorityTarget.swift b/Sources/ConstraintPriorityTarget.swift similarity index 92% rename from Source/ConstraintPriorityTarget.swift rename to Sources/ConstraintPriorityTarget.swift index eb32f79..064f750 100644 --- a/Source/ConstraintPriorityTarget.swift +++ b/Sources/ConstraintPriorityTarget.swift @@ -73,3 +73,13 @@ extension CGFloat: ConstraintPriorityTarget { } } + +#if os(iOS) || os(tvOS) +extension UILayoutPriority: ConstraintPriorityTarget { + + public var constraintPriorityTargetValue: Float { + return self.rawValue + } + +} +#endif diff --git a/Source/ConstraintRelatableTarget.swift b/Sources/ConstraintRelatableTarget.swift similarity index 93% rename from Source/ConstraintRelatableTarget.swift rename to Sources/ConstraintRelatableTarget.swift index 6976367..d517a61 100644 --- a/Source/ConstraintRelatableTarget.swift +++ b/Sources/ConstraintRelatableTarget.swift @@ -55,6 +55,12 @@ extension CGPoint: ConstraintRelatableTarget { extension ConstraintInsets: ConstraintRelatableTarget { } +#if os(iOS) || os(tvOS) +@available(iOS 11.0, tvOS 11.0, *) +extension ConstraintDirectionalInsets: ConstraintRelatableTarget { +} +#endif + extension ConstraintItem: ConstraintRelatableTarget { } diff --git a/Source/ConstraintRelation.swift b/Sources/ConstraintRelation.swift similarity index 100% rename from Source/ConstraintRelation.swift rename to Sources/ConstraintRelation.swift diff --git a/Sources/ConstraintView+Extensions.swift b/Sources/ConstraintView+Extensions.swift new file mode 100644 index 0000000..e0f71c1 --- /dev/null +++ b/Sources/ConstraintView+Extensions.swift @@ -0,0 +1,152 @@ +// +// SnapKit +// +// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit +// +// 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: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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. + +#if os(iOS) || os(tvOS) + import UIKit +#else + import AppKit +#endif + + +public extension ConstraintView { + + @available(*, deprecated, renamed:"snp.left") + var snp_left: ConstraintItem { return self.snp.left } + + @available(*, deprecated, renamed:"snp.top") + var snp_top: ConstraintItem { return self.snp.top } + + @available(*, deprecated, renamed:"snp.right") + var snp_right: ConstraintItem { return self.snp.right } + + @available(*, deprecated, renamed:"snp.bottom") + var snp_bottom: ConstraintItem { return self.snp.bottom } + + @available(*, deprecated, renamed:"snp.leading") + var snp_leading: ConstraintItem { return self.snp.leading } + + @available(*, deprecated, renamed:"snp.trailing") + var snp_trailing: ConstraintItem { return self.snp.trailing } + + @available(*, deprecated, renamed:"snp.width") + var snp_width: ConstraintItem { return self.snp.width } + + @available(*, deprecated, renamed:"snp.height") + var snp_height: ConstraintItem { return self.snp.height } + + @available(*, deprecated, renamed:"snp.centerX") + var snp_centerX: ConstraintItem { return self.snp.centerX } + + @available(*, deprecated, renamed:"snp.centerY") + var snp_centerY: ConstraintItem { return self.snp.centerY } + + @available(*, deprecated, renamed:"snp.baseline") + var snp_baseline: ConstraintItem { return self.snp.baseline } + + @available(*, deprecated, renamed:"snp.lastBaseline") + @available(iOS 8.0, OSX 10.11, *) + var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline } + + @available(iOS, deprecated, renamed:"snp.firstBaseline") + @available(iOS 8.0, OSX 10.11, *) + var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline } + + @available(iOS, deprecated, renamed:"snp.leftMargin") + @available(iOS 8.0, *) + var snp_leftMargin: ConstraintItem { return self.snp.leftMargin } + + @available(iOS, deprecated, renamed:"snp.topMargin") + @available(iOS 8.0, *) + var snp_topMargin: ConstraintItem { return self.snp.topMargin } + + @available(iOS, deprecated, renamed:"snp.rightMargin") + @available(iOS 8.0, *) + var snp_rightMargin: ConstraintItem { return self.snp.rightMargin } + + @available(iOS, deprecated, renamed:"snp.bottomMargin") + @available(iOS 8.0, *) + var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin } + + @available(iOS, deprecated, renamed:"snp.leadingMargin") + @available(iOS 8.0, *) + var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin } + + @available(iOS, deprecated, renamed:"snp.trailingMargin") + @available(iOS 8.0, *) + var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin } + + @available(iOS, deprecated, renamed:"snp.centerXWithinMargins") + @available(iOS 8.0, *) + var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins } + + @available(iOS, deprecated, renamed:"snp.centerYWithinMargins") + @available(iOS 8.0, *) + var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins } + + @available(*, deprecated, renamed:"snp.edges") + var snp_edges: ConstraintItem { return self.snp.edges } + + @available(*, deprecated, renamed:"snp.size") + var snp_size: ConstraintItem { return self.snp.size } + + @available(*, deprecated, renamed:"snp.center") + var snp_center: ConstraintItem { return self.snp.center } + + @available(iOS, deprecated, renamed:"snp.margins") + @available(iOS 8.0, *) + var snp_margins: ConstraintItem { return self.snp.margins } + + @available(iOS, deprecated, renamed:"snp.centerWithinMargins") + @available(iOS 8.0, *) + var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins } + + @available(*, deprecated, renamed:"snp.prepareConstraints(_:)") + func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] { + return self.snp.prepareConstraints(closure) + } + + @available(*, deprecated, renamed:"snp.makeConstraints(_:)") + func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { + self.snp.makeConstraints(closure) + } + + @available(*, deprecated, renamed:"snp.remakeConstraints(_:)") + func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { + self.snp.remakeConstraints(closure) + } + + @available(*, deprecated, renamed:"snp.updateConstraints(_:)") + func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) { + self.snp.updateConstraints(closure) + } + + @available(*, deprecated, renamed:"snp.removeConstraints()") + func snp_removeConstraints() { + self.snp.removeConstraints() + } + + var snp: ConstraintViewDSL { + return ConstraintViewDSL(view: self) + } + +} diff --git a/Source/ConstraintView.swift b/Sources/ConstraintView.swift similarity index 100% rename from Source/ConstraintView.swift rename to Sources/ConstraintView.swift diff --git a/Source/ConstraintViewDSL.swift b/Sources/ConstraintViewDSL.swift similarity index 97% rename from Source/ConstraintViewDSL.swift rename to Sources/ConstraintViewDSL.swift index 298bdb1..a0187f9 100644 --- a/Source/ConstraintViewDSL.swift +++ b/Sources/ConstraintViewDSL.swift @@ -55,7 +55,7 @@ public struct ConstraintViewDSL: ConstraintAttributesDSL { get { return self.view.contentHuggingPriority(for: .horizontal).rawValue } - set { + nonmutating set { self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal) } } @@ -64,7 +64,7 @@ public struct ConstraintViewDSL: ConstraintAttributesDSL { get { return self.view.contentHuggingPriority(for: .vertical).rawValue } - set { + nonmutating set { self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical) } } @@ -73,7 +73,7 @@ public struct ConstraintViewDSL: ConstraintAttributesDSL { get { return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue } - set { + nonmutating set { self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal) } } @@ -82,7 +82,7 @@ public struct ConstraintViewDSL: ConstraintAttributesDSL { get { return self.view.contentCompressionResistancePriority(for: .vertical).rawValue } - set { + nonmutating set { self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical) } } diff --git a/Source/Debugging.swift b/Sources/Debugging.swift similarity index 94% rename from Source/Debugging.swift rename to Sources/Debugging.swift index 55f5b87..a78579a 100644 --- a/Source/Debugging.swift +++ b/Sources/Debugging.swift @@ -29,7 +29,7 @@ public extension LayoutConstraint { - override public var description: String { + override var description: String { var description = "<" description += descriptionForObject(self) @@ -82,6 +82,9 @@ private func descriptionForRelation(_ relation: LayoutRelation) -> String { case .equal: return "==" case .greaterThanOrEqual: return ">=" case .lessThanOrEqual: return "<=" + #if swift(>=5.0) + @unknown default: return "unknown" + #endif } } @@ -109,7 +112,10 @@ private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String { case .trailingMargin: return "trailingMargin" case .centerXWithinMargins: return "centerXWithinMargins" case .centerYWithinMargins: return "centerYWithinMargins" - } + #if swift(>=5.0) + @unknown default: return "unknown" + #endif + } #else switch attribute { case .notAnAttribute: return "notAnAttribute" @@ -125,7 +131,10 @@ private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String { case .centerY: return "centerY" case .lastBaseline: return "lastBaseline" case .firstBaseline: return "firstBaseline" - } + #if swift(>=5.0) + @unknown default: return "unknown" + #endif + } #endif } diff --git a/Source/LayoutConstraint.swift b/Sources/LayoutConstraint.swift similarity index 79% rename from Source/LayoutConstraint.swift rename to Sources/LayoutConstraint.swift index 8bb5ed2..5425ea8 100644 --- a/Source/LayoutConstraint.swift +++ b/Sources/LayoutConstraint.swift @@ -44,13 +44,17 @@ public class LayoutConstraint : NSLayoutConstraint { } internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool { - guard lhs.firstItem === rhs.firstItem && - lhs.secondItem === rhs.secondItem && - lhs.firstAttribute == rhs.firstAttribute && + // If firstItem or secondItem on either constraint has a dangling pointer + // this comparison can cause a crash. The solution for this is to ensure + // your layout code hold strong references to things like Views, LayoutGuides + // and LayoutAnchors as SnapKit will not keep strong references to any of these. + guard lhs.firstAttribute == rhs.firstAttribute && lhs.secondAttribute == rhs.secondAttribute && lhs.relation == rhs.relation && lhs.priority == rhs.priority && - lhs.multiplier == rhs.multiplier else { + lhs.multiplier == rhs.multiplier && + lhs.secondItem === rhs.secondItem && + lhs.firstItem === rhs.firstItem else { return false } return true diff --git a/Source/LayoutConstraintItem.swift b/Sources/LayoutConstraintItem.swift similarity index 98% rename from Source/LayoutConstraintItem.swift rename to Sources/LayoutConstraintItem.swift index a59de6b..9b61d18 100644 --- a/Source/LayoutConstraintItem.swift +++ b/Sources/LayoutConstraintItem.swift @@ -28,7 +28,7 @@ #endif -public protocol LayoutConstraintItem: class { +public protocol LayoutConstraintItem: AnyObject { } @available(iOS 9.0, OSX 10.11, *) diff --git a/Source/Typealiases.swift b/Sources/Typealiases.swift similarity index 91% rename from Source/Typealiases.swift rename to Sources/Typealiases.swift index 8a44151..ded96cc 100644 --- a/Source/Typealiases.swift +++ b/Sources/Typealiases.swift @@ -25,8 +25,13 @@ import Foundation #if os(iOS) || os(tvOS) import UIKit +#if swift(>=4.2) + typealias LayoutRelation = NSLayoutConstraint.Relation + typealias LayoutAttribute = NSLayoutConstraint.Attribute +#else typealias LayoutRelation = NSLayoutRelation typealias LayoutAttribute = NSLayoutAttribute +#endif typealias LayoutPriority = UILayoutPriority #else import AppKit diff --git a/Source/UILayoutSupport+Extensions.swift b/Sources/UILayoutSupport+Extensions.swift similarity index 96% rename from Source/UILayoutSupport+Extensions.swift rename to Sources/UILayoutSupport+Extensions.swift index cfbce2e..8e7644c 100644 --- a/Source/UILayoutSupport+Extensions.swift +++ b/Sources/UILayoutSupport+Extensions.swift @@ -29,7 +29,7 @@ @available(iOS 8.0, *) public extension ConstraintLayoutSupport { - public var snp: ConstraintLayoutSupportDSL { + var snp: ConstraintLayoutSupportDSL { return ConstraintLayoutSupportDSL(support: self) } diff --git a/Source/Info.plist b/Supporting Files/Info.plist similarity index 100% rename from Source/Info.plist rename to Supporting Files/Info.plist diff --git a/Tests/Info.plist b/Tests/SnapKitTests/Info.plist similarity index 100% rename from Tests/Info.plist rename to Tests/SnapKitTests/Info.plist diff --git a/Tests/Tests.swift b/Tests/SnapKitTests/Tests.swift similarity index 65% rename from Tests/Tests.swift rename to Tests/SnapKitTests/Tests.swift index db414ff..eaaf231 100644 --- a/Tests/Tests.swift +++ b/Tests/SnapKitTests/Tests.swift @@ -59,6 +59,46 @@ class SnapKitTests: XCTestCase { XCTAssertEqual(self.container.snp_constraints.count, 6, "Should have 6 constraints installed") } + + func testHorizontalVerticalEdges() { + let v1 = View() + self.container.addSubview(v1) + + v1.snp.makeConstraints { (make) -> Void in + make.verticalEdges.equalToSuperview() + make.horizontalEdges.equalToSuperview() + return + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints installed") + + XCTAssertTrue(container.constraints.count == 4) + XCTAssertTrue(container.constraints.allSatisfy { $0.firstItem === v1 && $0.secondItem === v1.superview }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .left && $0.secondAttribute == .left }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .right && $0.secondAttribute == .right }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .top && $0.secondAttribute == .top }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .bottom && $0.secondAttribute == .bottom }) + } + + func testHorizontalVerticalDirectionalEdges() { + let v1 = View() + self.container.addSubview(v1) + + v1.snp.makeConstraints { (make) -> Void in + make.directionalVerticalEdges.equalToSuperview() + make.directionalHorizontalEdges.equalToSuperview() + return + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints installed") + + XCTAssertTrue(container.constraints.count == 4) + XCTAssertTrue(container.constraints.allSatisfy { $0.firstItem === v1 && $0.secondItem === v1.superview }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .leading && $0.secondAttribute == .leading }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .trailing && $0.secondAttribute == .trailing }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .top && $0.secondAttribute == .top }) + XCTAssertNotNil(container.constraints.first { $0.firstAttribute == .bottom && $0.secondAttribute == .bottom }) + } func testGuideMakeConstraints() { guard #available(iOS 9.0, OSX 10.11, *) else { return } @@ -264,6 +304,40 @@ class SnapKitTests: XCTestCase { } + func testSetIsActivatedConstraints() { + let v1 = View() + let v2 = View() + self.container.addSubview(v1) + self.container.addSubview(v2) + + var c1: Constraint? = nil + var c2: Constraint? = nil + + v1.snp.prepareConstraints { (make) -> Void in + c1 = make.top.equalTo(v2.snp.top).offset(50).constraint + c2 = make.left.equalTo(v2.snp.top).offset(50).constraint + return + } + + XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints") + + c1?.isActive = true + c2?.isActive = false + + XCTAssertEqual(self.container.snp_constraints.count, 1, "Should have 1 constraint") + + c1?.isActive = true + c2?.isActive = true + + XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints") + + c1?.isActive = false + c2?.isActive = false + + XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints") + + } + func testEdgeConstraints() { let view = View() self.container.addSubview(view) @@ -379,6 +453,90 @@ class SnapKitTests: XCTestCase { XCTAssertEqual(constraints[3].constant, -25, "Should be -25") } + #if os(iOS) || os(tvOS) + @available(iOS 11.0, tvOS 11.0, *) + func testConstraintDirectionalInsetsAsImpliedEqualToConstraints() { + let view = View() + self.container.addSubview(view) + + view.snp.makeConstraints { (make) -> Void in + make.top.leading.bottom.trailing.equalTo(self.container).inset(ConstraintDirectionalInsets(top: 25, leading: 25, bottom: 25, trailing: 25)) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + + let constraints = (self.container.snp_constraints as! [NSLayoutConstraint]).sorted { $0.firstAttribute.rawValue < $1.firstAttribute.rawValue } + + let verify: (NSLayoutConstraint, NSLayoutConstraint.Attribute, CGFloat) -> Void = { constraint, attribute, constant in + XCTAssertEqual(constraint.firstAttribute, attribute, "First attribute \(constraint.firstAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.secondAttribute, attribute, "Second attribute \(constraint.secondAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.constant, constant, "Attribute \(attribute.rawValue) should have constant \(constant)") + } + + verify(constraints[0], .top, 25) + verify(constraints[1], .bottom, -25) + verify(constraints[2], .leading, 25) + verify(constraints[3], .trailing, -25) + } + #endif + + #if os(iOS) || os(tvOS) + @available(iOS 11.0, tvOS 11.0, *) + func testConstraintDirectionalInsetsAsConstraintsConstant() { + let view = View() + self.container.addSubview(view) + + view.snp.makeConstraints { (make) -> Void in + make.top.leading.bottom.trailing.equalTo(self.container).inset(ConstraintDirectionalInsets(top: 25, leading: 25, bottom: 25, trailing: 25)) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + + let constraints = (self.container.snp_constraints as! [NSLayoutConstraint]).sorted { $0.firstAttribute.rawValue < $1.firstAttribute.rawValue } + + let verify: (NSLayoutConstraint, NSLayoutConstraint.Attribute, CGFloat) -> Void = { constraint, attribute, constant in + XCTAssertEqual(constraint.firstAttribute, attribute, "First attribute \(constraint.firstAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.secondAttribute, attribute, "Second attribute \(constraint.secondAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.constant, constant, "Attribute \(attribute.rawValue) should have constant \(constant)") + } + + verify(constraints[0], .top, 25) + verify(constraints[1], .bottom, -25) + verify(constraints[2], .leading, 25) + verify(constraints[3], .trailing, -25) + } + #endif + + #if os(iOS) || os(tvOS) + @available(iOS 11.0, tvOS 11.0, *) + func testConstraintDirectionalInsetsFallBackForNonDirectionalConstraints() { + let view = View() + self.container.addSubview(view) + + view.snp.makeConstraints { (make) -> Void in + make.edges.equalTo(self.container).inset(ConstraintDirectionalInsets(top: 25, leading: 25, bottom: 25, trailing: 25)) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + + let constraints = (self.container.snp_constraints as! [NSLayoutConstraint]).sorted { $0.firstAttribute.rawValue < $1.firstAttribute.rawValue } + + let verify: (NSLayoutConstraint, NSLayoutConstraint.Attribute, CGFloat) -> Void = { constraint, attribute, constant in + XCTAssertEqual(constraint.firstAttribute, attribute, "First attribute \(constraint.firstAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.secondAttribute, attribute, "Second attribute \(constraint.secondAttribute.rawValue) is not \(attribute.rawValue)") + XCTAssertEqual(constraint.constant, constant, "Attribute \(attribute.rawValue) should have constant \(constant)") + } + + verify(constraints[0], .left, 25) + verify(constraints[1], .right, -25) + verify(constraints[2], .top, 25) + verify(constraints[3], .bottom, -25) + } + #endif + func testSizeConstraints() { let view = View() self.container.addSubview(view) @@ -457,11 +615,33 @@ class SnapKitTests: XCTestCase { XCTAssert(fromAttributes == [.top, .left, .bottom, .right]) XCTAssert(toAttributes == [.top, .left, .bottom, .right]) } + + func testDirectionalEdgesToDirectionalEdges() { + var fromAttributes = Set() + var toAttributes = Set() + + let view = View() + self.container.addSubview(view) + + view.snp.remakeConstraints { (make) -> Void in + make.directionalEdges.equalTo(self.container.snp.directionalEdges) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + for constraint in (container.snp_constraints as! [NSLayoutConstraint]) { + fromAttributes.insert(constraint.firstAttribute) + toAttributes.insert(constraint.secondAttribute) + } + + XCTAssert(fromAttributes == [.top, .leading, .bottom, .trailing]) + XCTAssert(toAttributes == [.top, .leading, .bottom, .trailing]) + } #if os(iOS) || os(tvOS) func testEdgesToMargins() { - var fromAttributes = Set() - var toAttributes = Set() + var fromAttributes = Set() + var toAttributes = Set() let view = View() self.container.addSubview(view) @@ -498,6 +678,46 @@ class SnapKitTests: XCTestCase { XCTAssert(fromAttributes == [.topMargin, .leftMargin, .bottomMargin, .rightMargin]) } + + func testDirectionalEdgesToDirectionalMargins() { + var fromAttributes = Set() + var toAttributes = Set() + + let view = View() + self.container.addSubview(view) + + view.snp.remakeConstraints { (make) -> Void in + make.directionalEdges.equalTo(self.container.snp.directionalMargins) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + for constraint in (container.snp_constraints as! [NSLayoutConstraint]) { + fromAttributes.insert(constraint.firstAttribute) + toAttributes.insert(constraint.secondAttribute) + } + + XCTAssert(fromAttributes == [.top, .leading, .bottom, .trailing]) + XCTAssert(toAttributes == [.topMargin, .leadingMargin, .bottomMargin, .trailingMargin]) + + fromAttributes.removeAll() + toAttributes.removeAll() + + view.snp.remakeConstraints { (make) -> Void in + make.directionalMargins.equalTo(self.container.snp.directionalEdges) + } + + XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints") + + for constraint in (container.snp_constraints as! [NSLayoutConstraint]) { + fromAttributes.insert(constraint.firstAttribute) + toAttributes.insert(constraint.secondAttribute) + } + + XCTAssert(toAttributes == [.top, .leading, .bottom, .trailing]) + XCTAssert(fromAttributes == [.topMargin, .leadingMargin, .bottomMargin, .trailingMargin]) + + } func testLayoutGuideConstraints() { let vc = UIViewController() @@ -516,6 +736,8 @@ class SnapKitTests: XCTestCase { func testCanSetLabel() { self.container.snp.setLabel("Hello World") + + XCTAssertEqual(self.container.snp.label(), "Hello World") } func testPriorityShortcuts() { From 48b703a1a3d3721ba25b57e82235e7ddd63eda98 Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Wed, 13 Apr 2022 16:12:28 +1200 Subject: [PATCH 3/4] Fix podspec versions (#747) Co-authored-by: Robert Payne --- SnapKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SnapKit.podspec b/SnapKit.podspec index 1708568..4bcfc1a 100644 --- a/SnapKit.podspec +++ b/SnapKit.podspec @@ -14,5 +14,5 @@ Pod::Spec.new do |s| s.source_files = 'Sources/*.swift' - s.swift_version = '5.0' + s.swift_versions = ['5.0'] end From f222cbdf325885926566172f6f5f06af95473158 Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Wed, 13 Apr 2022 16:19:00 +1200 Subject: [PATCH 4/4] Fix podspec tagged version (#748) Co-authored-by: Robert Payne --- SnapKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SnapKit.podspec b/SnapKit.podspec index 4bcfc1a..800caa9 100644 --- a/SnapKit.podspec +++ b/SnapKit.podspec @@ -6,7 +6,7 @@ Pod::Spec.new do |s| s.homepage = 'https://github.com/SnapKit/SnapKit' s.authors = { 'Robert Payne' => 'robertpayne@me.com' } s.social_media_url = 'http://twitter.com/robertjpayne' - s.source = { :git => 'https://github.com/SnapKit/SnapKit.git', :tag => '5.0.1' } + s.source = { :git => 'https://github.com/SnapKit/SnapKit.git', :tag => '5.6.0' } s.ios.deployment_target = '10.0' s.osx.deployment_target = '10.11'