Skip to content

Commit b0b1c85

Browse files
committed
Swift 4
1 parent 7e65a06 commit b0b1c85

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CoreDataQueryInterface.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,6 @@
10591059
PRODUCT_NAME = CoreDataQueryInterface;
10601060
SKIP_INSTALL = YES;
10611061
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1062-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
10631062
SWIFT_VERSION = 4.0;
10641063
};
10651064
name = Debug;
@@ -1080,7 +1079,6 @@
10801079
PRODUCT_BUNDLE_IDENTIFIER = com.prosumma.CoreDataQueryInterface;
10811080
PRODUCT_NAME = CoreDataQueryInterface;
10821081
SKIP_INSTALL = YES;
1083-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
10841082
SWIFT_VERSION = 4.0;
10851083
};
10861084
name = Release;

CoreDataQueryInterface/Functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public struct FunctionExpression: PredicateComparableTypedExpressionConvertible,
4444
cdqiParent = nil
4545
}
4646
let range = self.function.range(of: ":")!
47-
cdqiKey = self.function.substring(to: range.lowerBound)
47+
cdqiKey = String(self.function[..<range.lowerBound])
4848
}
4949

5050
public var cdqiExpression: NSExpression {

CoreDataQueryInterface/Miscellanea.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public func alias(_ expression: KeyPathExpressionConvertible, type: NSAttributeT
3232
public func subquery<E: EntityAttribute>(_ items: E, _ query: (E) -> NSPredicate) -> ExpressionConvertible {
3333
let uuid = NSUUID().uuidString
3434
let index = uuid.index(uuid.startIndex, offsetBy: 6)
35-
let randomString = uuid.substring(to: index)
35+
let randomString = uuid[..<index]
3636
let variable = "v\(randomString)"
3737
return NSExpression(forSubquery: items.cdqiExpression, usingIteratorVariable: variable, predicate: query(E(variable: variable)))
3838
}

CoreDataQueryInterface/Protocols.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ extension KeyPathExpressionConvertible {
144144
}
145145
if let parentName = cdqiParent?.cdqiRawName {
146146
let index = key.index(key.startIndex, offsetBy: 1)
147-
let start = key.substring(to: index)
148-
let remainder = key.substring(from: index)
147+
// let start = key.substring(to: index)
148+
let start = key[..<index]
149+
// let remainder = key.substring(from: index)
150+
let remainder = key[index...]
149151
let name = "\(start.uppercased())\(remainder)"
150152
return "\(parentName)\(name)"
151153
}
@@ -158,7 +160,7 @@ extension KeyPathExpressionConvertible {
158160

159161
public var cdqiExpression: NSExpression {
160162
if let key = cdqiKey, key.hasPrefix("$") {
161-
return NSExpression(forVariable: key.substring(from: key.index(key.startIndex, offsetBy: 1)))
163+
return NSExpression(forVariable: String(key[key.index(key.startIndex, offsetBy: 1)...]))
162164
} else if cdqiKeyPath == "SELF" {
163165
return NSExpression(format: "SELF")
164166
}

0 commit comments

Comments
 (0)