Skip to content

Commit

Permalink
Merge pull request #271 from ankurp/swift-5
Browse files Browse the repository at this point in the history
Fixing warning for Swift 5
  • Loading branch information
ankurp authored Jul 24, 2019
2 parents 4feadc1 + c33c111 commit 8c956a6
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .swift-sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "sandbox",
"title": "Dollar",
"description": "Learn to use Dollar",
"swiftversion": "swift-4.0-RELEASE-ubuntu14.04",
"swiftversion": "swift-5.0-RELEASE-ubuntu14.04",
"giturl": "https://github.com/ankurp/DollarSwiftPackageSample",
"gittag": "1.0.0"
}
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.0
4 changes: 2 additions & 2 deletions Dollar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Dollar"
s.version = "8.0.0"
s.version = "9.0.0"
s.summary = "A functional tool-belt for Swift Language"
s.homepage = "https://github.com/ankurp/Dollar"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand All @@ -12,5 +12,5 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = "9.0"
s.watchos.deployment_target = "2.0"
s.requires_arc = true
s.swift_version = '4.2'
s.swift_version = '5.0'
end
17 changes: 7 additions & 10 deletions Dollar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@
LastUpgradeCheck = 9999;
TargetAttributes = {
"______Target_Dollar" = {
LastSwiftMigration = 0900;
LastSwiftMigration = 1030;
};
"______Target_DollarTests" = {
LastSwiftMigration = 0900;
LastSwiftMigration = 1030;
};
};
};
Expand All @@ -186,6 +186,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = "___RootGroup_";
Expand Down Expand Up @@ -243,8 +244,7 @@
PRODUCT_BUNDLE_IDENTIFIER = Dollar;
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -257,8 +257,7 @@
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -276,8 +275,7 @@
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -291,8 +289,7 @@
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Still stuck. Then checkout this screencast on [how to import](http://recordit.co

## Support for Xcode and Swift

* For Xcode 11 (Swift 5.0) use version `9.0.0`
* For Xcode 10 (Swift 4.2) use version `8.0.0`
* For Xcode 9 (Swift 4) use version `7.1.0`
* For Xcode 8 (Swift 3) use version `6.0.0`
Expand Down
20 changes: 10 additions & 10 deletions Sources/AutoBind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,52 @@

public extension Dollar {

public class func bind<T1, R>(f: @escaping (T1) -> R, _ t1: T1) -> (() -> R) {
class func bind<T1, R>(f: @escaping (T1) -> R, _ t1: T1) -> (() -> R) {
return { f(t1) }
}


public class func bind<T1, T2, R>(f: @escaping (T1, T2) -> R, _ t1: T1, _ t2: T2) -> (() -> R) {
class func bind<T1, T2, R>(f: @escaping (T1, T2) -> R, _ t1: T1, _ t2: T2) -> (() -> R) {
return { f(t1, t2) }
}


public class func bind<T1, T2, T3, R>(f: @escaping (T1, T2, T3) -> R, _ t1: T1, _ t2: T2, _ t3: T3) -> (() -> R) {
class func bind<T1, T2, T3, R>(f: @escaping (T1, T2, T3) -> R, _ t1: T1, _ t2: T2, _ t3: T3) -> (() -> R) {
return { f(t1, t2, t3) }
}


public class func bind<T1, T2, T3, T4, R>(f: @escaping (T1, T2, T3, T4) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4) -> (() -> R) {
class func bind<T1, T2, T3, T4, R>(f: @escaping (T1, T2, T3, T4) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4) -> (() -> R) {
return { f(t1, t2, t3, t4) }
}


public class func bind<T1, T2, T3, T4, T5, R>(f: @escaping (T1, T2, T3, T4, T5) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, R>(f: @escaping (T1, T2, T3, T4, T5) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5) -> (() -> R) {
return { f(t1, t2, t3, t4, t5) }
}


public class func bind<T1, T2, T3, T4, T5, T6, R>(f: @escaping (T1, T2, T3, T4, T5, T6) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, T6, R>(f: @escaping (T1, T2, T3, T4, T5, T6) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6) -> (() -> R) {
return { f(t1, t2, t3, t4, t5, t6) }
}


public class func bind<T1, T2, T3, T4, T5, T6, T7, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, T6, T7, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7) -> (() -> R) {
return { f(t1, t2, t3, t4, t5, t6, t7) }
}


public class func bind<T1, T2, T3, T4, T5, T6, T7, T8, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, T6, T7, T8, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8) -> (() -> R) {
return { f(t1, t2, t3, t4, t5, t6, t7, t8) }
}


public class func bind<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8, _ t9: T9) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8, _ t9: T9) -> (() -> R) {
return { f(t1, t2, t3, t4, t5, t6, t7, t8, t9) }
}


public class func bind<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8, _ t9: T9, _ t10: T10) -> (() -> R) {
class func bind<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> R, _ t1: T1, _ t2: T2, _ t3: T3, _ t4: T4, _ t5: T5, _ t6: T6, _ t7: T7, _ t8: T8, _ t9: T9, _ t10: T10) -> (() -> R) {
return { f(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) }
}

Expand Down
18 changes: 9 additions & 9 deletions Sources/AutoCurry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@

public extension Dollar {

public class func curry<T1, T2, R>(_ f: @escaping (T1, T2) -> R) -> (T1) -> (T2) -> R {
class func curry<T1, T2, R>(_ f: @escaping (T1, T2) -> R) -> (T1) -> (T2) -> R {
return { t1 in { t2 in f(t1, t2) } }
}


public class func curry<T1, T2, T3, R>(_ f: @escaping (T1, T2, T3) -> R) -> (T1) -> (T2) -> (T3) -> R {
class func curry<T1, T2, T3, R>(_ f: @escaping (T1, T2, T3) -> R) -> (T1) -> (T2) -> (T3) -> R {
return { t1 in { t2 in { t3 in f(t1, t2, t3) } } }
}


public class func curry<T1, T2, T3, T4, R>(_ f: @escaping (T1, T2, T3, T4) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> R {
class func curry<T1, T2, T3, T4, R>(_ f: @escaping (T1, T2, T3, T4) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> R {
return { t1 in { t2 in { t3 in { t4 in f(t1, t2, t3, t4) } } } }
}


public class func curry<T1, T2, T3, T4, T5, R>(_ f: @escaping (T1, T2, T3, T4, T5) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> R {
class func curry<T1, T2, T3, T4, T5, R>(_ f: @escaping (T1, T2, T3, T4, T5) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in f(t1, t2, t3, t4, t5) } } } } }
}


public class func curry<T1, T2, T3, T4, T5, T6, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> R {
class func curry<T1, T2, T3, T4, T5, T6, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in { t6 in f(t1, t2, t3, t4, t5, t6) } } } } } }
}


public class func curry<T1, T2, T3, T4, T5, T6, T7, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> R {
class func curry<T1, T2, T3, T4, T5, T6, T7, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in { t6 in { t7 in f(t1, t2, t3, t4, t5, t6, t7) } } } } } } }
}


