Skip to content

Commit dc1a88a

Browse files
Emily Toopstephencelis
Emily Toop
authored andcommitted
fixed issues as best I could with current knowledge re: Xcode 7 beta 6 language changes
Converted to Swift 2.0 for XCode 7.0 Beta 6. Compiles but does not pass tests.
1 parent 8514451 commit dc1a88a

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

Source/Extensions/FTS4.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public struct Tokenizer {
101101
}
102102

103103
if !tokenchars.isEmpty {
104-
let joined = "".join(tokenchars.map { String($0) })
104+
let joined = tokenchars.map { String($0) }.joinWithSeparator("")
105105
arguments.append("tokenchars=\(joined)".quote())
106106
}
107107

108108
if !separators.isEmpty {
109-
let joined = "".join(separators.map { String($0) })
109+
let joined = separators.map { String($0) }.joinWithSeparator("")
110110
arguments.append("separators=\(joined)".quote())
111111
}
112112

@@ -133,7 +133,7 @@ public struct Tokenizer {
133133
extension Tokenizer : CustomStringConvertible {
134134

135135
public var description: String {
136-
return " ".join([name] + arguments)
136+
return ([name] + arguments).joinWithSeparator(" ")
137137
}
138138

139139
}
@@ -146,7 +146,7 @@ extension Connection {
146146
if let (token, range) = next(string) {
147147
let view = string.utf8
148148
offset.memory += string.substringToIndex(range.startIndex).utf8.count
149-
length.memory = Int32(distance(range.startIndex.samePositionIn(view), range.endIndex.samePositionIn(view)))
149+
length.memory = Int32(range.startIndex.samePositionIn(view).distanceTo(range.endIndex.samePositionIn(view)))
150150
return token
151151
}
152152
return nil

Source/Extensions/R*Tree.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension Module {
2828
var arguments: [Expressible] = [primaryKey]
2929

3030
for pair in pairs {
31-
arguments.extend([pair.0, pair.1] as [Expressible])
31+
arguments.appendContentsOf([pair.0, pair.1] as [Expressible])
3232
}
3333

3434
return Module(name: "rtree", arguments: arguments)

Source/Helpers.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ public func *(_: Expression<Binding>?, _: Expression<Binding>?) -> Expression<Vo
3030

3131
public protocol _OptionalType {
3232

33-
typealias Wrapped
33+
typealias WrappedType
3434

3535
}
3636

3737
extension Optional : _OptionalType {
3838

39-
public typealias Wrapped = T
39+
public typealias WrappedType = Wrapped
4040

4141
}
4242

@@ -57,9 +57,9 @@ extension String {
5757
for expressible in expressions {
5858
let expression = expressible.expression
5959
template.append(expression.template)
60-
bindings.extend(expression.bindings)
60+
bindings.appendContentsOf(expression.bindings)
6161
}
62-
return Expression<Void>(join(template), bindings)
62+
return Expression<Void>(template.joinWithSeparator(self), bindings)
6363
}
6464

6565
@warn_unused_result func infix<T>(lhs: Expressible, _ rhs: Expressible, wrap: Bool = true) -> Expression<T> {
@@ -104,7 +104,7 @@ extension String {
104104
if let literal = literal {
105105
if let literal = literal as? NSData {
106106
let buf = UnsafeBufferPointer(start: UnsafePointer<UInt8>(literal.bytes), count: literal.length)
107-
let hex = "".join(buf.map { String(format: "%02x", $0) })
107+
let hex = buf.map { String(format: "%02x", $0) }.joinWithSeparator("")
108108
return "x'\(hex)'"
109109
}
110110
if let literal = literal as? String { return literal.quote("'") }

Source/Typed/AggregateFunctions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extension ExpressionType where UnderlyingType : Value {
5353

5454
}
5555

56-
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value {
56+
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value {
5757

5858
/// Builds a copy of the expression prefixed with the `DISTINCT` keyword.
5959
///
@@ -114,7 +114,7 @@ extension ExpressionType where UnderlyingType : protocol<Value, Comparable> {
114114

115115
}
116116

117-
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : protocol<Value, Comparable> {
117+
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : protocol<Value, Comparable> {
118118

119119
/// Builds a copy of the expression wrapped with the `max` aggregate
120120
/// function.
@@ -187,7 +187,7 @@ extension ExpressionType where UnderlyingType : Value, UnderlyingType.Datatype :
187187

188188
}
189189

190-
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value, UnderlyingType.Wrapped.Datatype : Number {
190+
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value, UnderlyingType.WrappedType.Datatype : Number {
191191

192192
/// Builds a copy of the expression wrapped with the `avg` aggregate
193193
/// function.

Source/Typed/CoreFunctions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extension ExpressionType where UnderlyingType : Number {
3737

3838
}
3939

40-
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Number {
40+
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Number {
4141

4242
/// Builds a copy of the expression wrapped with the `abs` function.
4343
///
@@ -598,7 +598,7 @@ extension CollectionType where Generator.Element : Value, Index.Distance == Int
598598
/// - Returns: A copy of the expression prepended with an `IN` check against
599599
/// the collection.
600600
@warn_unused_result public func contains(expression: Expression<Generator.Element>) -> Expression<Bool> {
601-
let templates = ", ".join([String](count: count, repeatedValue: "?"))
601+
let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ")
602602
return "IN".infix(expression, Expression<Void>("(\(templates))", map { $0.datatypeValue }))
603603
}
604604

@@ -614,7 +614,7 @@ extension CollectionType where Generator.Element : Value, Index.Distance == Int
614614
/// - Returns: A copy of the expression prepended with an `IN` check against
615615
/// the collection.
616616
@warn_unused_result public func contains(expression: Expression<Generator.Element?>) -> Expression<Bool?> {
617-
let templates = ", ".join([String](count: count, repeatedValue: "?"))
617+
let templates = [String](count: count, repeatedValue: "?").joinWithSeparator(", ")
618618
return "IN".infix(expression, Expression<Void>("(\(templates))", map { $0.datatypeValue }))
619619
}
620620

Source/Typed/Expression.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ extension ExpressionType where UnderlyingType : Value {
108108

109109
}
110110

111-
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.Wrapped : Value {
111+
extension ExpressionType where UnderlyingType : _OptionalType, UnderlyingType.WrappedType : Value {
112112

113113
public static var null: Self {
114114
return self.init(value: nil)
115115
}
116116

117-
public init(value: UnderlyingType.Wrapped?) {
117+
public init(value: UnderlyingType.WrappedType?) {
118118
self.init("?", [value?.datatypeValue])
119119
}
120120

Source/Typed/Query.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ extension Connection {
866866
column: for each in query.clauses.select.columns ?? [Expression<Void>(literal: "*")] {
867867
var names = each.expression.template.characters.split { $0 == "." }.map(String.init)
868868
let column = names.removeLast()
869-
let namespace = ".".join(names)
869+
let namespace = names.joinWithSeparator(".")
870870

871871
func expandGlob(namespace: Bool) -> QueryType -> Void {
872872
return { query in

Source/Typed/Schema.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ extension Table {
152152
}
153153

154154
private func indexName(columns: [Expressible]) -> Expressible {
155-
let string = " ".join(["index", clauses.from.name, "on"] + columns.map { $0.expression.template }).lowercaseString
155+
let string = (["index", clauses.from.name, "on"] + columns.map { $0.expression.template }).joinWithSeparator(" ").lowercaseString
156156

157157
let index = string.characters.reduce("") { underscored, character in
158158
guard character != "\"" else {

0 commit comments

Comments
 (0)