Skip to content

Commit

Permalink
Reverted single argument methods, added variadic instead
Browse files Browse the repository at this point in the history
  • Loading branch information
simoneconnola committed Jun 15, 2018
1 parent cfd2f20 commit e3eee41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
6 changes: 5 additions & 1 deletion Constrainable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = SimoneConnola;
TargetAttributes = {
1D0F27BE2032F1610081802A = {
Expand Down Expand Up @@ -161,13 +161,15 @@
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_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -221,13 +223,15 @@
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_RANGE_LOOP_ANALYSIS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
18 changes: 9 additions & 9 deletions Constrainable/Constrainable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public extension Constrainable {
NSLayoutConstraint.activate(constraints)
return constraints
}

@discardableResult func activate(_ constraintDescription: Constraint) -> NSLayoutConstraint {
let constraint = bind(constraintDescription)
NSLayoutConstraint.activate([constraint])
return constraint
@discardableResult func activate(_ constraintDescriptions: Constraint...) -> [NSLayoutConstraint] {
let constraints = bind(constraintDescriptions)
NSLayoutConstraint.activate(constraints)
return constraints
}

@discardableResult func bind(_ constraintDescriptions: [Constraint]) -> [NSLayoutConstraint] {
Expand All @@ -48,13 +48,13 @@ public extension Constrainable {
let constraints = constraintDescriptions.map { $0(self) }
return constraints
}

@discardableResult func bind(_ constraintDescription: Constraint) -> NSLayoutConstraint {
@discardableResult func bind(_ constraintDescriptions: Constraint...) -> [NSLayoutConstraint] {
if let view = self as? UIView {
view.translatesAutoresizingMaskIntoConstraints = false
}
let constraint = constraintDescription(self)
return constraint
let constraints = constraintDescriptions.map { $0(self) }
return constraints
}
}

Expand Down
2 changes: 1 addition & 1 deletion Constrainable/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.6</string>
<string>0.1.7</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit e3eee41

Please sign in to comment.