From 331d85d4cac54d3808dc7f218e08c2cd58be2dd6 Mon Sep 17 00:00:00 2001 From: Indragie Karunaratne Date: Fri, 8 Jan 2016 21:39:57 -0700 Subject: [PATCH] Support Swift Package Manager --- .gitignore | 46 +++++++++++++- {SwiftAutoLayout => Framework}/Info.plist | 0 .../SwiftAutoLayout.h | 0 Package.swift | 6 ++ README.md | 4 ++ .../SwiftAutoLayout.swift | 0 SwiftAutoLayout.xcodeproj/project.pbxproj | 60 ++++++++++--------- 7 files changed, 85 insertions(+), 31 deletions(-) rename {SwiftAutoLayout => Framework}/Info.plist (100%) rename {SwiftAutoLayout => Framework}/SwiftAutoLayout.h (100%) create mode 100644 Package.swift rename {SwiftAutoLayout => Sources}/SwiftAutoLayout.swift (100%) diff --git a/.gitignore b/.gitignore index 7295353..89d806e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ # Xcode # +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated build/ +DerivedData + +## Various settings *.pbxuser !default.pbxuser *.mode1v3 @@ -10,10 +16,44 @@ build/ *.perspectivev3 !default.perspectivev3 xcuserdata + +## Other *.xccheckout *.moved-aside -DerivedData +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific *.hmap *.ipa -*.xcuserstate -.DS_Store \ No newline at end of file + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/SwiftAutoLayout/Info.plist b/Framework/Info.plist similarity index 100% rename from SwiftAutoLayout/Info.plist rename to Framework/Info.plist diff --git a/SwiftAutoLayout/SwiftAutoLayout.h b/Framework/SwiftAutoLayout.h similarity index 100% rename from SwiftAutoLayout/SwiftAutoLayout.h rename to Framework/SwiftAutoLayout.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..328b45e --- /dev/null +++ b/Package.swift @@ -0,0 +1,6 @@ +// Copyright (c) 2016 Indragie Karunaratne. All rights reserved. +// Licensed under the MIT license, see LICENSE file for more info. + +import PackageDescription + +let package = Package(name: "SwiftAutoLayout") diff --git a/README.md b/README.md index 76e6feb..e88f682 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ You may notice that this looks a lot like the linear equation that a constraint SwiftAutoLayout allows you to more effectively communicate the intent of a constraint by making the syntax more similar to the equation that it represents. +### Installing + +Use [Swift Package Manager](https://github.com/apple/swift-package-manager) or add `SwiftAutoLayout.xcodeproj` as a subproject and link against either `SwiftAutoLayout-iOS.framework` or `SwiftAutoLayout-Mac.framework` depending on the platform. + ### Attributes Layout attributes are defined as properties added in extensions of `UIView` and `UILayoutGuide` on iOS and `NSView` and `NSLayoutGuide` on OS X. For example, `UIView.width` and `UIView.height` represent `NSLayoutAttribute.Width` and `NSLayoutAttribute.Height`, respectively. diff --git a/SwiftAutoLayout/SwiftAutoLayout.swift b/Sources/SwiftAutoLayout.swift similarity index 100% rename from SwiftAutoLayout/SwiftAutoLayout.swift rename to Sources/SwiftAutoLayout.swift diff --git a/SwiftAutoLayout.xcodeproj/project.pbxproj b/SwiftAutoLayout.xcodeproj/project.pbxproj index 6c15638..613dc44 100644 --- a/SwiftAutoLayout.xcodeproj/project.pbxproj +++ b/SwiftAutoLayout.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - 725A2B381A0468F300F44058 /* SwiftAutoLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 725A2B371A0468F300F44058 /* SwiftAutoLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; 725A2B3E1A0468F300F44058 /* SwiftAutoLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 725A2B321A0468F300F44058 /* SwiftAutoLayout.framework */; }; 725A2B451A0468F300F44058 /* SwiftAutoLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725A2B441A0468F300F44058 /* SwiftAutoLayoutTests.swift */; }; - 725A2B4F1A04695300F44058 /* SwiftAutoLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725A2B4E1A04695300F44058 /* SwiftAutoLayout.swift */; }; - 725A2B6E1A046A8000F44058 /* SwiftAutoLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725A2B4E1A04695300F44058 /* SwiftAutoLayout.swift */; }; - 725A2B6F1A046A8600F44058 /* SwiftAutoLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 725A2B371A0468F300F44058 /* SwiftAutoLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 725B5E6C1C40C5B100ABF520 /* SwiftAutoLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725B5E6B1C40C5B100ABF520 /* SwiftAutoLayout.swift */; }; + 725B5E6D1C40C5B100ABF520 /* SwiftAutoLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725B5E6B1C40C5B100ABF520 /* SwiftAutoLayout.swift */; }; + 725B5E731C40C5BB00ABF520 /* SwiftAutoLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 725B5E701C40C5BB00ABF520 /* SwiftAutoLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 725B5E741C40C5BB00ABF520 /* SwiftAutoLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 725B5E701C40C5BB00ABF520 /* SwiftAutoLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -27,13 +27,13 @@ /* Begin PBXFileReference section */ 725A2B321A0468F300F44058 /* SwiftAutoLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftAutoLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 725A2B361A0468F300F44058 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 725A2B371A0468F300F44058 /* SwiftAutoLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftAutoLayout.h; sourceTree = ""; }; 725A2B3D1A0468F300F44058 /* SwiftAutoLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftAutoLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 725A2B431A0468F300F44058 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 725A2B441A0468F300F44058 /* SwiftAutoLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftAutoLayoutTests.swift; sourceTree = ""; }; - 725A2B4E1A04695300F44058 /* SwiftAutoLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftAutoLayout.swift; sourceTree = ""; }; 725A2B551A046A3C00F44058 /* SwiftAutoLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftAutoLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 725B5E6B1C40C5B100ABF520 /* SwiftAutoLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftAutoLayout.swift; path = Sources/SwiftAutoLayout.swift; sourceTree = SOURCE_ROOT; }; + 725B5E6F1C40C5BB00ABF520 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Framework/Info.plist; sourceTree = ""; }; + 725B5E701C40C5BB00ABF520 /* SwiftAutoLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwiftAutoLayout.h; path = Framework/SwiftAutoLayout.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,7 +65,8 @@ 725A2B281A0468F300F44058 = { isa = PBXGroup; children = ( - 725A2B341A0468F300F44058 /* SwiftAutoLayout */, + 725B5E6E1C40C5B300ABF520 /* Framework */, + 725A2B341A0468F300F44058 /* Sources */, 725A2B411A0468F300F44058 /* SwiftAutoLayoutTests */, 725A2B331A0468F300F44058 /* Products */, ); @@ -81,24 +82,15 @@ name = Products; sourceTree = ""; }; - 725A2B341A0468F300F44058 /* SwiftAutoLayout */ = { + 725A2B341A0468F300F44058 /* Sources */ = { isa = PBXGroup; children = ( - 725A2B371A0468F300F44058 /* SwiftAutoLayout.h */, - 725A2B4E1A04695300F44058 /* SwiftAutoLayout.swift */, - 725A2B351A0468F300F44058 /* Supporting Files */, + 725B5E6B1C40C5B100ABF520 /* SwiftAutoLayout.swift */, ); + name = Sources; path = SwiftAutoLayout; sourceTree = ""; }; - 725A2B351A0468F300F44058 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 725A2B361A0468F300F44058 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; 725A2B411A0468F300F44058 /* SwiftAutoLayoutTests */ = { isa = PBXGroup; children = ( @@ -116,6 +108,15 @@ name = "Supporting Files"; sourceTree = ""; }; + 725B5E6E1C40C5B300ABF520 /* Framework */ = { + isa = PBXGroup; + children = ( + 725B5E6F1C40C5BB00ABF520 /* Info.plist */, + 725B5E701C40C5BB00ABF520 /* SwiftAutoLayout.h */, + ); + name = Framework; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -123,7 +124,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 725A2B381A0468F300F44058 /* SwiftAutoLayout.h in Headers */, + 725B5E731C40C5BB00ABF520 /* SwiftAutoLayout.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -131,7 +132,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 725A2B6F1A046A8600F44058 /* SwiftAutoLayout.h in Headers */, + 725B5E741C40C5BB00ABF520 /* SwiftAutoLayout.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -261,7 +262,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 725A2B4F1A04695300F44058 /* SwiftAutoLayout.swift in Sources */, + 725B5E6C1C40C5B100ABF520 /* SwiftAutoLayout.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -277,7 +278,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 725A2B6E1A046A8000F44058 /* SwiftAutoLayout.swift in Sources */, + 725B5E6D1C40C5B100ABF520 /* SwiftAutoLayout.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -387,7 +388,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = SwiftAutoLayout/Info.plist; + INFOPLIST_FILE = Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.indragie.$(PRODUCT_NAME:rfc1034identifier)"; @@ -406,7 +407,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = SwiftAutoLayout/Info.plist; + INFOPLIST_FILE = Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.indragie.$(PRODUCT_NAME:rfc1034identifier)"; @@ -450,6 +451,7 @@ 725A2B691A046A3C00F44058 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DSTROOT = "/tmp/$(TARGET_NAME).dst"; @@ -461,7 +463,7 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = SwiftAutoLayout/Info.plist; + INFOPLIST_FILE = Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; @@ -469,12 +471,14 @@ PRODUCT_NAME = "$(PROJECT_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 725A2B6A1A046A3C00F44058 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; @@ -483,7 +487,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = SwiftAutoLayout/Info.plist; + INFOPLIST_FILE = Framework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10;