public class func curry<T1, T2, T3, T4, T5, T6, T7, T8, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> R {
class func curry<T1, T2, T3, T4, T5, T6, T7, T8, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in { t6 in { t7 in { t8 in f(t1, t2, t3, t4, t5, t6, t7, t8) } } } } } } } }
}


public class func curry<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> R {
class func curry<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in { t6 in { t7 in { t8 in { t9 in f(t1, t2, t3, t4, t5, t6, t7, t8, t9) } } } } } } } } }
}


public class func curry<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) -> R {
class func curry<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(_ f: @escaping (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> R) -> (T1) -> (T2) -> (T3) -> (T4) -> (T5) -> (T6) -> (T7) -> (T8) -> (T9) -> (T10) -> R {
return { t1 in { t2 in { t3 in { t4 in { t5 in { t6 in { t7 in { t8 in { t9 in { t10 in f(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) } } } } } } } } } }
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Dollar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ open class Dollar {
/// the last partition may less than n elements long.
/// - returns: Array partitioned into n element arrays, starting step elements apart.
open class func partition<T>(_ array: [T], n num: Int, step: Int? = .none, pad: [T]?) -> [[T]] {
var array = array
let array = array
var num = num
var step = step
var result: [[T]] = []
Expand Down
4 changes: 2 additions & 2 deletions Tests/DollarTests/DollarTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DollarTests: XCTestCase {
}

func testSequence() {
XCTAssertEqual(Dollar.sequence("abc".characters), ["a", "b", "c"], "Generates array of characters")
XCTAssertEqual(Dollar.sequence("abc"), ["a", "b", "c"], "Generates array of characters")
}

func testRemove() {
Expand Down Expand Up @@ -620,7 +620,7 @@ class DollarTests: XCTestCase {
XCTAssertEqual(oddEven[0]!, [2, 4], "Returns dictionary grouped by remainders of two")
XCTAssertEqual(oddEven[1]!, [1, 3], "Returns dictionary grouped by remainders of two")

let wordCount = Dollar.groupBy(["strings", "with", "different", "lengths"], callback: {$0.characters.count})
let wordCount = Dollar.groupBy(["strings", "with", "different", "lengths"], callback: {$0.count})
XCTAssertEqual(wordCount[7]!, ["strings", "lengths"], "Returns dictionary with string lengths as keys")
XCTAssertEqual(wordCount[9]!, ["different"], "Returns dictionary with string lengths as keys")
XCTAssertEqual(wordCount[4]!, ["with"], "Returns dictionary with string lengths as keys")
Expand Down

0 comments on commit 8c956a6

Please sign in to comment.